]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa: setup bitbake logger after tinfoil.shutdown
authorEd Bartosh <ed.bartosh@linux.intel.com>
Wed, 10 Feb 2016 08:09:37 +0000 (10:09 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 10 Feb 2016 15:50:53 +0000 (15:50 +0000)
Bitbake logger stops working after tinfoil.shutdown removes console
handler from it. This makes bb.{error,warn,note,critical} messages
disappear from the console. Adding console handler to bitbake logger
again should fix this issue.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/utils/commands.py

index 08e2cbb906c7e68eb697bcceb26c2f61e842f920..dfb6c215bbf5bd36d1559edd76b0243293a18129 100644 (file)
@@ -18,6 +18,7 @@ from oeqa.utils import CommandError
 from oeqa.utils import ftools
 import re
 import contextlib
+import bb
 
 class Command(object):
     def __init__(self, command, bg=False, timeout=None, data=None, **options):
@@ -208,6 +209,16 @@ 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: