Once upon a time, a long long time ago, on a dark and stormy night,
it seemed like a good idea to someone (me) to try to be terribly
clever and pickle the kernel object across runs so kernbench
didn't have to recreate the kernel build dir every time.
Turns out that causes weird and wonderful problems, especially
when the server copies a "used" (or in car dealer-speak "experienced")
copy of the client source code to another machine.
As nowadays the kernel object will take a prebuilt directory
anyway, we can avoid the pickle, and all the complexity, just
by doing "leave=True", and passing back the build directory
instead of a tarball to the newly created object.
Also, redirect the output to a file - it'll slow down the benchmark too much
otherwise if done from a slow console
Signed-off-by: Martin J. Bligh <mbligh@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@789 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/bin/kernel.py b/client/bin/kernel.py
index 120725a..78b84ff 100755
--- a/client/bin/kernel.py
+++ b/client/bin/kernel.py
@@ -68,7 +68,8 @@
if os.path.isdir(self.build_dir):
system('rm -rf ' + self.build_dir)
- os.mkdir(self.src_dir)
+ if not os.path.exists(self.src_dir):
+ os.mkdir(self.src_dir)
for path in [self.config_dir, self.log_dir, self.results_dir]:
if os.path.exists(path):
system('rm -rf ' + path)
@@ -258,15 +259,20 @@
self.__record(self._build, "kernel.build", *args, **dargs)
- def build_timed(self, threads, timefile = '/dev/null', make_opts = ''):
+ def build_timed(self, threads, timefile = '/dev/null', make_opts = '',
+ output = None):
"""time the bulding of the kernel"""
os.chdir(self.build_dir)
self.set_cross_cc()
- print "make clean"
- system('make clean')
- build_string = "/usr/bin/time -o %s make %s -j %s vmlinux" % (timefile, make_opts, threads)
+
+ self._clean()
+ build_string = "/usr/bin/time -o %s make %s -j %s vmlinux" \
+ % (timefile, make_opts, threads)
+ if output:
+ build_string += ' >> %s 2>&1' % output
print build_string
system(build_string)
+
if (not os.path.isfile('vmlinux')):
raise TestError("no vmlinux found, kernel build failed")
@@ -275,7 +281,7 @@
"""make clean in the kernel tree"""
os.chdir(self.build_dir)
print "make clean"
- system('make clean')
+ system('make clean > /dev/null 2> /dev/null')
def clean(self, *args, **dargs):