summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Shubham Ajmera <shubhamajmera@google.com> 2017-03-22 18:33:37 -0700
committer Shubham Ajmera <shubhamajmera@google.com> 2017-03-23 22:55:32 +0000
commit22499e227306852854e19dad3f4bcbc05acbfcdf (patch)
tree1fbc2ff812b3f305f84808fd8c57d84959bc44ea
parentf633fb0f1b959410dbb7ce114e203aba1cfa4059 (diff)
Testrunner: Print colored text only when printing on terminal
Test: ./art/test/testrunner/testrunner.py Change-Id: Ica9701d6acd459d47fb63a722234fa17b141c33f
-rwxr-xr-xtest/testrunner/testrunner.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/testrunner/testrunner.py b/test/testrunner/testrunner.py
index 0b9a6e6457..e6376ef888 100755
--- a/test/testrunner/testrunner.py
+++ b/test/testrunner/testrunner.py
@@ -260,6 +260,16 @@ def setup_test_env():
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 @@ def parse_option():
if options['gdb_arg']:
gdb_arg = options['gdb_arg']
timeout = options['timeout']
+
return test
def main():