Add a mechanism for server-side tests to declare which of their parameters is the Host object they run on. Also adds code to the server test execution to automatically call Host.log_kernel before each of those tests, so that we can ensure that the kernel a single-machine server test is running on is always captured. Risk: Low Visibility: Adds semi-automatic kernel logging for server tests Signed-off-by: John Admanski <[email protected]> git-svn-id: http://test.kernel.org/svn/autotest/trunk@3640 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/test.py b/server/test.py index 37ca658..99f2a74 100755 --- a/server/test.py +++ b/server/test.py
@@ -10,6 +10,7 @@ class test(common_test.base_test): disable_sysinfo_install_cache = False + host_parameter = None _sysinfo_before_test_script = """\ @@ -223,6 +224,17 @@ logger = None logging_args = [None, None, None, None] + # add in a hook that calls host.log_kernel if we can + def log_kernel_hook(mytest, existing_hook=logging_args[0]): + if mytest.host_parameter: + host = dargs[mytest.host_parameter] + if host: + host.log_kernel() + # chain this call with any existing hook + if existing_hook: + existing_hook(mytest) + logging_args[0] = log_kernel_hook + try: common_test.runtest(job, url, tag, args, dargs, locals(), globals(), *logging_args)