Fixed up the old unlogged calls to the kernel and rpm_kernel methods
using the @record decorator. The old unlogged calls were being made
by calling the "internal" versions of the methods, but now we just
have the decorated methods accept an extra "logged" parameter that
can be used to disable logging.
This change also changes the decorator to actually return the result
of the wrapped method, instead of always swallowing it.
From: John Admanski <jadmanski@google.com>
Signed-off-by: Martin Bligh <mbligh@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@917 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/bin/kernel.py b/client/bin/kernel.py
index cf19bcd..e1d18f9 100755
--- a/client/bin/kernel.py
+++ b/client/bin/kernel.py
@@ -7,18 +7,25 @@
def record(fn):
""" Decorator for logging calls to specific kernel methods.
+ It also accepts a "logged=False" keyword argument to disable
+ the logging for particular calls.
Classes that make use of this dectorator will need to have job
and subdir attributes for the logging to function correctly.
"""
def recorded_func(self, *args, **dargs):
+ logged = dargs.pop('logged', True)
+ if not logged:
+ return fn(self, *args, **dargs)
+ # wrap the method call in success/failure logging
name = "kernel.%s" % fn.__name__
try:
- fn(self, *args, **dargs)
+ result = fn(self, *args, **dargs)
self.job.record('GOOD', self.subdir, name)
except Exception, detail:
self.job.record('FAIL', self.subdir, name, str(detail))
raise
+ return result
return recorded_func
@@ -259,7 +266,7 @@
os.chdir(self.build_dir)
self.set_cross_cc()
- self._clean()
+ self.clean(logged=False)
build_string = "/usr/bin/time -o %s make %s -j %s vmlinux" \
% (timefile, make_opts, threads)
build_string += ' > %s 2>&1' % output