aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils/commands.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-11-08 18:17:17 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-03-03 08:32:14 +0000
commit22003f97ff7f53c32999dc466d26c1471ead9b6b (patch)
tree89c497a9e82846f869b22410995c6a65490ff063 /meta/lib/oeqa/utils/commands.py
parent31b8991de32ce91af58eab183f283adcded737c2 (diff)
downloadopenembedded-core-22003f97ff7f53c32999dc466d26c1471ead9b6b.tar.gz
oeqa: Clean up logger handling
The logger handling in oeqa was confused at best. This patch: a) Passes in a logger through various qemu runner pieces b) Uses that logger consistently in the code c) Creates a logger for QemuRunner outside the bitbake namespace meaning we don't conflict with the tinfoil logging changes The result of this is more consistency. For runtime tests in testimage, the logs always contain the debug info, nothing is shwon on the console. For the oe-selftests, logs are intercepted and only shown if the test fails. (From OE-Core rev: ba8babc45141891d0624f9a181a580fa416e87ec) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster@mvista.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta/lib/oeqa/utils/commands.py')
-rw-r--r--meta/lib/oeqa/utils/commands.py25
1 files changed, 8 insertions, 17 deletions
diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 57286fcb10..ed925a4d92 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -233,6 +233,12 @@ def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None,
import bb.tinfoil
import bb.build
+ # Need a non-'BitBake' logger to capture the runner output
+ targetlogger = logging.getLogger('TargetRunner')
+ targetlogger.setLevel(logging.DEBUG)
+ handler = logging.StreamHandler(sys.stdout)
+ targetlogger.addHandler(handler)
+
tinfoil = bb.tinfoil.Tinfoil()
tinfoil.prepare(config_only=False, quiet=True)
try:
@@ -250,31 +256,15 @@ def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None,
for key, value in overrides.items():
recipedata.setVar(key, value)
- # The QemuRunner log is saved out, but we need to ensure it is at the right
- # log level (and then ensure that since it's a child of the BitBake logger,
- # we disable propagation so we don't then see the log events on the console)
- logger = logging.getLogger('BitBake.QemuRunner')
- logger.setLevel(logging.DEBUG)
- logger.propagate = False
logdir = recipedata.getVar("TEST_LOG_DIR")
- qemu = oeqa.targetcontrol.QemuTarget(recipedata, image_fstype)
+ qemu = oeqa.targetcontrol.QemuTarget(recipedata, targetlogger, image_fstype)
finally:
# We need to shut down tinfoil early here in case we actually want
# to run tinfoil-using utilities with the running QEMU instance.
# 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:
@@ -289,6 +279,7 @@ def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None,
qemu.stop()
except:
pass
+ targetlogger.removeHandler(handler)
def updateEnv(env_file):
"""