summaryrefslogtreecommitdiff
path: root/yocto-poky/meta/lib/oeqa/utils/commands.py
diff options
context:
space:
mode:
Diffstat (limited to 'yocto-poky/meta/lib/oeqa/utils/commands.py')
-rw-r--r--yocto-poky/meta/lib/oeqa/utils/commands.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/yocto-poky/meta/lib/oeqa/utils/commands.py b/yocto-poky/meta/lib/oeqa/utils/commands.py
index 08e2cbb90..48f644129 100644
--- a/yocto-poky/meta/lib/oeqa/utils/commands.py
+++ b/yocto-poky/meta/lib/oeqa/utils/commands.py
@@ -18,6 +18,11 @@ from oeqa.utils import CommandError
from oeqa.utils import ftools
import re
import contextlib
+# Export test doesn't require bb
+try:
+ import bb
+except ImportError:
+ pass
class Command(object):
def __init__(self, command, bg=False, timeout=None, data=None, **options):
@@ -177,7 +182,7 @@ def create_temp_layer(templayerdir, templayername, priority=999, recipepathspec=
@contextlib.contextmanager
-def runqemu(pn, test):
+def runqemu(pn, ssh=True):
import bb.tinfoil
import bb.build
@@ -208,10 +213,20 @@ def runqemu(pn, test):
# Luckily QemuTarget doesn't need it after the constructor.
tinfoil.shutdown()
+ # Setup bitbake logger as console handler is removed by tinfoil.shutdown
+ bblogger = logging.getLogger('BitBake')
+ bblogger.setLevel(logging.INFO)
+ console = logging.StreamHandler(sys.stdout)
+ bbformat = bb.msg.BBLogFormatter("%(levelname)s: %(message)s")
+ if sys.stdout.isatty():
+ bbformat.enable_color()
+ console.setFormatter(bbformat)
+ bblogger.addHandler(console)
+
try:
qemu.deploy()
try:
- qemu.start()
+ qemu.start(ssh=ssh)
except bb.build.FuncFailed:
raise Exception('Failed to start QEMU - see the logs in %s' % logdir)