From b9bc530ad20bceeed6e43ea459d271046f43e70c Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Sat, 14 Apr 2012 05:44:27 -0400 Subject: Regression: Add ANSI colours to highlight test status This patch adds a very basic pretty-printing of the test status (passed or failed) to highlight failing tests even more: green for passed, and red for failed. The printing only uses ANSI it the target output is a tty and supports ANSI colours. Hence, any regression scripts that are outputting to files or sending e-mails etc should still be fine. --- src/python/m5/util/terminal.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/python/m5') diff --git a/src/python/m5/util/terminal.py b/src/python/m5/util/terminal.py index 9038c1f54..6bf85f14d 100644 --- a/src/python/m5/util/terminal.py +++ b/src/python/m5/util/terminal.py @@ -93,6 +93,15 @@ if sys.stdout.isatty(): else: tty_termcap = no_termcap +def get_termcap(use_colors = None): + if use_colors: + return termcap + elif use_colors is None: + # option unspecified; default behavior is to use colors iff isatty + return tty_termcap + else: + return no_termcap + def test_termcap(obj): for c_name in color_names: c_str = getattr(obj, c_name) -- cgit v1.2.3