提交 b2e60062 编写于 作者: L Lucas Meneghel Rodrigues

avocado.job: Move sysinfo collection to test result object

We found a bug: The sysinfo collection was overwriting the
post information in jobs run through the vm plugin. Fix
the problem by moving the information collection to the
test result object. This is transparent to plugins, one
important requirement of the solution.
Signed-off-by: NLucas Meneghel Rodrigues <lmr@redhat.com>
上级 49770bec
...@@ -63,6 +63,8 @@ class TestRunner(object): ...@@ -63,6 +63,8 @@ class TestRunner(object):
""" """
self.job = job self.job = job
self.result = test_result self.result = test_result
sysinfo_dir = path.init_dir(self.job.logdir, 'sysinfo')
self.sysinfo = sysinfo.SysInfo(basedir=sysinfo_dir)
def load_test(self, params, queue): def load_test(self, params, queue):
""" """
...@@ -177,6 +179,7 @@ class TestRunner(object): ...@@ -177,6 +179,7 @@ class TestRunner(object):
:return: a list of test failures. :return: a list of test failures.
""" """
failures = [] failures = []
self.sysinfo.start_job_hook()
self.result.start_tests() self.result.start_tests()
q = multiprocessing.Queue() q = multiprocessing.Queue()
for params in params_list: for params in params_list:
...@@ -276,6 +279,7 @@ class TestRunner(object): ...@@ -276,6 +279,7 @@ class TestRunner(object):
failures.append(test_state['name']) failures.append(test_state['name'])
runtime.CURRENT_TEST = None runtime.CURRENT_TEST = None
self.result.end_tests() self.result.end_tests()
self.sysinfo.end_job_hook()
return failures return failures
...@@ -334,8 +338,6 @@ class Job(object): ...@@ -334,8 +338,6 @@ class Job(object):
self.test_index = 1 self.test_index = 1
self.status = "RUNNING" self.status = "RUNNING"
self.result_proxy = result.TestResultProxy() self.result_proxy = result.TestResultProxy()
self.sysinfo_dir = path.init_dir(self.logdir, 'sysinfo')
self.sysinfo_logger = sysinfo.SysInfo(basedir=self.sysinfo_dir)
self.view = output.View(app_args=self.args) self.view = output.View(app_args=self.args)
def _make_test_runner(self): def _make_test_runner(self):
...@@ -413,7 +415,6 @@ class Job(object): ...@@ -413,7 +415,6 @@ class Job(object):
:class:`avocado.core.exceptions.JobBaseException` errors, :class:`avocado.core.exceptions.JobBaseException` errors,
that configure a job failure. that configure a job failure.
""" """
self.sysinfo_logger.start_job_hook()
params_list = [] params_list = []
if urls is None: if urls is None:
if self.args and self.args.url: if self.args and self.args.url:
...@@ -474,7 +475,6 @@ class Job(object): ...@@ -474,7 +475,6 @@ class Job(object):
self.view.logfile = self.logfile self.view.logfile = self.logfile
failures = self.test_runner.run(params_list) failures = self.test_runner.run(params_list)
self.view.stop_file_logging() self.view.stop_file_logging()
self.sysinfo_logger.end_job_hook()
# If it's all good so far, set job status to 'PASS' # If it's all good so far, set job status to 'PASS'
if self.status == 'RUNNING': if self.status == 'RUNNING':
self.status = 'PASS' self.status = 'PASS'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册