Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed source.sh dependency in nightly build #1048

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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