Testrunner: Print colored text only when printing on terminal
Test: ./art/test/testrunner/testrunner.py
Change-Id: Ica9701d6acd459d47fb63a722234fa17b141c33f
diff --git a/test/testrunner/testrunner.py b/test/testrunner/testrunner.py
index 0b9a6e6..e6376ef 100755
--- a/test/testrunner/testrunner.py
+++ b/test/testrunner/testrunner.py
@@ -260,6 +260,16 @@
global semaphore
semaphore = threading.Semaphore(n_thread)
+ if not sys.stdout.isatty():
+ global COLOR_ERROR
+ global COLOR_PASS
+ global COLOR_SKIP
+ global COLOR_NORMAL
+ COLOR_ERROR = ''
+ COLOR_PASS = ''
+ COLOR_SKIP = ''
+ COLOR_NORMAL = ''
+
def run_tests(tests):
"""Creates thread workers to run the tests.
@@ -895,6 +905,7 @@
if options['gdb_arg']:
gdb_arg = options['gdb_arg']
timeout = options['timeout']
+
return test
def main():