diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2017-04-09 23:13:38 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-04-10 01:06:03 +0300 |
commit | 27e2c23efc3b3205f97ce44686341f28382b7d72 (patch) | |
tree | 024b36acbb3bf6a9e14dd4ae1b4bcc71c42dfa9c /mesontest.py | |
parent | 4c6f99a31adef341a5d71af28ce26452e4a5f182 (diff) | |
download | meson-27e2c23efc3b3205f97ce44686341f28382b7d72.zip meson-27e2c23efc3b3205f97ce44686341f28382b7d72.tar.gz meson-27e2c23efc3b3205f97ce44686341f28382b7d72.tar.bz2 |
Colorize terminal output of mesontest. Closes #1593.
Diffstat (limited to 'mesontest.py')
-rwxr-xr-x | mesontest.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/mesontest.py b/mesontest.py index 38fd73b..b59d1ed 100755 --- a/mesontest.py +++ b/mesontest.py @@ -22,6 +22,7 @@ import pickle from mesonbuild import build from mesonbuild import environment from mesonbuild.dependencies import ExternalProgram +from mesonbuild import mlog import time, datetime, multiprocessing, json import concurrent.futures as conc @@ -283,7 +284,16 @@ class TestHarness: result_str = '%s %s %s%s%s%5.2f s' % \ (num, name, padding1, result.res, padding2, result.duration) if not self.options.quiet or result.res != 'OK': - print(result_str) + if result.res != 'OK' and mlog.colorize_console: + if result.res == 'FAIL' or result.res == 'TIMEOUT': + decorator = mlog.red + elif result.res == 'SKIP': + decorator = mlog.yellow + else: + sys.exit('Unreachable code was ... well ... reached.') + print(decorator(result_str).get_text(True)) + else: + print(result_str) result_str += "\n\n" + result.get_log() if (result.returncode != GNU_SKIP_RETURNCODE) \ and (result.returncode != 0) != result.should_fail: |