mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Added --buildroot option to run a full Linux boot and search 'buildroot_uart.out' for login prompt
This commit is contained in:
parent
554f818a8c
commit
48a2028891
@ -12,7 +12,6 @@
|
||||
##################################
|
||||
import sys,os,shutil
|
||||
import multiprocessing
|
||||
#import os
|
||||
from collections import namedtuple
|
||||
from multiprocessing import Pool, TimeoutError
|
||||
|
||||
@ -24,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 = 1000000 # multiple of 100000; 4M is interesting because it gets into the kernel and enabling VM
|
||||
INSTR_LIMIT = 4000000 # multiple of 100000; Set to 0 to run simulation until timeout or Wally Hostname:
|
||||
tests = [
|
||||
["rv32e", ["arch32e"]],
|
||||
["rv32i", ["arch32i"]],
|
||||
@ -38,6 +37,11 @@ tests = [
|
||||
["buildroot", ["buildroot"], [f"+INSTR_LIMIT={INSTR_LIMIT}"], str(INSTR_LIMIT)+" instructions"]
|
||||
]
|
||||
|
||||
|
||||
# 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"]]
|
||||
|
||||
|
||||
# Separate out floating-point tests for RV64 to speed up coverage
|
||||
tests64gc_nofp = [
|
||||
["rv64gc", ["coverage64gc", "arch64i", "arch64priv", "arch64c", "arch64m",
|
||||
@ -176,7 +180,7 @@ bpredtests = [
|
||||
# Data Types & Functions
|
||||
##################################
|
||||
|
||||
TestCase = namedtuple("TestCase", ['name', 'variant', 'cmd', 'grepstr'])
|
||||
TestCase = namedtuple("TestCase", ['name', 'variant', 'cmd', 'grepstr', 'logfile', 'overwrite'])
|
||||
# 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
|
||||
@ -184,6 +188,7 @@ TestCase = namedtuple("TestCase", ['name', 'variant', 'cmd', 'grepstr'])
|
||||
# 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
|
||||
|
||||
class bcolors:
|
||||
HEADER = '\033[95m'
|
||||
@ -210,11 +215,19 @@ def addTests(tests, sim):
|
||||
gs = "All tests ran without failures"
|
||||
cmdPrefix="wsim --sim " + sim + " " + config
|
||||
for t in suites:
|
||||
if (len(test) >= 5):
|
||||
logfile = test[4]
|
||||
overwrite = 0
|
||||
else:
|
||||
logfile = WALLY + "/sim/"+sim+"/logs/"+config+"_"+t+".log"
|
||||
overwrite = 1
|
||||
tc = TestCase(
|
||||
name=t,
|
||||
variant=config,
|
||||
cmd=cmdPrefix + " " + t + args,
|
||||
grepstr=gs)
|
||||
grepstr=gs,
|
||||
logfile = logfile,
|
||||
overwrite = overwrite)
|
||||
configs.append(tc)
|
||||
|
||||
def search_log_for_text(text, logfile):
|
||||
@ -225,14 +238,17 @@ 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 = WALLY + "/sim/questa/logs/"+config.variant+"_"+config.name+".log" ### *** fix hardwiring to questa log
|
||||
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
|
||||
os.chdir(regressionDir)
|
||||
# print(" run_test_case invoking %s" % cmd)
|
||||
# print(" run_test_case invoking %s" % cmd)
|
||||
os.system(cmd)
|
||||
if search_log_for_text(config.grepstr, logname):
|
||||
print(f"{bcolors.OKGREEN}%s_%s: Success{bcolors.ENDC}" % (config.variant, config.name))
|
||||
@ -258,6 +274,7 @@ coverage = '--coverage' in sys.argv
|
||||
fp = '--fp' in sys.argv
|
||||
nightly = '--nightly' in sys.argv
|
||||
testfloat = '--testfloat' in sys.argv
|
||||
buildroot = '--buildroot' in sys.argv
|
||||
|
||||
if (nightly):
|
||||
nightMode = "--nightly";
|
||||
@ -278,15 +295,21 @@ configs = [
|
||||
name="lints",
|
||||
variant="all",
|
||||
cmd="lint-wally " + nightMode,
|
||||
grepstr="lints run with no errors or warnings"
|
||||
grepstr="lints run with no errors or warnings",
|
||||
logfile = WALLY + "/sim/questa/logs/all_lints.log",
|
||||
overwrite = 1
|
||||
)
|
||||
]
|
||||
|
||||
if (buildroot):
|
||||
for sim in sims:
|
||||
addTests(tests_buildroot, sim)
|
||||
|
||||
if (coverage): # only run RV64GC tests on Questa in coverage mode
|
||||
addTests(tests64gc_nofp, "questa")
|
||||
if (fp):
|
||||
addTests(tests64gc_fp, "questa")
|
||||
else:
|
||||
elif not buildroot:
|
||||
for sim in sims:
|
||||
addTests(tests, sim)
|
||||
addTests(tests64gc_nofp, sim)
|
||||
@ -309,7 +332,9 @@ if (testfloat):
|
||||
name=test,
|
||||
variant=config,
|
||||
cmd="wsim --tb testbench_fp " + config + " " + test,
|
||||
grepstr="All Tests completed with 0 errors")
|
||||
grepstr="All Tests completed with 0 errors",
|
||||
logfile = WALLY + "/sim/questa/logs/"+config+"_"+test+".log",
|
||||
overwrite = 1)
|
||||
configs.append(tc)
|
||||
|
||||
|
||||
@ -352,7 +377,9 @@ if (testfloat):
|
||||
name=test,
|
||||
variant=config,
|
||||
cmd="wsim --tb testbench_fp --sim questa " + config + " " + test,
|
||||
grepstr="All Tests completed with 0 errors")
|
||||
grepstr="All Tests completed with 0 errors",
|
||||
logfile = WALLY + "/sim/questa/logs/"+config+"_"+test+".log",
|
||||
overwrite = 1)
|
||||
configs.append(tc)
|
||||
|
||||
|
||||
@ -374,7 +401,7 @@ def main():
|
||||
TIMEOUT_DUR = 30*7200 # seconds
|
||||
#configs.append(getBuildrootTC(boot=True))
|
||||
elif '--buildroot' in sys.argv:
|
||||
TIMEOUT_DUR = 30*7200 # seconds
|
||||
TIMEOUT_DUR = 60*7200 # 5 days to run
|
||||
#configs=[getBuildrootTC(boot=True)]
|
||||
elif '--coverage' in sys.argv:
|
||||
TIMEOUT_DUR = 20*60 # seconds
|
||||
|
Loading…
Reference in New Issue
Block a user