mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-03 02:05:21 +00:00
Refactor regression test
This commit is contained in:
parent
d2064987e9
commit
e5bd749e2a
@ -15,37 +15,31 @@ import multiprocessing, os
|
|||||||
|
|
||||||
fail = 0
|
fail = 0
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
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+".log"
|
||||||
if config == "busybear":
|
if config == "busybear":
|
||||||
cmd = "echo 'quit' | vsim -do wally-busybear.do -c >" + logname
|
cmd = "echo 'quit' | vsim -do wally-busybear.do -c >" + logname
|
||||||
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
|
||||||
cmd = "grep -e 'no more .* to read' " + logname + "> /dev/null"
|
passed = search_log_for_text("no more .* to read", logname)
|
||||||
grepval = os.system(cmd)
|
|
||||||
if (grepval):
|
|
||||||
if print_res:print(logname+": failures detected")
|
|
||||||
return 1
|
|
||||||
else:
|
|
||||||
if print_res:print(logname+": Success")
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
cmd = "vsim -c >" + logname +" <<!\ndo wally-pipelined-batch-parallel.do ../config/" + config + " " + config + "\n!\n"
|
cmd = "vsim -c >" + logname +" <<!\ndo wally-pipelined-batch-parallel.do ../config/" + config + " " + config + "\n!\n"
|
||||||
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
|
||||||
cmd = "grep 'All tests ran without failures' " + logname + "> /dev/null"
|
passed = search_log_for_text("All tests ran without failures", logname)
|
||||||
grepval = os.system(cmd)
|
if passed:
|
||||||
if (grepval):
|
if print_res:print(logname+": Success")
|
||||||
if print_res:print(logname+": failures detected")
|
return 0
|
||||||
return 1
|
else:
|
||||||
else:
|
if print_res:print(logname+": failures detected")
|
||||||
if print_res:print(logname+": Success")
|
return 1
|
||||||
return 0
|
|
||||||
|
|
||||||
pool = multiprocessing.Pool(min(len(confignames), 12))
|
pool = multiprocessing.Pool(min(len(confignames), 12))
|
||||||
fail = sum(pool.map(test_config, confignames))
|
fail = sum(pool.map(test_config, confignames))
|
||||||
|
Loading…
Reference in New Issue
Block a user