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-10 23:00:42 +0100 |
| commit | efd3b0ee305e7372e736262fd2ab2bcc983b1b15 (patch) | |
| tree | 4d1a374dcb58bb2c5dced73f2bf48fce7ca6e479 /scripts/lib/compatlayer/cases/common.py | |
| parent | f81a532dd65ba5148b7072231ed85361dbad7a2c (diff) | |
| download | poky-efd3b0ee305e7372e736262fd2ab2bcc983b1b15.tar.gz | |
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.
(From OE-Core rev: b6c72c0d169473e2626938be2ee59f850624612e)
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/common.py')
| -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 @@ | |||
| 2 | # Released under the MIT license (see COPYING.MIT) | 2 | # Released under the MIT license (see COPYING.MIT) |
| 3 | 3 | ||
| 4 | import os | 4 | import os |
| 5 | import subprocess | ||
| 6 | import unittest | 5 | import unittest |
| 7 | from compatlayer import get_signatures, LayerType | 6 | from compatlayer import get_signatures, LayerType, check_command |
| 8 | from compatlayer.case import OECompatLayerTestCase | 7 | from compatlayer.case import OECompatLayerTestCase |
| 9 | 8 | ||
| 10 | class CommonCompatLayer(OECompatLayerTestCase): | 9 | class CommonCompatLayer(OECompatLayerTestCase): |
| @@ -20,26 +19,12 @@ class CommonCompatLayer(OECompatLayerTestCase): | |||
| 20 | msg="Layer contains README file but is empty.") | 19 | msg="Layer contains README file but is empty.") |
| 21 | 20 | ||
| 22 | def test_parse(self): | 21 | def test_parse(self): |
| 23 | try: | 22 | check_command('Layer %s failed to parse.' % self.tc.layer['name'], |
| 24 | output = subprocess.check_output('bitbake -p', shell=True, | 23 | 'bitbake -p') |
| 25 | stderr=subprocess.PIPE) | ||
| 26 | except subprocess.CalledProcessError as e: | ||
| 27 | import traceback | ||
| 28 | exc = traceback.format_exc() | ||
| 29 | msg = 'Layer %s failed to parse.\n%s\n%s\n' % (self.tc.layer['name'], | ||
| 30 | exc, e.output.decode('utf-8')) | ||
| 31 | raise RuntimeError(msg) | ||
| 32 | 24 | ||
| 33 | def test_show_environment(self): | 25 | def test_show_environment(self): |
| 34 | try: | 26 | check_command('Layer %s failed to show environment.' % self.tc.layer['name'], |
| 35 | output = subprocess.check_output('bitbake -e', shell=True, | 27 | 'bitbake -e') |
| 36 | stderr=subprocess.PIPE) | ||
| 37 | except subprocess.CalledProcessError as e: | ||
| 38 | import traceback | ||
| 39 | exc = traceback.format_exc() | ||
| 40 | msg = 'Layer %s failed to show environment.\n%s\n%s\n' % \ | ||
| 41 | (self.tc.layer['name'], exc, e.output.decode('utf-8')) | ||
| 42 | raise RuntimeError(msg) | ||
| 43 | 28 | ||
| 44 | def test_signatures(self): | 29 | def test_signatures(self): |
| 45 | if self.tc.layer['type'] == LayerType.SOFTWARE: | 30 | if self.tc.layer['type'] == LayerType.SOFTWARE: |
