Skip to content

Commit

Permalink
Updating the ats environment update script
Browse files Browse the repository at this point in the history
  • Loading branch information
cssherman committed Jan 24, 2024
1 parent 9175fbf commit 5b899b7
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions geos_ats_package/geos_ats/environment_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@
import argparse


def setup_ats(src_path, build_path, ats_xargs, ats_machine, ats_machine_dir):
def setup_ats(src_path, build_path, baseline_dir, working_dir, ats_xargs, ats_machine, ats_machine_dir):
bin_dir = os.path.join(build_path, "bin")
geos_ats_fname = os.path.join(bin_dir, "run_geos_ats")
ats_dir = os.path.abspath(os.path.join(src_path, "integratedTests", "tests", "allTests"))
test_path = os.path.join(build_path, "integratedTests")
link_path = os.path.join(test_path, "integratedTests")
run_script_fname = os.path.join(test_path, "geos_ats.sh")
log_dir = os.path.join(test_path, "TestResults")
baseline_dir = os.path.abspath(baseline_dir)
working_dir = os.path.abspath(working_dir)
ats_main_file = os.path.abspath(os.path.join(src_path, 'inputFiles', 'main.ats'))

# Create a symbolic link to test directory
# Create a symbolic link to working directory
os.makedirs(working_dir, exist_ok=True)
if os.path.islink(link_path):
print('integratedTests symlink already exists')
else:
os.symlink(ats_dir, link_path)
os.symlink(working_dir, link_path)

# Build extra arguments that should be passed to ATS
joined_args = [' '.join(x) for x in ats_xargs]
Expand All @@ -30,7 +33,7 @@ def setup_ats(src_path, build_path, ats_xargs, ats_machine, ats_machine_dir):
# Write the bash script to run ats.
with open(run_script_fname, "w") as g:
g.write("#!/bin/bash\n")
g.write(f"{geos_ats_fname} {bin_dir} --workingDir {ats_dir} --logs {log_dir} {ats_args} \"$@\"\n")
g.write(f"{geos_ats_fname} {bin_dir} {ats_main_file} --workingDir {working_dir} --baselineDir {baseline_dir} --logs {log_dir} {ats_args} \"$@\"\n")

# Make the script executable
st = os.stat(run_script_fname)
Expand All @@ -46,11 +49,13 @@ def main():
parser = argparse.ArgumentParser(description="Setup ATS script")
parser.add_argument("src_path", type=str, help="GEOS src path")
parser.add_argument("build_path", type=str, help="GEOS build path")
parser.add_argument("baseline_dir", type=str, help="GEOS test baseline root directory")
parser.add_argument("working_dir", type=str, help="GEOS test working root directory")
parser.add_argument("--ats", nargs='+', default=[], action="append", help="Arguments that should be passed to ats")
parser.add_argument("--machine", type=str, default='', help="ATS machine name")
parser.add_argument("--machine-dir", type=str, default='', help="ATS machine directory")
options, unkown_args = parser.parse_known_args()
setup_ats(options.src_path, options.build_path, options.ats, options.machine, options.machine_dir)
setup_ats(options.src_path, options.build_path, options.baseline_dir, options.working_dir, options.ats, options.machine, options.machine_dir)


if __name__ == '__main__':
Expand Down

0 comments on commit 5b899b7

Please sign in to comment.