mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Less hacky implementation of the same method as before
This commit is contained in:
parent
48a2028891
commit
b5ef66dc3c
@ -23,7 +23,7 @@ from multiprocessing import Pool, TimeoutError
|
|||||||
# The element consists of the configuration name, a list of test suites to run,
|
# 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
|
# 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 = [
|
tests = [
|
||||||
["rv32e", ["arch32e"]],
|
["rv32e", ["arch32e"]],
|
||||||
["rv32i", ["arch32i"]],
|
["rv32i", ["arch32i"]],
|
||||||
@ -39,7 +39,10 @@ tests = [
|
|||||||
|
|
||||||
|
|
||||||
# Separate test for full buildroot run
|
# 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
|
# Separate out floating-point tests for RV64 to speed up coverage
|
||||||
@ -180,7 +183,7 @@ bpredtests = [
|
|||||||
# Data Types & Functions
|
# 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
|
# name: the name of this test configuration (used in printing human-readable
|
||||||
# output and picking logfile names)
|
# output and picking logfile names)
|
||||||
# cmd: the command to run to test (should include the logfile as '{}', and
|
# 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
|
# 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
|
# 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).
|
# 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:
|
class bcolors:
|
||||||
HEADER = '\033[95m'
|
HEADER = '\033[95m'
|
||||||
@ -202,6 +205,7 @@ class bcolors:
|
|||||||
UNDERLINE = '\033[4m'
|
UNDERLINE = '\033[4m'
|
||||||
|
|
||||||
def addTests(tests, sim):
|
def addTests(tests, sim):
|
||||||
|
sim_logdir = WALLY+ "/sim/" + sim + "/logs/"
|
||||||
for test in tests:
|
for test in tests:
|
||||||
config = test[0];
|
config = test[0];
|
||||||
suites = test[1];
|
suites = test[1];
|
||||||
@ -213,21 +217,19 @@ def addTests(tests, sim):
|
|||||||
gs = test[3]
|
gs = test[3]
|
||||||
else:
|
else:
|
||||||
gs = "All tests ran without failures"
|
gs = "All tests ran without failures"
|
||||||
cmdPrefix="wsim --sim " + sim + " " + config
|
cmdPrefix="wsim --sim " + sim + " " + config
|
||||||
for t in suites:
|
for t in suites:
|
||||||
|
sim_log = sim_logdir + config + "_" + t + ".log"
|
||||||
if (len(test) >= 5):
|
if (len(test) >= 5):
|
||||||
logfile = test[4]
|
logfile = test[4]
|
||||||
overwrite = 0
|
|
||||||
else:
|
else:
|
||||||
logfile = WALLY + "/sim/"+sim+"/logs/"+config+"_"+t+".log"
|
logfile = sim_log
|
||||||
overwrite = 1
|
|
||||||
tc = TestCase(
|
tc = TestCase(
|
||||||
name=t,
|
name=t,
|
||||||
variant=config,
|
variant=config,
|
||||||
cmd=cmdPrefix + " " + t + args,
|
cmd=cmdPrefix + " " + t + args + " > " + sim_log,
|
||||||
grepstr=gs,
|
grepstr=gs,
|
||||||
logfile = logfile,
|
logfile = logfile)
|
||||||
overwrite = overwrite)
|
|
||||||
configs.append(tc)
|
configs.append(tc)
|
||||||
|
|
||||||
def search_log_for_text(text, logfile):
|
def search_log_for_text(text, logfile):
|
||||||
@ -239,14 +241,7 @@ def search_log_for_text(text, logfile):
|
|||||||
def run_test_case(config):
|
def run_test_case(config):
|
||||||
"""Run the given test case, and return 0 if the test suceeds and 1 if it fails"""
|
"""Run the given test case, and return 0 if the test suceeds and 1 if it fails"""
|
||||||
logname = config.logfile
|
logname = config.logfile
|
||||||
WALLY = os.environ.get('WALLY')
|
cmd = config.cmd
|
||||||
#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
|
|
||||||
os.chdir(regressionDir)
|
os.chdir(regressionDir)
|
||||||
# print(" run_test_case invoking %s" % cmd)
|
# print(" run_test_case invoking %s" % cmd)
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
@ -294,16 +289,14 @@ configs = [
|
|||||||
TestCase(
|
TestCase(
|
||||||
name="lints",
|
name="lints",
|
||||||
variant="all",
|
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",
|
grepstr="lints run with no errors or warnings",
|
||||||
logfile = WALLY + "/sim/questa/logs/all_lints.log",
|
logfile = WALLY + "/sim/questa/logs/all_lints.log")
|
||||||
overwrite = 1
|
|
||||||
)
|
|
||||||
]
|
]
|
||||||
|
|
||||||
if (buildroot):
|
if (buildroot):
|
||||||
for sim in sims:
|
for sim in sims:
|
||||||
addTests(tests_buildroot, sim)
|
addTests(tests_buildrootboot, sim)
|
||||||
|
|
||||||
if (coverage): # only run RV64GC tests on Questa in coverage mode
|
if (coverage): # only run RV64GC tests on Questa in coverage mode
|
||||||
addTests(tests64gc_nofp, "questa")
|
addTests(tests64gc_nofp, "questa")
|
||||||
@ -328,13 +321,13 @@ if (testfloat):
|
|||||||
if ("f_" in config):
|
if ("f_" in config):
|
||||||
tests.remove("cvtfp")
|
tests.remove("cvtfp")
|
||||||
for test in tests:
|
for test in tests:
|
||||||
|
sim_log = WALLY + "/sim/questa/logs/"+config+"_"+test+".log"
|
||||||
tc = TestCase(
|
tc = TestCase(
|
||||||
name=test,
|
name=test,
|
||||||
variant=config,
|
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",
|
grepstr="All Tests completed with 0 errors",
|
||||||
logfile = WALLY + "/sim/questa/logs/"+config+"_"+test+".log",
|
logfile = sim_log)
|
||||||
overwrite = 1)
|
|
||||||
configs.append(tc)
|
configs.append(tc)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user