Add buildroot to regression test

This commit is contained in:
Jarred Allen 2021-04-22 13:29:55 -04:00
parent 805ac5dbd7
commit 8baa2a350d

View File

@ -8,8 +8,35 @@
# #
################################## ##################################
# edit this line to add more configurations from collections import namedtuple
confignames = ["rv32ic", "rv64ic", "busybear"] # name: the name of this test configuration/script
# cmd: the command to run to test (should include the logfile as {})
# grepstr: the string to grep through the log file for, success iff grep finds that string
Config = namedtuple("Config", ['name', 'cmd', 'grepstr'])
# edit this list to add more configurations
configs = [
Config(
name="busybear",
cmd="vsim -do wally-busybear-batch.do -c > {}",
grepstr="# loaded 800000 instructions"
),
Config(
name="buildroot",
cmd="vsim -do wally-buildroot-batch.do -c > {}",
grepstr="# loaded 100000 instructions"
),
Config(
name="rv32ic",
cmd="vsim > {} -c <<!\ndo wally-pipelined-batch.do ../config/rv32ic rv32ic\n!",
grepstr="All tests ran without failures"
),
Config(
name="rv64ic",
cmd="vsim > {} -c <<!\ndo wally-pipelined-batch.do ../config/rv64ic rv64ic\n!",
grepstr="All tests ran without failures"
),
]
import multiprocessing, os import multiprocessing, os
@ -22,20 +49,12 @@ def search_log_for_text(text, logfile):
def test_config(config, print_res=True): def test_config(config, print_res=True):
"""Run the given config, and return 0 if it suceeds and 1 if it fails""" """Run the given config, and return 0 if it suceeds and 1 if it fails"""
logname = "wally_"+config+".log" logname = "wally_"+config.name+".log"
if config == "busybear": cmd = config.cmd.format(logname)
# Handle busybear separately
cmd = "vsim -do wally-busybear-batch.do -c >" + logname
os.system(cmd)
# check for success. grep returns 0 if found, 1 if not found
passed = search_log_for_text("# loaded 800000 instructions", logname)
else:
# Any other configuration loads that name from the config folder and runs vsim
cmd = "vsim -c >" + logname +" <<!\ndo wally-pipelined-batch.do ../config/" + config + " " + config + "\n!\n"
print(cmd) print(cmd)
os.system(cmd) os.system(cmd)
# check for success. grep returns 0 if found, 1 if not found # check for success. grep returns 0 if found, 1 if not found
passed = search_log_for_text("All tests ran without failures", logname) passed = search_log_for_text(config.grepstr, logname)
if passed: if passed:
if print_res:print(logname+": Success") if print_res:print(logname+": Success")
return 0 return 0
@ -44,12 +63,12 @@ def test_config(config, print_res=True):
return 1 return 1
# Run the tests and count the failures # Run the tests and count the failures
pool = multiprocessing.Pool(min(len(confignames), 12)) pool = multiprocessing.Pool(min(len(configs), 12))
fail = sum(pool.map(test_config, confignames)) fail = sum(pool.map(test_config, configs))
if (fail): if (fail):
print ("Regression failed with " +str(fail)+ " failed configurations") print("Regression failed with " +str(fail)+ " failed configurations")
exit(1) exit(1)
else: else:
print ("SUCCESS! All tests ran without failures") print("SUCCESS! All tests ran without failures")
exit(0) exit(0)