Skip to content
Open
Show file tree
Hide file tree
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
34 changes: 25 additions & 9 deletions regtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,12 @@ def test_suite(argv):
#--------------------------------------------------------------------------
runtimes = suite.get_wallclock_history()

#--------------------------------------------------------------------------
# Track if we're running multiple tests for incremental build optimization
#--------------------------------------------------------------------------
running_multiple_tests = len(test_list) > 1
first_cmake_build_done = False

#--------------------------------------------------------------------------
# main loop over tests
#--------------------------------------------------------------------------
Expand Down Expand Up @@ -523,15 +529,20 @@ def test_suite(argv):
os.chdir(bdir)

if test.reClean == 1:
# for one reason or another, multiple tests use different
# build options, make clean again to be safe
suite.log.log("re-making clean...")
if not test.extra_build_dir == "":
suite.make_realclean(repo=test.extra_build_dir)
elif suite.sourceTree in ["AMReX", "amrex"]:
suite.make_realclean(repo="AMReX")
# Skip clean for subsequent tests when running multiple tests with cmake
# to enable incremental builds
if suite.useCmake and running_multiple_tests and first_cmake_build_done:
suite.log.log("skipping clean for incremental cmake build...")
else:
suite.make_realclean()
# for one reason or another, multiple tests use different
# build options, make clean again to be safe
suite.log.log("re-making clean...")
if not test.extra_build_dir == "":
suite.make_realclean(repo=test.extra_build_dir)
elif suite.sourceTree in ["AMReX", "amrex"]:
suite.make_realclean(repo="AMReX")
else:
suite.make_realclean()

# Register start time
test.build_time = time.time()
Expand All @@ -542,7 +553,9 @@ def test_suite(argv):

if suite.sourceTree == "C_Src" or test.testSrcTree == "C_Src":
if suite.useCmake:
comp_string, rc = suite.build_test_cmake(test=test, outfile=coutfile)
# Skip cmake configuration for subsequent tests when running multiple tests
skip_config = running_multiple_tests and first_cmake_build_done
comp_string, rc = suite.build_test_cmake(test=test, outfile=coutfile, skip_config=skip_config)
else:
comp_string, rc = suite.build_c(test=test, outfile=coutfile)

Expand All @@ -553,6 +566,9 @@ def test_suite(argv):
# make return code is 0 if build was successful
if rc == 0:
test.compile_successful = True
# Mark that we've successfully completed the first cmake build
if suite.useCmake and not first_cmake_build_done:
first_cmake_build_done = True
# Compute compile time
test.build_time = time.time() - test.build_time
suite.log.log(f"Compilation time: {test.build_time:.3f} s")
Expand Down
12 changes: 9 additions & 3 deletions suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,12 @@ def cmake_config( self, name, path, configOpts="", install = 0, env =
os.mkdir(installdir)

# Logfile
coutfile = f'{self.full_test_dir}{name}.cmake.log'
# Use generic 'cmake.log' for test configurations (since we only configure once)
# Keep specific names for AMReX and suite configurations
if test is not None:
coutfile = f'{self.full_test_dir}cmake.log'
else:
coutfile = f'{self.full_test_dir}{name}.cmake.log'

# Run cmake
cmd = f'{self.cmake} {configOpts} -S {path} -B {builddir} '
Expand Down Expand Up @@ -1262,15 +1267,16 @@ def cmake_build( self, name, target, path, opts = '', env = None, outfile = None



def build_test_cmake(self, test, opts="", outfile=None):
def build_test_cmake(self, test, opts="", outfile=None, skip_config=False):
""" build an executable with CMake build system """

env = {"AMReX_ROOT":self.amrex_install_dir}

# super-builds always need a configure now, all other builds might
# add additional CMake config options and re-configure on existing configured
# build directory, if additional build cmakeSetupOpts are set
if self.isSuperbuild or test.cmakeSetupOpts != "":
# skip_config can be used to skip reconfiguration for incremental builds
if not skip_config and (self.isSuperbuild or test.cmakeSetupOpts != ""):
builddir, installdir = self.cmake_config(
name=test.name,
path=self.source_dir,
Expand Down