Less hacky implementation of the same method as before

This commit is contained in:
slmnemo 2024-04-17 10:26:30 -07:00
parent 48a2028891
commit b5ef66dc3c

View File

@ -23,7 +23,7 @@ from multiprocessing import Pool, TimeoutError
# The element consists of the configuration name, a list of test suites to run,
# optionally a string to pass to the simulator, and optionally a nonstandard grep string to check for success
INSTR_LIMIT = 4000000 # multiple of 100000; Set to 0 to run simulation until timeout or Wally Hostname:
INSTR_LIMIT = 400000 # multiple of 100000; Set to 0 to run simulation until timeout or Wally Hostname:
tests = [
["rv32e", ["arch32e"]],
["rv32i", ["arch32i"]],
@ -39,7 +39,10 @@ tests = [
# Separate test for full buildroot run
tests_buildroot = [["buildroot", ["buildroot"], [f"+INSTR_LIMIT=600000000"], "WallyHostName login:", os.environ.get('WALLY')+"/sim/questa/logs/buildroot_uart.out"]]
tests_buildrootboot = [
["buildroot", ["buildroot"], [f"+INSTR_LIMIT=600000000"],
"WallyHostname login: ", os.environ.get('WALLY')+"/sim/questa/logs/buildroot_uart.out"]
]
# Separate out floating-point tests for RV64 to speed up coverage
@ -180,7 +183,7 @@ bpredtests = [
# Data Types & Functions
##################################
TestCase = namedtuple("TestCase", ['name', 'variant', 'cmd', 'grepstr', 'logfile', 'overwrite'])
TestCase = namedtuple("TestCase", ['name', 'variant', 'cmd', 'grepstr', 'logfile'])
# name: the name of this test configuration (used in printing human-readable
# output and picking logfile names)
# cmd: the command to run to test (should include the logfile as '{}', and
@ -188,7 +191,7 @@ TestCase = namedtuple("TestCase", ['name', 'variant', 'cmd', 'grepstr', 'logfile
# grepstr: the string to grep through the log file for. The test succeeds iff
# grep finds that string in the logfile (is used by grep, so it may
# be any pattern grep accepts, see `man 1 grep` for more info).
# logfile: the string corresponding to the log file for the test. autogenerated
# logfile: a string containing the location of the logfile.
class bcolors:
HEADER = '\033[95m'
@ -202,6 +205,7 @@ class bcolors:
UNDERLINE = '\033[4m'
def addTests(tests, sim):
sim_logdir = WALLY+ "/sim/" + sim + "/logs/"
for test in tests:
config = test[0];
suites = test[1];
@ -213,21 +217,19 @@ def addTests(tests, sim):
gs = test[3]
else:
gs = "All tests ran without failures"
cmdPrefix="wsim --sim " + sim + " " + config
cmdPrefix="wsim --sim " + sim + " " + config
for t in suites:
sim_log = sim_logdir + config + "_" + t + ".log"
if (len(test) >= 5):
logfile = test[4]
overwrite = 0
else:
logfile = WALLY + "/sim/"+sim+"/logs/"+config+"_"+t+".log"
overwrite = 1
logfile = sim_log
tc = TestCase(
name=t,
variant=config,
cmd=cmdPrefix + " " + t + args,
cmd=cmdPrefix + " " + t + args + " > " + sim_log,
grepstr=gs,
logfile = logfile,
overwrite = overwrite)
logfile = logfile)
configs.append(tc)
def search_log_for_text(text, logfile):
@ -239,14 +241,7 @@ def search_log_for_text(text, logfile):
def run_test_case(config):
"""Run the given test case, and return 0 if the test suceeds and 1 if it fails"""
logname = config.logfile
WALLY = os.environ.get('WALLY')
#cmd = config.cmd + " > " + logname
if ("lint-wally" in config.cmd):
cmd = config.cmd + " | tee " + logname
elif (config.overwrite == 0): ### TODO: Fix hardcoding for logs/buildroot_buildroot.log
cmd = config.cmd + f" > {WALLY}/sim/questa/logs/buildroot_buildroot.log"
else:
cmd = config.cmd + " > " + logname
cmd = config.cmd
os.chdir(regressionDir)
# print(" run_test_case invoking %s" % cmd)
os.system(cmd)
@ -294,16 +289,14 @@ configs = [
TestCase(
name="lints",
variant="all",
cmd="lint-wally " + nightMode,
cmd="lint-wally " + nightMode + " | tee " + WALLY + "/sim/questa/logs/all_lints.log",
grepstr="lints run with no errors or warnings",
logfile = WALLY + "/sim/questa/logs/all_lints.log",
overwrite = 1
)
logfile = WALLY + "/sim/questa/logs/all_lints.log")
]
if (buildroot):
for sim in sims:
addTests(tests_buildroot, sim)
addTests(tests_buildrootboot, sim)
if (coverage): # only run RV64GC tests on Questa in coverage mode
addTests(tests64gc_nofp, "questa")
@ -328,13 +321,13 @@ if (testfloat):
if ("f_" in config):
tests.remove("cvtfp")
for test in tests:
sim_log = WALLY + "/sim/questa/logs/"+config+"_"+test+".log"
tc = TestCase(
name=test,
variant=config,
cmd="wsim --tb testbench_fp " + config + " " + test,
cmd="wsim --tb testbench_fp " + config + " " + test + " > " + sim_log,
grepstr="All Tests completed with 0 errors",
logfile = WALLY + "/sim/questa/logs/"+config+"_"+test+".log",
overwrite = 1)
logfile = sim_log)
configs.append(tc)