hypre-cmake: old to new test API (#45144)
* hypre-cmake: old to new test API * hypre-cmake: update Makefile to use installed files * hypre-cmake: make stand-alone test method name more specific --------- Co-authored-by: Tamara Dahlgren <dahlgren1@llnl.gov>
This commit is contained in:
parent
990e0dc526
commit
e4869cd558
@ -56,11 +56,13 @@ class HypreCmake(CMakePackage, CudaPackage):
|
|||||||
|
|
||||||
def url_for_version(self, version):
|
def url_for_version(self, version):
|
||||||
if version >= Version("2.12.0"):
|
if version >= Version("2.12.0"):
|
||||||
url = "https://github.com/hypre-space/hypre/archive/v{0}.tar.gz"
|
url = f"https://github.com/hypre-space/hypre/archive/v{version}.tar.gz"
|
||||||
else:
|
else:
|
||||||
url = "http://computing.llnl.gov/project/linear_solvers/download/hypre-{0}.tar.gz"
|
url = (
|
||||||
|
f"http://computing.llnl.gov/project/linear_solvers/download/hypre-{version}.tar.gz"
|
||||||
|
)
|
||||||
|
|
||||||
return url.format(version)
|
return url
|
||||||
|
|
||||||
root_cmakelists_dir = "src"
|
root_cmakelists_dir = "src"
|
||||||
|
|
||||||
@ -96,38 +98,47 @@ def setup_build_environment(self, env):
|
|||||||
|
|
||||||
@run_after("install")
|
@run_after("install")
|
||||||
def cache_test_sources(self):
|
def cache_test_sources(self):
|
||||||
self.cache_extra_test_sources(self.extra_install_tests)
|
if "+mpi" not in self.spec:
|
||||||
|
print("Package must be installed with +mpi to cache test sources")
|
||||||
|
return
|
||||||
|
|
||||||
|
cache_extra_test_sources(self, self.extra_install_tests)
|
||||||
|
|
||||||
|
# Customize the examples makefile before caching it
|
||||||
|
makefile = join_path(install_test_root(self), self.extra_install_tests, "Makefile")
|
||||||
|
filter_file(r"^HYPRE_DIR\s* =.*", f"HYPRE_DIR = {self.prefix}", makefile)
|
||||||
|
filter_file(r"^CC\s*=.*", "CC = " + self.spec["mpi"].mpicc, makefile)
|
||||||
|
filter_file(r"^F77\s*=.*", "F77 = " + self.spec["mpi"].mpif77, makefile)
|
||||||
|
filter_file(r"^CXX\s*=.*", "CXX = " + self.spec["mpi"].mpicxx, makefile)
|
||||||
|
filter_file(
|
||||||
|
r"^LIBS\s*=.*",
|
||||||
|
r"LIBS = -L$(HYPRE_DIR)/lib64 -lHYPRE -lm $(CUDA_LIBS) $(DOMP_LIBS)",
|
||||||
|
makefile,
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _cached_tests_work_dir(self):
|
def _cached_tests_work_dir(self):
|
||||||
"""The working directory for cached test sources."""
|
"""The working directory for cached test sources."""
|
||||||
return join_path(self.test_suite.current_test_cache_dir, self.extra_install_tests)
|
return join_path(self.test_suite.current_test_cache_dir, self.extra_install_tests)
|
||||||
|
|
||||||
def test(self):
|
def test_bigint(self):
|
||||||
"""Perform smoke test on installed HYPRE package."""
|
"""Perform smoke tests on installed HYPRE package."""
|
||||||
if "+mpi" not in self.spec:
|
if "+mpi" not in self.spec:
|
||||||
print("Skipping: HYPRE must be installed with +mpi to run tests")
|
raise SkipTest("Package must be installed with +mpi to run tests")
|
||||||
return
|
|
||||||
|
|
||||||
# Build copied and cached test examples
|
# Build and run cached examples
|
||||||
self.run_test(
|
with working_dir(self._cached_tests_work_dir):
|
||||||
"make",
|
make = which("make")
|
||||||
["HYPRE_DIR={0}".format(self.prefix), "bigint"],
|
make("bigint")
|
||||||
purpose="test: building selected examples",
|
|
||||||
work_dir=self._cached_tests_work_dir,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Run the examples built above
|
for exe_name in ["ex5big", "ex15big"]:
|
||||||
for exe in ["./ex5big", "./ex15big"]:
|
with test_part(self, f"test_bigint_{exe_name}", purpose=f"Ensure {exe_name} runs"):
|
||||||
self.run_test(
|
|
||||||
exe,
|
program = which(exe_name)
|
||||||
[],
|
if program is None:
|
||||||
[],
|
raise SkipTest(f"{exe_name} does not exist in version {self.version}")
|
||||||
installed=False,
|
|
||||||
purpose="test: ensuring {0} runs".format(exe),
|
program()
|
||||||
skip_missing=True,
|
|
||||||
work_dir=self._cached_tests_work_dir,
|
|
||||||
)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def headers(self):
|
def headers(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user