Fix up kernel build class
We need to actually store the results of the kernel build in a sensible place,
not just lob everything in a temporary directory. Break out the paramaters
of kernel.build() so we can specify separately where the different parts go.
Fix up all callers.
Also added a new test (kernelbuild) that utilizes the new functionality (and
is the simplest test yet ;-)).
Eliminate requirement to specify the tmpdir to kernel.build(), as most people
won't care, and it's just confusing. This is now an optional parameter.
When we do a kernel.build() from a control file, make sure we create a build
directory to store the results in in the results directory. Locate appropriate
build output in there. I'm not copying patches in there yet, will do that later
Signed-off-by: Martin J. Bligh <mbligh@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@383 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/bin/job.py b/client/bin/job.py
index f89fa06..52e0ae0 100755
--- a/client/bin/job.py
+++ b/client/bin/job.py
@@ -108,9 +108,30 @@
return self.config.get(name)
- def kernel(self, topdir, base_tree, *args, **dargs):
+ def kernel(self, base_tree, results_dir = '', tmp_dir = '', leave = False):
"""Summon a kernel object"""
- return kernel.kernel(self, topdir, base_tree, *args, **dargs)
+ if not tmp_dir:
+ tmp_dir = self.tmpdir + '/build'
+ if not os.path.exists(tmp_dir):
+ os.mkdir(tmp_dir)
+ if not os.path.isdir(tmp_dir):
+ raise "Temp dir (%s) is not a dir - args backwards?" \
+ % self.tmpdir
+
+ # We label the first build "build" and then subsequent ones
+ # as "build.2", "build.3", etc. Whilst this is a little bit
+ # inconsistent, 99.9% of jobs will only have one build
+ # (that's not done as kernbench, sparse, or buildtest),
+ # so it works out much cleaner. One of life's comprimises.
+ if not results_dir:
+ results_dir = os.path.join(self.resultdir, 'build')
+ i = 2
+ while os.path.exists(results_dir):
+ results_dir = os.path.join(self.resultdir, 'build.%d' % i)
+ if not os.path.exists(results_dir):
+ os.mkdir(results_dir)
+
+ return kernel.kernel(self, base_tree, results_dir, tmp_dir, leave)
def barrier(self, *args):