diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2017-04-05 15:36:04 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-04-08 22:48:04 +0100 |
commit | b6c72c0d169473e2626938be2ee59f850624612e (patch) | |
tree | 8cb765b96c81710d1132e2290ad5437f2f5ab2bd /scripts/lib/compatlayer/cases | |
parent | 1da641661bb5963fcbd7ac2c20bc997c3eae6f18 (diff) | |
download | openembedded-core-b6c72c0d169473e2626938be2ee59f850624612e.tar.gz openembedded-core-b6c72c0d169473e2626938be2ee59f850624612e.tar.bz2 openembedded-core-b6c72c0d169473e2626938be2ee59f850624612e.zip |
yocto-compat-layer: fix also other command invocations
In commit 5b9ac62ab535d, one place was fixed where a command was
invoked such that failures caused double stack traces and stderr was
lost. The same problem also occurs elsewhere, triggered for example by
a layer with parsing problems.
Now a new utility method is used instead of repeating the code.
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/compatlayer/cases')
-rw-r--r-- | scripts/lib/compatlayer/cases/common.py | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/scripts/lib/compatlayer/cases/common.py b/scripts/lib/compatlayer/cases/common.py index 4d328ec1f1..9cc682e2c1 100644 --- a/scripts/lib/compatlayer/cases/common.py +++ b/scripts/lib/compatlayer/cases/common.py @@ -2,9 +2,8 @@ # Released under the MIT license (see COPYING.MIT) import os -import subprocess import unittest -from compatlayer import get_signatures, LayerType +from compatlayer import get_signatures, LayerType, check_command from compatlayer.case import OECompatLayerTestCase class CommonCompatLayer(OECompatLayerTestCase): @@ -20,26 +19,12 @@ class CommonCompatLayer(OECompatLayerTestCase): msg="Layer contains README file but is empty.") def test_parse(self): - try: - output = subprocess.check_output('bitbake -p', shell=True, - stderr=subprocess.PIPE) - except subprocess.CalledProcessError as e: - import traceback - exc = traceback.format_exc() - msg = 'Layer %s failed to parse.\n%s\n%s\n' % (self.tc.layer['name'], - exc, e.output.decode('utf-8')) - raise RuntimeError(msg) + check_command('Layer %s failed to parse.' % self.tc.layer['name'], + 'bitbake -p') def test_show_environment(self): - try: - output = subprocess.check_output('bitbake -e', shell=True, - stderr=subprocess.PIPE) - except subprocess.CalledProcessError as e: - import traceback - exc = traceback.format_exc() - msg = 'Layer %s failed to show environment.\n%s\n%s\n' % \ - (self.tc.layer['name'], exc, e.output.decode('utf-8')) - raise RuntimeError(msg) + check_command('Layer %s failed to show environment.' % self.tc.layer['name'], + 'bitbake -e') def test_signatures(self): if self.tc.layer['type'] == LayerType.SOFTWARE: |