summaryrefslogtreecommitdiff
path: root/src/python/m5/util/terminal.py
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2012-04-14 05:44:27 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2012-04-14 05:44:27 -0400
commitb9bc530ad20bceeed6e43ea459d271046f43e70c (patch)
tree8ff4ae20d6d05f4ca7267b0f5339e56c2b5e92a7 /src/python/m5/util/terminal.py
parentb6aa6d55eb856f99a06c400b5dcda118c46dacfa (diff)
downloadgem5-b9bc530ad20bceeed6e43ea459d271046f43e70c.tar.xz
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.
Diffstat (limited to 'src/python/m5/util/terminal.py')
-rw-r--r--src/python/m5/util/terminal.py9
1 files changed, 9 insertions, 0 deletions
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)