[oe-commits] [openembedded-core] 61/62: oeqa.buildperf: be more verbose about failed commands

git at git.openembedded.org git at git.openembedded.org
Wed Aug 17 09:37:18 UTC 2016


rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 240f6e7366c8a9ea830e531d307dd2e27a61a6bd
Author: Markus Lehtonen <markus.lehtonen at linux.intel.com>
AuthorDate: Thu Jun 30 15:53:52 2016 +0300

    oeqa.buildperf: be more verbose about failed commands
    
    Log failures of commands whose output is stored.
    
    Signed-off-by: Markus Lehtonen <markus.lehtonen at linux.intel.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/lib/oeqa/buildperf/base.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/meta/lib/oeqa/buildperf/base.py b/meta/lib/oeqa/buildperf/base.py
index 52c2ab6..fe18181 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"""

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list