From e5bd749e2a86ef489c9e3b82bddf7f3eafd9fbda Mon Sep 17 00:00:00 2001 From: Jarred Allen Date: Tue, 2 Feb 2021 17:20:45 -0500 Subject: [PATCH] Refactor regression test --- .../regression/regression-wally.py | 34 ++++++++----------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/wally-pipelined/regression/regression-wally.py b/wally-pipelined/regression/regression-wally.py index 4d794e402..531d0e8cd 100755 --- a/wally-pipelined/regression/regression-wally.py +++ b/wally-pipelined/regression/regression-wally.py @@ -15,37 +15,31 @@ import multiprocessing, os 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): """Run the given config, and return 0 if it suceeds and 1 if it fails""" logname = "wally_"+config+".log" if config == "busybear": cmd = "echo 'quit' | vsim -do wally-busybear.do -c >" + logname os.system(cmd) - # check for success. grep returns 0 if found, 1 if not found - cmd = "grep -e 'no more .* to read' " + logname + "> /dev/null" - grepval = os.system(cmd) - if (grepval): - if print_res:print(logname+": failures detected") - return 1 - else: - if print_res:print(logname+": Success") - return 0 - - + passed = search_log_for_text("no more .* to read", logname) else: cmd = "vsim -c >" + logname +" < /dev/null" - grepval = os.system(cmd) - if (grepval): - if print_res:print(logname+": failures detected") - return 1 - else: - if print_res:print(logname+": Success") - return 0 + passed = search_log_for_text("All tests ran without failures", logname) + if passed: + if print_res:print(logname+": Success") + return 0 + else: + if print_res:print(logname+": failures detected") + return 1 + pool = multiprocessing.Pool(min(len(confignames), 12)) fail = sum(pool.map(test_config, confignames))