1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 12:29:55 +00:00

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>
This commit is contained in:
Patrick Ohly
2017-04-05 15:36:04 +02:00
committed by Richard Purdie
parent f81a532dd6
commit efd3b0ee30
2 changed files with 21 additions and 27 deletions
+5 -20
View File
@@ -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: