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-19 16:44:47 +0100 |
commit | ea19972a16f7639f944823d1d8a7728105460136 (patch) | |
tree | 63d2bacfed923c6cf80140b3d0fff840f359aee6 | |
parent | 04132b261df9def3a0cff14c93c29b26ff906e8b (diff) | |
download | bitbake-contrib-ea19972a16f7639f944823d1d8a7728105460136.tar.gz |
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@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | bin/bitbake-selftest | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/bin/bitbake-selftest b/bin/bitbake-selftest index 1e00e3327..380e00361 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) |