[oe-commits] [bitbake] 04/09: bitbake-selftest: enable bitbake logging to stdout
git at git.openembedded.org
git at git.openembedded.org
Fri Aug 19 15:51:56 UTC 2016
rpurdie pushed a commit to branch master-next
in repository bitbake.
commit ea19972a16f7639f944823d1d8a7728105460136
Author: Markus Lehtonen <markus.lehtonen at linux.intel.com>
AuthorDate: Thu Aug 18 19:55:54 2016 +0300
bitbake-selftest: enable bitbake logging to stdout
Now you get the bb logger output for failed tests. This helps debugging
problems. Also, all stdout/stderr data for successful tests is silenced
which makes for less cluttered console output.
Signed-off-by: Markus Lehtonen <markus.lehtonen at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
bin/bitbake-selftest | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/bin/bitbake-selftest b/bin/bitbake-selftest
index 1e00e33..380e003 100755
--- a/bin/bitbake-selftest
+++ b/bin/bitbake-selftest
@@ -37,6 +37,24 @@ for t in tests:
__import__(t)
+# Set-up logging
+class StdoutStreamHandler(logging.StreamHandler):
+ """Special handler so that unittest is able to capture stdout"""
+ def __init__(self):
+ # Override __init__() because we don't want to set self.stream here
+ logging.Handler.__init__(self)
+
+ @property
+ def stream(self):
+ # We want to dynamically write wherever sys.stdout is pointing to
+ return sys.stdout
+
+
+handler = StdoutStreamHandler()
+bb.logger.addHandler(handler)
+bb.logger.setLevel(logging.DEBUG)
+
+
ENV_HELP = """\
Environment variables:
BB_SKIP_NETTESTS set to 'yes' in order to skip tests using network
@@ -51,4 +69,4 @@ class main(unittest.main):
if __name__ == '__main__':
- main(defaultTest=tests)
+ main(defaultTest=tests, buffer=True)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list