cvw/wally-pipelined/regression/regression-wally.py

54 lines
1.7 KiB
Python
Raw Normal View History

2021-01-25 16:28:43 +00:00
#!/usr/bin/python3
##################################
#
# regression-wally.py
# David_Harris@Hmc.edu 25 January 2021
#
# Run a regression with multiple configurations and report any errors.
#
##################################
# edit this line to add more configurations
confignames = ["rv32ic", "rv64ic", "busybear"]
2021-01-25 16:28:43 +00:00
2021-02-01 20:40:27 +00:00
import multiprocessing, os
2021-01-25 16:28:43 +00:00
fail = 0
2021-02-02 22:20:45 +00:00
def search_log_for_text(text, logfile):
"""Search through the given log file for text, returning True if it is found or False if it is not"""
grepcmd = "grep -e '%s' '%s' > /dev/null" % (text, logfile)
return os.system(grepcmd) == 0
2021-02-01 20:40:27 +00:00
def test_config(config, print_res=True):
"""Run the given config, and return 0 if it suceeds and 1 if it fails"""
2021-01-25 16:28:43 +00:00
logname = "wally_"+config+".log"
if config == "busybear":
cmd = "echo 'quit' | vsim -do wally-busybear.do -c >" + logname
os.system(cmd)
# check for success. grep returns 0 if found, 1 if not found
2021-02-02 22:20:45 +00:00
passed = search_log_for_text("no more .* to read", logname)
2021-01-25 16:28:43 +00:00
else:
cmd = "vsim -c >" + logname +" <<!\ndo wally-pipelined-batch-parallel.do ../config/" + config + " " + config + "\n!\n"
print(cmd)
os.system(cmd)
# check for success. grep returns 0 if found, 1 if not found
2021-02-02 22:20:45 +00:00
passed = search_log_for_text("All tests ran without failures", logname)
if passed:
if print_res:print(logname+": Success")
return 0
else:
if print_res:print(logname+": failures detected")
return 1
2021-02-01 20:40:27 +00:00
pool = multiprocessing.Pool(min(len(confignames), 12))
fail = sum(pool.map(test_config, confignames))
2021-01-25 16:28:43 +00:00
if (fail):
print ("Regression failed with " +str(fail)+ " failed configurations")
2021-02-01 20:40:27 +00:00
exit(1)
2021-01-25 16:28:43 +00:00
else:
print ("SUCCESS! All tests ran without failures")
2021-02-01 20:40:27 +00:00
exit(0)