diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2016-08-18 19:55:54 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-08-20 16:08:59 +0100 |
commit | 4093f0bad27828bf7a8c52e73a934790e1412435 (patch) | |
tree | e9ecf2d2c7f3518d8a36e2f782625f6e3e687d4f /bitbake | |
parent | 9cce855f472b871ef72f7a0bc053937b67097d0c (diff) | |
download | poky-4093f0bad27828bf7a8c52e73a934790e1412435.tar.gz |
bitbake: 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.
(Bitbake rev: ea19972a16f7639f944823d1d8a7728105460136)
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-x | bitbake/bin/bitbake-selftest | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/bitbake/bin/bitbake-selftest b/bitbake/bin/bitbake-selftest index 1e00e33271..380e003619 100755 --- a/bitbake/bin/bitbake-selftest +++ b/bitbake/bin/bitbake-selftest | |||
@@ -37,6 +37,24 @@ for t in tests: | |||
37 | __import__(t) | 37 | __import__(t) |
38 | 38 | ||
39 | 39 | ||
40 | # Set-up logging | ||
41 | class StdoutStreamHandler(logging.StreamHandler): | ||
42 | """Special handler so that unittest is able to capture stdout""" | ||
43 | def __init__(self): | ||
44 | # Override __init__() because we don't want to set self.stream here | ||
45 | logging.Handler.__init__(self) | ||
46 | |||
47 | @property | ||
48 | def stream(self): | ||
49 | # We want to dynamically write wherever sys.stdout is pointing to | ||
50 | return sys.stdout | ||
51 | |||
52 | |||
53 | handler = StdoutStreamHandler() | ||
54 | bb.logger.addHandler(handler) | ||
55 | bb.logger.setLevel(logging.DEBUG) | ||
56 | |||
57 | |||
40 | ENV_HELP = """\ | 58 | ENV_HELP = """\ |
41 | Environment variables: | 59 | Environment variables: |
42 | BB_SKIP_NETTESTS set to 'yes' in order to skip tests using network | 60 | BB_SKIP_NETTESTS set to 'yes' in order to skip tests using network |
@@ -51,4 +69,4 @@ class main(unittest.main): | |||
51 | 69 | ||
52 | 70 | ||
53 | if __name__ == '__main__': | 71 | if __name__ == '__main__': |
54 | main(defaultTest=tests) | 72 | main(defaultTest=tests, buffer=True) |