summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2016-08-26 10:33:10 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-03 09:58:41 +0100
commit899b17413c79fe51992a837fc23d289e97a74004 (patch)
treeab93e7b41a04f578080611e5f74f918ab7551c63
parent85b7b10b4a981cc17fca688e6ac592a5683a2546 (diff)
downloadpoky-899b17413c79fe51992a837fc23d289e97a74004.tar.gz
oeqa.buildperf: treat failed measurements as errors
Now failed measurements correctly cause a test failure (recorded as an error). There should be no need to continue the test if one step fails, especially now that the tests don't depend on each other. (From OE-Core rev: 446e32aadc775ca146d12173b1463f524d7fe6ef) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/buildperf/base.py36
1 files changed, 13 insertions, 23 deletions
diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py
index 83439f1bdb..dbc534efe3 100644
--- a/meta/lib/oeqa/buildperf/base.py
+++ b/meta/lib/oeqa/buildperf/base.py
@@ -75,9 +75,7 @@ def time_cmd(cmd, **kwargs):
75 if isinstance(cmd, str): 75 if isinstance(cmd, str):
76 timecmd = ' '.join(timecmd) + ' ' 76 timecmd = ' '.join(timecmd) + ' '
77 timecmd += cmd 77 timecmd += cmd
78 # TODO: 'ignore_status' could/should be removed when globalres.log is 78 ret = runCmd2(timecmd, **kwargs)
79 # deprecated. The function would just raise an exception, instead
80 ret = runCmd2(timecmd, ignore_status=True, **kwargs)
81 timedata = tmpf.file.read() 79 timedata = tmpf.file.read()
82 return ret, timedata 80 return ret, timedata
83 81
@@ -315,16 +313,15 @@ class BuildPerfTestCase(unittest.TestCase):
315 cmd_str = cmd if isinstance(cmd, str) else ' '.join(cmd) 313 cmd_str = cmd if isinstance(cmd, str) else ' '.join(cmd)
316 log.info("Timing command: %s", cmd_str) 314 log.info("Timing command: %s", cmd_str)
317 cmd_log = os.path.join(self.out_dir, 'commands.log') 315 cmd_log = os.path.join(self.out_dir, 'commands.log')
318 with open(cmd_log, 'a') as fobj: 316 try:
319 ret, timedata = time_cmd(cmd, stdout=fobj) 317 with open(cmd_log, 'a') as fobj:
320 if ret.status: 318 ret, timedata = time_cmd(cmd, stdout=fobj)
321 log.error("Time will be reported as 0. Command failed: %s", 319 except CommandError:
322 ret.status) 320 log.error("Command '%s' failed, see %s for more details", cmd_str,
323 etime = timedelta(0) 321 cmd_log)
324 self._failed = True 322 raise
325 else: 323 match = re.search(r'.*wall clock.*: (?P<etime>.*)\n', timedata)
326 match = re.search(r'.*wall clock.*: (?P<etime>.*)\n', timedata) 324 etime = str_time_to_timedelta(match.group('etime'))
327 etime = str_time_to_timedelta(match.group('etime'))
328 325
329 measurement = {'type': self.SYSRES, 326 measurement = {'type': self.SYSRES,
330 'name': name, 327 'name': name,
@@ -344,16 +341,9 @@ class BuildPerfTestCase(unittest.TestCase):
344 341
345 def measure_disk_usage(self, path, name, legend): 342 def measure_disk_usage(self, path, name, legend):
346 """Estimate disk usage of a file or directory""" 343 """Estimate disk usage of a file or directory"""
347 # TODO: 'ignore_status' could/should be removed when globalres.log is 344 ret = runCmd2(['du', '-s', path])
348 # deprecated. The function would just raise an exception, instead 345 size = int(ret.output.split()[0])
349 ret = runCmd2(['du', '-s', path], ignore_status=True) 346 log.debug("Size of %s path is %s", path, size)
350 if ret.status:
351 log.error("du failed, disk usage will be reported as 0")
352 size = 0
353 self._failed = True
354 else:
355 size = int(ret.output.split()[0])
356 log.debug("Size of %s path is %s", path, size)
357 measurement = {'type': self.DISKUSAGE, 347 measurement = {'type': self.DISKUSAGE,
358 'name': name, 348 'name': name,
359 'legend': legend} 349 'legend': legend}