regression modified to timeout after 10 min \n took Harris\' suggestion for avoiding using ahbliteState package in busybear testbench

This commit is contained in:
bbracker 2021-05-17 18:44:47 -04:00
parent e808b06b82
commit e4c90f503a
2 changed files with 23 additions and 11 deletions

View File

@ -50,37 +50,50 @@ configs = [
), ),
] ]
import multiprocessing, os import os
from multiprocessing import Pool, TimeoutError
def search_log_for_text(text, logfile): 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""" """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) grepcmd = "grep -e '%s' '%s' > /dev/null" % (text, logfile)
return os.system(grepcmd) == 0 return os.system(grepcmd) == 0
def run_test_case(case): 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 = "regression_logs/wally_"+case.name+".log" logname = "regression_logs/wally_"+config.name+".log"
cmd = case.cmd.format(logname) cmd = config.cmd.format(logname)
print(cmd) print(cmd)
os.system(cmd) os.system(cmd)
if search_log_for_text(case.grepstr, logname): if search_log_for_text(config.grepstr, logname):
print("%s: Success" % logname) print("%s: Success" % config.name)
return 0 return 0
else: else:
print("%s: failures detected" % logname) print("%s: Failures detected in output" % config.name)
print(" Check %s" % logname)
return 1 return 1
def main(): def main():
"""Run the tests and count the failures""" """Run the tests and count the failures"""
# Scale the number of concurrent processes to the number of test cases, but # Scale the number of concurrent processes to the number of test cases, but
# max out at 12 concurrent processes to not overwhelm the system # max out at 12 concurrent processes to not overwhelm the system
TIMEOUT_DUR = 600 # seconds
try: try:
os.mkdir("regression_logs") os.mkdir("regression_logs")
except: except:
pass pass
pool = multiprocessing.Pool(min(len(configs), 12)) with Pool(processes=min(len(configs),12)) as pool:
num_fail = 0
results = {}
for config in configs:
results[config] = pool.apply_async(run_test_case,(config,))
for (config,result) in results.items():
try:
num_fail+=result.get(timeout=TIMEOUT_DUR)
except TimeoutError:
num_fail+=1
print("%s: Timeout - runtime exceeded %d seconds" % (config.name, TIMEOUT_DUR))
# Count the number of failures # Count the number of failures
num_fail = sum(pool.map(run_test_case, configs))
if num_fail: if num_fail:
print("Regression failed with %s failed configurations" % num_fail) print("Regression failed with %s failed configurations" % num_fail)
# Remind the user to try `make allclean`, since it may be needed if test # Remind the user to try `make allclean`, since it may be needed if test

View File

@ -261,11 +261,10 @@ module testbench();
logic [`XLEN-1:0] readAdrExpected, readAdrTranslated; logic [`XLEN-1:0] readAdrExpected, readAdrTranslated;
import ahbliteState::*;
always @(dut.HRDATA) begin always @(dut.HRDATA) begin
#2; #2;
if (dut.hart.MemRWM[1] if (dut.hart.MemRWM[1]
&& (dut.hart.ebu.BusState == MEMREAD || dut.hart.ebu.BusState == ATOMICREAD) && (dut.hart.ebu.CaptureDataM)
&& dut.HRDATA !== {64{1'bx}}) begin && dut.HRDATA !== {64{1'bx}}) begin
//$display("%0t", $time); //$display("%0t", $time);
if($feof(data_file_memR)) begin if($feof(data_file_memR)) begin