Colorize terminal output of mesontest. Closes #1593.

pull/1528/merge
Jussi Pakkanen 8 years ago
parent 4c6f99a31a
commit 27e2c23efc
  1. 10
      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,6 +284,15 @@ 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':
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) \

Loading…
Cancel
Save