mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	Added --dry-run feature. Changed detection for buildrootboot sim when adding short buildroot tests with multiple sims to avoid unnecessary failures
This commit is contained in:
		
							parent
							
								
									43f5ec283c
								
							
						
					
					
						commit
						f605cb693a
					
				@ -334,16 +334,23 @@ def search_log_for_text(text, grepfile):
 | 
				
			|||||||
#    print("  search_log_for_text invoking %s" % grepcmd)
 | 
					#    print("  search_log_for_text invoking %s" % grepcmd)
 | 
				
			||||||
    return os.system(grepcmd) == 0
 | 
					    return os.system(grepcmd) == 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def run_test_case(config):
 | 
					def run_test_case(config, dryrun: bool = False):
 | 
				
			||||||
    """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
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    Do not execute commands if dryrun
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
    grepfile = config.grepfile
 | 
					    grepfile = config.grepfile
 | 
				
			||||||
    cmd = config.cmd
 | 
					    cmd = config.cmd
 | 
				
			||||||
    os.chdir(regressionDir)
 | 
					    os.chdir(regressionDir)
 | 
				
			||||||
    # print("  run_test_case invoking %s" % cmd, flush=True)
 | 
					    if dryrun:
 | 
				
			||||||
 | 
					        print(f"Executing {cmd}", flush=True)
 | 
				
			||||||
 | 
					        return 0
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
        os.system(cmd)
 | 
					        os.system(cmd)
 | 
				
			||||||
        if search_log_for_text(config.grepstr, grepfile):
 | 
					        if search_log_for_text(config.grepstr, grepfile):
 | 
				
			||||||
            # Flush is needed to flush output to stdout when running in multiprocessing Pool
 | 
					            # Flush is needed to flush output to stdout when running in multiprocessing Pool
 | 
				
			||||||
#        print(f"{bcolors.OKGREEN}%s_%s: Success{bcolors.ENDC}" % (config.variant, config.name), flush=True)
 | 
					    #        print(f"{bcolors.OKGREEN}%s_%s: Success{bcolors.ENDC}" % (config.variant, config.name), flush=True)
 | 
				
			||||||
            print(f"{bcolors.OKGREEN}%s: Success{bcolors.ENDC}" % (config.cmd), flush=True) 
 | 
					            print(f"{bcolors.OKGREEN}%s: Success{bcolors.ENDC}" % (config.cmd), flush=True) 
 | 
				
			||||||
            return 0
 | 
					            return 0
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
@ -363,6 +370,7 @@ os.chdir(regressionDir)
 | 
				
			|||||||
coveragesim = "questa"  # Questa is required for code/functional coverage
 | 
					coveragesim = "questa"  # Questa is required for code/functional coverage
 | 
				
			||||||
#defaultsim = "questa"   # Default simulator for all other tests; change to Verilator when flow is ready
 | 
					#defaultsim = "questa"   # Default simulator for all other tests; change to Verilator when flow is ready
 | 
				
			||||||
defaultsim = "verilator"   # Default simulator for all other tests
 | 
					defaultsim = "verilator"   # Default simulator for all other tests
 | 
				
			||||||
 | 
					buildrootbootsim = "questa"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
parser = argparse.ArgumentParser()
 | 
					parser = argparse.ArgumentParser()
 | 
				
			||||||
parser.add_argument("--ccov", help="Code Coverage", action="store_true")
 | 
					parser.add_argument("--ccov", help="Code Coverage", action="store_true")
 | 
				
			||||||
@ -371,6 +379,7 @@ parser.add_argument("--nightly", help="Run large nightly regression", action="st
 | 
				
			|||||||
parser.add_argument("--buildroot", help="Include Buildroot Linux boot test (takes many hours, done along with --nightly)", action="store_true")
 | 
					parser.add_argument("--buildroot", help="Include Buildroot Linux boot test (takes many hours, done along with --nightly)", action="store_true")
 | 
				
			||||||
parser.add_argument("--testfloat", help="Include Testfloat floating-point unit tests", action="store_true")
 | 
					parser.add_argument("--testfloat", help="Include Testfloat floating-point unit tests", action="store_true")
 | 
				
			||||||
parser.add_argument("--fp", help="Include floating-point tests in coverage (slower runtime)", action="store_true")
 | 
					parser.add_argument("--fp", help="Include floating-point tests in coverage (slower runtime)", action="store_true")
 | 
				
			||||||
 | 
					parser.add_argument("--dryrun", help="Print commands invoked to console without running regression", action="store_true")
 | 
				
			||||||
args = parser.parse_args()
 | 
					args = parser.parse_args()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (args.nightly):
 | 
					if (args.nightly):
 | 
				
			||||||
@ -404,7 +413,7 @@ configs = [
 | 
				
			|||||||
# run full buildroot boot simulation (slow) if buildroot flag is set.  Start it early to overlap with other tests
 | 
					# run full buildroot boot simulation (slow) if buildroot flag is set.  Start it early to overlap with other tests
 | 
				
			||||||
if (args.buildroot):
 | 
					if (args.buildroot):
 | 
				
			||||||
    # addTests(tests_buildrootboot, defaultsim) # non-lockstep with Verilator runs in about 2 hours
 | 
					    # addTests(tests_buildrootboot, defaultsim) # non-lockstep with Verilator runs in about 2 hours
 | 
				
			||||||
    addTests(tests_buildrootbootlockstep, "questa") # lockstep with Questa and ImperasDV runs overnight
 | 
					    addTests(tests_buildrootbootlockstep, buildrootbootsim) # lockstep with Questa and ImperasDV runs overnight
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (args.ccov):  # only run RV64GC tests on Questa in code coverage mode
 | 
					if (args.ccov):  # only run RV64GC tests on Questa in code coverage mode
 | 
				
			||||||
    addTests(tests64gc_nofp, coveragesim)
 | 
					    addTests(tests64gc_nofp, coveragesim)
 | 
				
			||||||
@ -417,7 +426,7 @@ elif (args.fcov):  # only run RV64GC tests on Questa in lockstep in functional c
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
else: 
 | 
					else: 
 | 
				
			||||||
    for sim in sims:
 | 
					    for sim in sims:
 | 
				
			||||||
        if (not (args.buildroot and sim == defaultsim)):  # skip short buildroot sim if running long one
 | 
					        if (not (args.buildroot and sim == buildrootbootsim)):  # skip short buildroot sim if running long one
 | 
				
			||||||
            addTests(tests_buildrootshort, sim)
 | 
					            addTests(tests_buildrootshort, sim)
 | 
				
			||||||
        addTests(tests, sim)
 | 
					        addTests(tests, sim)
 | 
				
			||||||
        addTests(tests64gc_nofp, sim)
 | 
					        addTests(tests64gc_nofp, sim)
 | 
				
			||||||
@ -428,6 +437,7 @@ if (args.nightly):
 | 
				
			|||||||
    addLockstepTestsByDir(WALLY+"/tests/coverage", "rv64gc", "questa", 0)
 | 
					    addLockstepTestsByDir(WALLY+"/tests/coverage", "rv64gc", "questa", 0)
 | 
				
			||||||
    addLockstepTestsByDir(WALLY+"/tests/riscof/work/wally-riscv-arch-test/rv64i_m", "rv64gc", "questa", 0)
 | 
					    addLockstepTestsByDir(WALLY+"/tests/riscof/work/wally-riscv-arch-test/rv64i_m", "rv64gc", "questa", 0)
 | 
				
			||||||
    addTests(derivconfigtests, defaultsim)
 | 
					    addTests(derivconfigtests, defaultsim)
 | 
				
			||||||
 | 
					    addTests(bpredtests, defaultsim)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# testfloat tests
 | 
					# testfloat tests
 | 
				
			||||||
if (args.testfloat): # for testfloat alone, just run testfloat tests
 | 
					if (args.testfloat): # for testfloat alone, just run testfloat tests
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user