summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/buildperf/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/buildperf/base.py')
-rw-r--r--meta/lib/oeqa/buildperf/base.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py
index 0b2c0f8e73..be3a946ddf 100644
--- a/meta/lib/oeqa/buildperf/base.py
+++ b/meta/lib/oeqa/buildperf/base.py
@@ -220,6 +220,8 @@ class BuildPerfTestResult(unittest.TextTestResult):
220 'status': status, 220 'status': status,
221 'start_time': test.start_time, 221 'start_time': test.start_time,
222 'elapsed_time': test.elapsed_time, 222 'elapsed_time': test.elapsed_time,
223 'cmd_log_file': os.path.relpath(test.cmd_log_file,
224 self.out_dir),
223 'measurements': test.measurements} 225 'measurements': test.measurements}
224 results['tests'] = tests 226 results['tests'] = tests
225 227
@@ -312,6 +314,10 @@ class BuildPerfTestCase(unittest.TestCase):
312 def out_dir(self): 314 def out_dir(self):
313 return os.path.join(self.base_dir, self.name) 315 return os.path.join(self.base_dir, self.name)
314 316
317 @property
318 def cmd_log_file(self):
319 return os.path.join(self.out_dir, 'commands.log')
320
315 def setUp(self): 321 def setUp(self):
316 """Set-up fixture for each test""" 322 """Set-up fixture for each test"""
317 if self.build_target: 323 if self.build_target:
@@ -328,9 +334,8 @@ class BuildPerfTestCase(unittest.TestCase):
328 """Run a command and log it's output""" 334 """Run a command and log it's output"""
329 cmd_str = cmd if isinstance(cmd, str) else ' '.join(cmd) 335 cmd_str = cmd if isinstance(cmd, str) else ' '.join(cmd)
330 log.info("Logging command: %s", cmd_str) 336 log.info("Logging command: %s", cmd_str)
331 cmd_log = os.path.join(self.out_dir, 'commands.log')
332 try: 337 try:
333 with open(cmd_log, 'a') as fobj: 338 with open(self.cmd_log_file, 'a') as fobj:
334 runCmd2(cmd, stdout=fobj) 339 runCmd2(cmd, stdout=fobj)
335 except CommandError as err: 340 except CommandError as err:
336 log.error("Command failed: %s", err.retcode) 341 log.error("Command failed: %s", err.retcode)
@@ -368,9 +373,8 @@ class BuildPerfTestCase(unittest.TestCase):
368 cmd_str = cmd if isinstance(cmd, str) else ' '.join(cmd) 373 cmd_str = cmd if isinstance(cmd, str) else ' '.join(cmd)
369 log.info("Timing command: %s", cmd_str) 374 log.info("Timing command: %s", cmd_str)
370 data_q = SimpleQueue() 375 data_q = SimpleQueue()
371 cmd_log = os.path.join(self.out_dir, 'commands.log')
372 try: 376 try:
373 with open(cmd_log, 'a') as fobj: 377 with open(self.cmd_log_file, 'a') as fobj:
374 proc = Process(target=_worker, args=(data_q, cmd,), 378 proc = Process(target=_worker, args=(data_q, cmd,),
375 kwargs={'stdout': fobj}) 379 kwargs={'stdout': fobj})
376 proc.start() 380 proc.start()
@@ -380,7 +384,7 @@ class BuildPerfTestCase(unittest.TestCase):
380 raise data 384 raise data
381 except CommandError: 385 except CommandError:
382 log.error("Command '%s' failed, see %s for more details", cmd_str, 386 log.error("Command '%s' failed, see %s for more details", cmd_str,
383 cmd_log) 387 self.cmd_log_file)
384 raise 388 raise
385 etime = data['elapsed_time'] 389 etime = data['elapsed_time']
386 390