From: Markus Lehtonen <markus.lehtonen@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 3/4] oeqa.buildperf: treat failed measurements as errors
Date: Fri, 26 Aug 2016 10:33:10 +0300 [thread overview]
Message-ID: <1472196791-24336-4-git-send-email-markus.lehtonen@linux.intel.com> (raw)
In-Reply-To: <1472196791-24336-1-git-send-email-markus.lehtonen@linux.intel.com>
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.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
meta/lib/oeqa/buildperf/base.py | 36 +++++++++++++-----------------------
1 file changed, 13 insertions(+), 23 deletions(-)
diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py
index 83439f1..dbc534e 100644
--- a/meta/lib/oeqa/buildperf/base.py
+++ b/meta/lib/oeqa/buildperf/base.py
@@ -75,9 +75,7 @@ def time_cmd(cmd, **kwargs):
if isinstance(cmd, str):
timecmd = ' '.join(timecmd) + ' '
timecmd += cmd
- # TODO: 'ignore_status' could/should be removed when globalres.log is
- # deprecated. The function would just raise an exception, instead
- ret = runCmd2(timecmd, ignore_status=True, **kwargs)
+ ret = runCmd2(timecmd, **kwargs)
timedata = tmpf.file.read()
return ret, timedata
@@ -315,16 +313,15 @@ class BuildPerfTestCase(unittest.TestCase):
cmd_str = cmd if isinstance(cmd, str) else ' '.join(cmd)
log.info("Timing command: %s", cmd_str)
cmd_log = os.path.join(self.out_dir, 'commands.log')
- with open(cmd_log, 'a') as fobj:
- ret, timedata = time_cmd(cmd, stdout=fobj)
- if ret.status:
- log.error("Time will be reported as 0. Command failed: %s",
- ret.status)
- etime = timedelta(0)
- self._failed = True
- else:
- match = re.search(r'.*wall clock.*: (?P<etime>.*)\n', timedata)
- etime = str_time_to_timedelta(match.group('etime'))
+ try:
+ with open(cmd_log, 'a') as fobj:
+ ret, timedata = time_cmd(cmd, stdout=fobj)
+ except CommandError:
+ log.error("Command '%s' failed, see %s for more details", cmd_str,
+ cmd_log)
+ raise
+ match = re.search(r'.*wall clock.*: (?P<etime>.*)\n', timedata)
+ etime = str_time_to_timedelta(match.group('etime'))
measurement = {'type': self.SYSRES,
'name': name,
@@ -344,16 +341,9 @@ class BuildPerfTestCase(unittest.TestCase):
def measure_disk_usage(self, path, name, legend):
"""Estimate disk usage of a file or directory"""
- # TODO: 'ignore_status' could/should be removed when globalres.log is
- # deprecated. The function would just raise an exception, instead
- ret = runCmd2(['du', '-s', path], ignore_status=True)
- if ret.status:
- log.error("du failed, disk usage will be reported as 0")
- size = 0
- self._failed = True
- else:
- size = int(ret.output.split()[0])
- log.debug("Size of %s path is %s", path, size)
+ ret = runCmd2(['du', '-s', path])
+ size = int(ret.output.split()[0])
+ log.debug("Size of %s path is %s", path, size)
measurement = {'type': self.DISKUSAGE,
'name': name,
'legend': legend}
--
2.6.6
next prev parent reply other threads:[~2016-08-26 7:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-26 7:33 [PATCH 0/4] oe-build-perf-test: remove inter-dependencies of tests Markus Lehtonen
2016-08-26 7:33 ` [PATCH 1/4] oeqa.buildperf: fix checking of invalid results Markus Lehtonen
2016-08-26 7:33 ` [PATCH 2/4] oeqa.buildperf: make tests independent Markus Lehtonen
2016-08-26 7:33 ` Markus Lehtonen [this message]
2016-08-26 7:33 ` [PATCH 4/4] oe-build-perf-test: update globalres and git even if tests failed Markus Lehtonen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1472196791-24336-4-git-send-email-markus.lehtonen@linux.intel.com \
--to=markus.lehtonen@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox