diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2016-06-30 15:53:52 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-08-17 10:35:44 +0100 |
commit | 51970d10d66be742df3c4d6d5755f5f426c7d221 (patch) | |
tree | e05b981b26affce75baa18145cc5119533572d7a /meta/lib | |
parent | 818d4c2d8e8507634be5bb89087a24f971a4be01 (diff) | |
download | openembedded-core-contrib-51970d10d66be742df3c4d6d5755f5f426c7d221.tar.gz |
oeqa.buildperf: be more verbose about failed commands
Log failures of commands whose output is stored.
(From OE-Core rev: 240f6e7366c8a9ea830e531d307dd2e27a61a6bd)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/buildperf/base.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py index 52c2ab61bf..fe18181f2b 100644 --- a/meta/lib/oeqa/buildperf/base.py +++ b/meta/lib/oeqa/buildperf/base.py @@ -23,7 +23,7 @@ import unittest from datetime import datetime, timedelta from functools import partial -from oeqa.utils.commands import runCmd, get_bb_vars +from oeqa.utils.commands import CommandError, runCmd, get_bb_vars from oeqa.utils.git import GitError, GitRepo # Get logger for this module @@ -216,9 +216,15 @@ class BuildPerfTestCase(unittest.TestCase): def log_cmd_output(self, cmd): """Run a command and log it's output""" + cmd_str = cmd if isinstance(cmd, str) else ' '.join(cmd) + log.info("Logging command: %s", cmd_str) cmd_log = os.path.join(self.out_dir, 'commands.log') - with open(cmd_log, 'a') as fobj: - runCmd2(cmd, stdout=fobj) + try: + with open(cmd_log, 'a') as fobj: + runCmd2(cmd, stdout=fobj) + except CommandError as err: + log.error("Command failed: %s", err.retcode) + raise def measure_cmd_resources(self, cmd, name, legend): """Measure system resource usage of a command""" |