Skip to content

Commit

Permalink
Merge branch 'main' into delete-exe
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale authored Jan 9, 2025
2 parents 9d33cdd + 6e28c54 commit 28c7277
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
13 changes: 12 additions & 1 deletion regtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,7 @@ def test_suite(argv):
#----------------------------------------------------------------------
suite.log.log("archiving the output...")
match_count = 0
archived_file_list = []
for pfile in os.listdir(output_dir):

if (os.path.isdir(pfile) and
Expand All @@ -1198,9 +1199,11 @@ def test_suite(argv):
elif suite.archive_output == 1:
# tar it up
try:
tar = tarfile.open(f"{pfile}.tgz", "w:gz")
tarfilename = f"{pfile}.tgz"
tar = tarfile.open(tarfilename, "w:gz")
tar.add(f"{pfile}")
tar.close()
archived_file_list.append(tarfilename)

except:
suite.log.warn(f"unable to tar output file {pfile}")
Expand Down Expand Up @@ -1228,11 +1231,19 @@ def test_suite(argv):
test_successful = (test.return_code == 0 and test.analysis_successful and test.compare_successful)
if (test.ignore_return_code == 1 or test_successful):
if args.clean_testdir:
# remove subdirectories
suite.log.log("removing subdirectories from test directory...")
for file_name in os.listdir(output_dir):
file_path = os.path.join(output_dir, file_name)
if os.path.isdir(file_path):
shutil.rmtree(file_path)

# remove archived plotfiles
suite.log.log("removing compressed plotfiles from test directory...")
for file_name in archived_file_list:
file_path = os.path.join(output_dir, file_name)
os.remove(file_path)

# switch to the full test directory
os.chdir(suite.full_test_dir)
if args.delete_exe:
Expand Down
9 changes: 9 additions & 0 deletions repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,15 @@ def git_update(self):

shutil.copy(f"git.{self.name}.out", self.suite.full_web_dir)

if self.suite.updateGitSubmodules == 1:
# update submodules to those specified by the current commit
# (--init is required because there may be new submodules since the last checkout)
self.suite.log.log(f"git submodule update in {self.dir}")
_, _, rc = test_util.run(f"git submodule update --init")

if rc != 0:
self.suite.log.fail("ERROR: git submodule update was unsuccessful")

def save_head(self):
"""Save the current head of the repo"""

Expand Down
4 changes: 3 additions & 1 deletion suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ def __init__(self, args):
self.useCmake = 0
self.isSuperbuild = 0
self.use_ctools = 1

self.reportCoverage = args.with_coverage

# set automatically
Expand All @@ -435,6 +435,8 @@ def __init__(self, args):
self.amrex_install_dir = "" # Cmake installation dir
self.amrex_cmake_opts = ""

self.updateGitSubmodules = 0

self.MPIcommand = ""
self.MPIhost = ""

Expand Down
3 changes: 3 additions & 0 deletions test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
isSuperbuild = < 0: pre-build AMReX and source (default)
1: CMake downloads AMReX and needs separate configure & build >
updateGitSubmodules = < 0: don't update submodules when changing git branches (default)
1: run `git submodule update --init` after changing git branches >
sourceTree = < C_Src or AMReX >
suiteName = < descriptive name (i.e. Castro) >
Expand Down

0 comments on commit 28c7277

Please sign in to comment.