This commit is contained in:
naichewa 2024-11-05 11:05:48 -08:00
commit 89e9d222af
4 changed files with 31 additions and 16 deletions

View File

@ -88,6 +88,18 @@ foreach my $key (@derivnames) {
open(my $unmod, $configunmod) or die "Could not open file '$configunmod' $!";
open(my $fh, '>>', $config) or die "Could not open file '$config' $!";
# Create symlink to imperas.ic for deriv buildroot
if ($key eq "buildroot") {
my $baseimperas_ic = "$ENV{WALLY}/config/$basederiv{$key}/imperas.ic";
if (! -e $baseimperas_ic) {
my $baseimperas_ic = "$ENV{WALLY}/config/deriv/$basederiv{$key}/config.vh";
}
if (-e $baseimperas_ic) { # If imperas.ic exists for base derivative, create hardlink to it
my $imperas_ic = "$dir/imperas.ic";
system("ln -T $baseimperas_ic $imperas_ic");
}
}
my $datestring = localtime();
my %hit = ();
print $fh "// Config $key automatically derived from $basederiv{$key} on $datestring using derivgen.pl\n";

View File

@ -261,9 +261,6 @@ class TestRunner:
cvw = folder.joinpath("cvw")
self.logger.info(f"cvw is: {cvw}")
# set the WALLY environmental variable to the new repository
os.environ["WALLY"] = str(cvw)
self.cvw = cvw
self.sim_dir = cvw.joinpath("bin")
self.base_parent_dir = folder
@ -292,11 +289,11 @@ class TestRunner:
output_file = self.log_dir.joinpath(f"make-{target}-output.log")
else: output_file = self.log_dir.joinpath(f"make-output.log")
# Execute make with target and cores/2
# Source setup script and execute make with target and cores/2
if target:
command = ["make", target, "--jobs=$(($(nproc)/2))"]
command = [f"source {os.path.join(self.cvw, 'setup.sh')} > /dev/null && make {target} --jobs=$(($(nproc)/2))"]
else:
command = ["make", "--jobs=$(($(nproc)/2))"]
command = [f"source {os.path.join(self.cvw, 'setup.sh')} > /dev/null && make --jobs=$(($(nproc)/2))"]
self.logger.info(f"Command used in directory {makefile_location}: {' '.join(command)}")
@ -305,7 +302,7 @@ class TestRunner:
formatted_datetime = self.current_datetime.strftime("%Y-%m-%d %H:%M:%S")
f.write(formatted_datetime)
f.write("\n\n")
result = subprocess.run(command, stdout=f, stderr=subprocess.STDOUT, text=True, shell=True)
result = subprocess.run(command, stdout=f, stderr=subprocess.STDOUT, text=True, shell=True, executable="/bin/bash")
# Execute the command using a subprocess and not save the output
#result = subprocess.run(command, text=True)
@ -334,12 +331,16 @@ class TestRunner:
output_file = self.log_dir.joinpath(f"{test_name}-output.log")
os.chdir(self.sim_dir)
# Source setup script and delete output from log on whatever test command gets run
command = f"source {os.path.join(self.cvw, 'setup.sh')} > /dev/null && "
if test_extensions:
command = [test_type, test_name] + test_extensions
commandext = [test_type, test_name] + test_extensions
self.logger.info(f"Command used to run tests in directory {self.sim_dir}: {test_type} {test_name} {' '.join(test_extensions)}")
else:
command = [test_type, test_name]
commandext = [test_type, test_name]
self.logger.info(f"Command used to run tests in directory {self.sim_dir}: {test_type} {test_name}")
command += " ".join(commandext)
# Execute the command using subprocess and save the output into a file
@ -348,15 +349,15 @@ class TestRunner:
formatted_datetime = self.current_datetime.strftime("%Y-%m-%d %H:%M:%S")
f.write(formatted_datetime)
f.write("\n\n")
result = subprocess.run(command, stdout=f, stderr=subprocess.STDOUT, text=True)
result = subprocess.run(command, stdout=f, stderr=subprocess.STDOUT, text=True, shell=True, executable="/bin/bash")
except Exception as e:
self.logger.error("There was an error in running the tests in the run_tests function: {e}")
self.logger.error(f"There was an error in running the tests in the run_tests function: {e}")
# Check if the command executed successfuly
if result.returncode or result.returncode == 0:
self.logger.info(f"Test ran successfuly. Test type: {test_type}, test name: {test_name}, test extension: {' '.join(test_extensions)}")
self.logger.info(f"Test ran successfuly. Test name: {test_name}, test extension: {' '.join(test_extensions)}")
return True, output_file
else:
self.logger.error(f"Error making test. Test type: {test_type}, test name: {test_name}, test extension: {' '.join(test_extensions)}")
self.logger.error(f"Error making test. Test name: {test_name}, test extension: {' '.join(test_extensions)}")
return False, output_file

View File

@ -539,7 +539,7 @@ def main():
num_fail = 0
results = {}
for config in configs:
results[config] = pool.apply_async(run_test_case,(config,))
results[config] = pool.apply_async(run_test_case,(config, args.dryrun))
for (config,result) in results.items():
try:
num_fail+=result.get(timeout=TIMEOUT_DUR)

View File

@ -65,7 +65,7 @@ if(args.testsuite.endswith('.elf') and args.elf == ""): # No --elf argument; che
print("ELF file not found: " + args.testsuite)
exit(1)
if(args.lockstep and not args.testsuite.endswith('.elf')):
if(args.lockstep and not args.testsuite.endswith('.elf') and not args.testsuite == "buildroot"):
print(f"Invalid Options. Cannot run a testsuite, {args.testsuite} with lockstep. Must run a single elf.")
exit(1)
@ -90,7 +90,9 @@ else: EnableLog = 0
prefix = ""
if (args.lockstep or args.lockstepverbose or args.fcov or args.fcovimp):
if (args.sim == "questa" or args.sim == "vcs"):
prefix = "IMPERAS_TOOLS=" + WALLY + "/config/"+args.config+"/imperas.ic"
prefix = "IMPERAS_TOOLS=" + os.path.join(WALLY, "config", args.config, "imperas.ic")
if not os.path.isfile(prefix): # If config is a derivative, look for imperas.ic in derivative configs
prefix = "IMPERAS_TOOLS=" + os.path.join(WALLY, "config", "deriv", args.config, "imperas.ic")
# Force Questa to use 64-bit mode, sometimes it defaults to 32-bit even on 64-bit machines
if (args.sim == "questa"):
prefix = "MTI_VCO_MODE=64 " + prefix