compare_results.py: use ansi colors

Change-Id: I2cfabc1364c53e6ee18b9471dcd7c681407d0473
This commit is contained in:
Neels Hofmeyr 2020-05-14 22:51:30 +02:00 committed by laforge
parent 6a99bf175c
commit b05d16fe8e
1 changed files with 16 additions and 7 deletions

View File

@ -22,13 +22,22 @@ re_testcase = re.compile(r'''<testcase classname=['"]([^'"]+)['"].* name=['"]([^
re_testcase_end = re.compile(r'''(</testcase>|<testcase [^>]*/>)''') re_testcase_end = re.compile(r'''(</testcase>|<testcase [^>]*/>)''')
re_failure = re.compile(r'''(<failure\b|<error\b)''') re_failure = re.compile(r'''(<failure\b|<error\b)''')
RESULT_PASS = 'pass' RED = "\033[1;31m"
RESULT_FAIL = 'pass->FAIL' GREEN = "\033[1;32m"
RESULT_SKIP = 'skip' YELLOW = "\033[1;33m"
RESULT_XFAIL = 'xfail' BLUE = "\033[1;34m"
RESULT_FIXED = 'xfail->PASS' NOCOLOR = "\033[0;m"
RESULT_NEW_PASS = 'NEW: PASS'
RESULT_NEW_FAIL = 'NEW: FAIL' def col(color, text):
return color + text + NOCOLOR
RESULT_PASS = col(GREEN, 'pass')
RESULT_FAIL = col(RED, 'pass->FAIL')
RESULT_SKIP = col(BLUE, 'skip')
RESULT_XFAIL = col(YELLOW, 'xfail')
RESULT_FIXED = col(GREEN, 'xfail->PASS')
RESULT_NEW_PASS = col(GREEN, 'NEW: PASS')
RESULT_NEW_FAIL = col(RED, 'NEW: FAIL')
RESULTS = ( RESULTS = (
RESULT_FAIL, RESULT_FAIL,