Skip to content

Commit

Permalink
Merge pull request #1057 from slmnemo/nightly_regression
Browse files Browse the repository at this point in the history
Fixed buildroot lockstep, removed source.sh dependency in nightly build
  • Loading branch information
jordancarlin authored Nov 5, 2024
2 parents 866ad88 + 4e2b3cd commit 0a523cf
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 16 deletions.
12 changes: 12 additions & 0 deletions bin/derivgen.pl
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@
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";
Expand Down
27 changes: 14 additions & 13 deletions bin/nightly_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,6 @@ def source_setup(self, folder):
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
Expand Down Expand Up @@ -292,11 +289,11 @@ def execute_makefile(self, makefile_path=None, target=None):
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)}")

Expand All @@ -305,7 +302,7 @@ def execute_makefile(self, makefile_path=None, target=None):
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)
Expand Down Expand Up @@ -334,12 +331,16 @@ def run_tests(self, test_type=None, test_name=None, test_extensions=None):
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
Expand All @@ -348,15 +349,15 @@ def run_tests(self, test_type=None, test_name=None, test_extensions=None):
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


Expand Down
2 changes: 1 addition & 1 deletion bin/regression-wally
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions bin/wsim
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand Down

0 comments on commit 0a523cf

Please sign in to comment.