mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Added colors to regression script to make it easy to pick out success from fail.
This commit is contained in:
parent
cc5a9a015b
commit
3ebcd35a8c
@ -12,6 +12,17 @@
|
|||||||
##################################
|
##################################
|
||||||
import sys,os
|
import sys,os
|
||||||
|
|
||||||
|
class bcolors:
|
||||||
|
HEADER = '\033[95m'
|
||||||
|
OKBLUE = '\033[94m'
|
||||||
|
OKCYAN = '\033[96m'
|
||||||
|
OKGREEN = '\033[92m'
|
||||||
|
WARNING = '\033[93m'
|
||||||
|
FAIL = '\033[91m'
|
||||||
|
ENDC = '\033[0m'
|
||||||
|
BOLD = '\033[1m'
|
||||||
|
UNDERLINE = '\033[4m'
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
regressionDir = os.path.dirname(os.path.abspath(__file__))
|
regressionDir = os.path.dirname(os.path.abspath(__file__))
|
||||||
os.chdir(regressionDir)
|
os.chdir(regressionDir)
|
||||||
@ -103,10 +114,10 @@ def run_test_case(config):
|
|||||||
os.chdir(regressionDir)
|
os.chdir(regressionDir)
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
if search_log_for_text(config.grepstr, logname):
|
if search_log_for_text(config.grepstr, logname):
|
||||||
print("%s_%s: Success" % (config.variant, config.name))
|
print(f"{bcolors.OKGREEN}%s_%s: Success{bcolors.ENDC}" % (config.variant, config.name))
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
print("%s_%s: Failures detected in output" % (config.variant, config.name))
|
print(f"{bcolors.FAIL}%s_%s: Failures detected in output{bcolors.ENDC}" % (config.variant, config.name))
|
||||||
print(" Check %s" % logname)
|
print(" Check %s" % logname)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
@ -145,16 +156,16 @@ def main():
|
|||||||
num_fail+=result.get(timeout=TIMEOUT_DUR)
|
num_fail+=result.get(timeout=TIMEOUT_DUR)
|
||||||
except TimeoutError:
|
except TimeoutError:
|
||||||
num_fail+=1
|
num_fail+=1
|
||||||
print("%s_%s: Timeout - runtime exceeded %d seconds" % (config.variant, config.name, TIMEOUT_DUR))
|
print(f"{bcolors.FAIL}%s_%s: Timeout - runtime exceeded %d seconds{bcolors.ENDC}" % (config.variant, config.name, TIMEOUT_DUR))
|
||||||
|
|
||||||
# Count the number of failures
|
# Count the number of failures
|
||||||
if num_fail:
|
if num_fail:
|
||||||
print("Regression failed with %s failed configurations" % num_fail)
|
print(f"{bcolors.FAIL}Regression failed with %s failed configurations{bcolors.ENDC}" % num_fail)
|
||||||
# Remind the user to try `make allclean`, since it may be needed if test
|
# Remind the user to try `make allclean`, since it may be needed if test
|
||||||
# cases have changed
|
# cases have changed
|
||||||
print("Reminder: have you run `make allclean`?")
|
print("Reminder: have you run `make allclean`?")
|
||||||
else:
|
else:
|
||||||
print("SUCCESS! All tests ran without failures")
|
print(f"{bcolors.OKGREEN}SUCCESS! All tests ran without failures{bcolors.ENDC}")
|
||||||
return num_fail
|
return num_fail
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user