Cache extra test sources update (#45493)

* stand-alone test API update: self.cache_extra_test_sources(...) -> cache_extra_test_sources(self, ...)
* superlu: switch to new cache_extra_test_sources API

---------

Co-authored-by: Tamara Dahlgren <dahlgren1@llnl.gov>
This commit is contained in:
AcriusWinter
2024-08-15 11:55:16 -07:00
committed by GitHub
parent 7112a49d1e
commit 10b6d7282a
39 changed files with 53 additions and 50 deletions

View File

@@ -364,7 +364,7 @@ def setup_install_tests(self):
install test subdirectory for use during `spack test run`. install test subdirectory for use during `spack test run`.
""" """
extra_install_tests = [join_path("testing", "install", "C")] extra_install_tests = [join_path("testing", "install", "C")]
self.cache_extra_test_sources(extra_install_tests) cache_extra_test_sources(self, extra_install_tests)
def test_run_executables(self): def test_run_executables(self):
"""Run installed adios2 executables""" """Run installed adios2 executables"""

View File

@@ -115,7 +115,7 @@ def configure_args(self):
def cache_test_sources(self): def cache_test_sources(self):
"""Copy the example source files after the package is installed to an """Copy the example source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources(self.smoke_test_src) cache_extra_test_sources(self, self.smoke_test_src)
def test_check_tutorial(self): def test_check_tutorial(self):
"""Compile and run the tutorial tests as install checks""" """Compile and run the tutorial tests as install checks"""

View File

@@ -357,7 +357,7 @@ def setup_standalone_test(self):
if self.spec.satisfies("@:21.11"): if self.spec.satisfies("@:21.11"):
return return
self.cache_extra_test_sources(["Tests"]) cache_extra_test_sources(self, ["Tests"])
def test_run_install_test(self): def test_run_install_test(self):
"""build and run AmrCore test""" """build and run AmrCore test"""

View File

@@ -129,7 +129,7 @@ def cmake_args(self):
def setup_build_tests(self): def setup_build_tests(self):
"""Copy the example source files after the package is installed to an """Copy the example source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources([self.examples_src_dir]) cache_extra_test_sources(self, [self.examples_src_dir])
@property @property
def cached_tests_work_dir(self): def cached_tests_work_dir(self):

View File

@@ -50,7 +50,7 @@ def cmake_args(self):
def cache_test_sources(self): def cache_test_sources(self):
"""Copy the example source files after the package is installed to an """Copy the example source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources(["test"]) cache_extra_test_sources(self, ["test"])
def test_run_parallel_example(self): def test_run_parallel_example(self):
"""build and run parallel-simple""" """build and run parallel-simple"""

View File

@@ -38,7 +38,7 @@ def configure_args(self):
def cache_test_sources(self): def cache_test_sources(self):
"""Copy the test source files after the package is installed to an """Copy the test source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources(self.test_src_dir) cache_extra_test_sources(self, self.test_src_dir)
# Fix test scripts to run installed binaries # Fix test scripts to run installed binaries
scripts_dir = join_path(install_test_root(self), self.test_src_dir) scripts_dir = join_path(install_test_root(self), self.test_src_dir)

View File

@@ -56,7 +56,7 @@ def cmake_args(self):
def cache_test_sources(self): def cache_test_sources(self):
"""Copy the example source files after the package is installed to an """Copy the example source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources(["examples"]) cache_extra_test_sources(self, ["examples"])
def test_sample_nested_example(self): def test_sample_nested_example(self):
"""build and run sample_nested""" """build and run sample_nested"""

View File

@@ -76,7 +76,7 @@ def copy_test_sources(self):
join_path("examples", "external", "main.cpp"), join_path("examples", "external", "main.cpp"),
join_path("examples", "external", "7pt.py"), join_path("examples", "external", "7pt.py"),
] ]
self.cache_extra_test_sources(srcs) cache_extra_test_sources(self, srcs)
def test_bricklib_example(self): def test_bricklib_example(self):
"""build and run pre-built example""" """build and run pre-built example"""

View File

@@ -202,7 +202,7 @@ def cmake_args(self):
def cache_test_sources(self): def cache_test_sources(self):
"""Copy the example source files after the package is installed to an """Copy the example source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources([join_path("examples", "apps")]) cache_extra_test_sources(self, [join_path("examples", "apps")])
def test_cxx_example(self): def test_cxx_example(self):
"""build and run cxx-example""" """build and run cxx-example"""

View File

@@ -149,7 +149,7 @@ def basepath(self):
@run_after("install") @run_after("install")
def _copy_test_inputs(self): def _copy_test_inputs(self):
test_inputs = [join_path(self.basepath, "mpi-io-test.c")] test_inputs = [join_path(self.basepath, "mpi-io-test.c")]
self.cache_extra_test_sources(test_inputs) cache_extra_test_sources(self, test_inputs)
def test_mpi_io_test(self): def test_mpi_io_test(self):
"""build, run, and check outputs""" """build, run, and check outputs"""

View File

@@ -113,7 +113,7 @@ def tests_log_path(self):
@run_after("install") @run_after("install")
def _copy_test_inputs(self): def _copy_test_inputs(self):
test_inputs = [self.tests_log_path] test_inputs = [self.tests_log_path]
self.cache_extra_test_sources(test_inputs) cache_extra_test_sources(self, test_inputs)
def test_parser(self): def test_parser(self):
"""process example log and check counters""" """process example log and check counters"""

View File

@@ -53,7 +53,7 @@ def edit(self):
@run_after("install") @run_after("install")
def cache_test_sources(self): def cache_test_sources(self):
"""Save off the pdb sources for stand-alone testing.""" """Save off the pdb sources for stand-alone testing."""
self.cache_extra_test_sources("pdb") cache_extra_test_sources(self, "pdb")
def test_mkdssp(self): def test_mkdssp(self):
"""calculate structure for example""" """calculate structure for example"""

View File

@@ -74,7 +74,7 @@ def setup_build_environment(self, env):
@run_after("install") @run_after("install")
def cache_test_sources(self): def cache_test_sources(self):
"""Save off benchmark files for stand-alone tests.""" """Save off benchmark files for stand-alone tests."""
self.cache_extra_test_sources("benchmark") cache_extra_test_sources(self, "benchmark")
def test_benchmarks(self): def test_benchmarks(self):
"""run benchmark checks""" """run benchmark checks"""

View File

@@ -73,7 +73,7 @@ def cmake_args(self):
def setup_smoke_tests(self): def setup_smoke_tests(self):
"""Copy the example source files after the package is installed to an """Copy the example source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources([self.examples_src_dir]) cache_extra_test_sources(self, [self.examples_src_dir])
@property @property
def cached_tests_work_dir(self): def cached_tests_work_dir(self):

View File

@@ -53,7 +53,7 @@ def cmake_args(self):
def setup_smoke_tests(self): def setup_smoke_tests(self):
"""Copy the example source files after the package is installed to an """Copy the example source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources([self.examples_src_dir]) cache_extra_test_sources(self, [self.examples_src_dir])
@property @property
def cached_tests_work_dir(self): def cached_tests_work_dir(self):

View File

@@ -96,7 +96,7 @@ def cached_tests_work_dir(self):
def setup_smoke_tests(self): def setup_smoke_tests(self):
"""Copy the example source files after the package is installed to an """Copy the example source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources([self.examples_src_dir]) cache_extra_test_sources(self, [self.examples_src_dir])
def test_installation(self): def test_installation(self):
"""build and run ctest against the installed software""" """build and run ctest against the installed software"""

View File

@@ -117,4 +117,4 @@ def cached_tests_work_dir(self):
def cache_test_sources(self): def cache_test_sources(self):
"""Copy test files after the package is installed for test().""" """Copy test files after the package is installed for test()."""
if self.spec.satisfies("@master"): if self.spec.satisfies("@master"):
self.cache_extra_test_sources(["tests"]) cache_extra_test_sources(self, ["tests"])

View File

@@ -214,7 +214,7 @@ def extra_install_tests(self):
@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) cache_extra_test_sources(self, self.extra_install_tests)
def _cached_tests_src_dir(self, script): def _cached_tests_src_dir(self, script):
"""The cached smoke test source directory for the script.""" """The cached smoke test source directory for the script."""

View File

@@ -218,7 +218,7 @@ def cached_tests_work_dir(self):
def setup_build_tests(self): def setup_build_tests(self):
"""Copy the build test files after the package is installed to an """Copy the build test files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources(self.extra_install_tests) cache_extra_test_sources(self, self.extra_install_tests)
def _check_version_match(self, exe): def _check_version_match(self, exe):
"""Ensure exe version check yields spec version.""" """Ensure exe version check yields spec version."""

View File

@@ -594,9 +594,9 @@ def cache_test_sources(self):
"""Copy the tests source files after the package is installed to an """Copy the tests source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
if self.spec.satisfies("@5.1:5.5"): if self.spec.satisfies("@5.1:5.5"):
self.cache_extra_test_sources([self.test_src_dir_old]) cache_extra_test_sources(self, [self.test_src_dir_old])
elif self.spec.satisfies("@5.6:"): elif self.spec.satisfies("@5.6:"):
self.cache_extra_test_sources([self.test_src_dir]) cache_extra_test_sources(self, [self.test_src_dir])
def test_samples(self): def test_samples(self):
# configure, build and run all hip samples # configure, build and run all hip samples

View File

@@ -395,7 +395,7 @@ def setup_build_tests(self):
"-DSPACK_PACKAGE_INSTALL_DIR:PATH={0}".format(self.prefix), "-DSPACK_PACKAGE_INSTALL_DIR:PATH={0}".format(self.prefix),
] ]
cmake(*cmake_args) cmake(*cmake_args)
self.cache_extra_test_sources(cmake_out_path) cache_extra_test_sources(self, cmake_out_path)
def test_run(self): def test_run(self):
"""Test if kokkos builds and runs""" """Test if kokkos builds and runs"""

View File

@@ -495,7 +495,7 @@ def install(self, spec, prefix):
def cache_test_sources(self): def cache_test_sources(self):
"""Copy the example source files after the package is installed to an """Copy the example source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources([join_path("examples", "local_function_tasks")]) cache_extra_test_sources(self, [join_path("examples", "local_function_tasks")])
def test_run_local_function_tasks(self): def test_run_local_function_tasks(self):
"""Build and run external application example""" """Build and run external application example"""

View File

@@ -36,7 +36,7 @@ def configure_args(self):
def setup_tests(self): def setup_tests(self):
"""Copy the build test files after the package is installed to an """Copy the build test files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources(self.extra_install_tests) cache_extra_test_sources(self, self.extra_install_tests)
def test_smoke_test(self): def test_smoke_test(self):
"""build and run smoke test""" """build and run smoke test"""

View File

@@ -1223,7 +1223,7 @@ def cache_test_sources(self):
# Clean the 'examples' directory -- at least one example is always built # Clean the 'examples' directory -- at least one example is always built
# and we do not want to cache executables. # and we do not want to cache executables.
make("examples/clean", parallel=False) make("examples/clean", parallel=False)
self.cache_extra_test_sources([self.examples_src_dir, self.examples_data_dir]) cache_extra_test_sources(self, [self.examples_src_dir, self.examples_data_dir])
def test_ex10(self): def test_ex10(self):
"""build and run ex10(p)""" """build and run ex10(p)"""

View File

@@ -649,7 +649,7 @@ def configure_args(self):
def cache_test_sources(self): def cache_test_sources(self):
"""Copy the example source files after the package is installed to an """Copy the example source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources(["examples", join_path("test", "mpi")]) cache_extra_test_sources(self, ["examples", join_path("test", "mpi")])
def mpi_launcher(self): def mpi_launcher(self):
"""Determine the appropriate launcher.""" """Determine the appropriate launcher."""

View File

@@ -1298,7 +1298,7 @@ def setup_install_tests(self):
Copy the example files after the package is installed to an Copy the example files after the package is installed to an
install test subdirectory for use during `spack test run`. install test subdirectory for use during `spack test run`.
""" """
self.cache_extra_test_sources(self.extra_install_tests) cache_extra_test_sources(self, self.extra_install_tests)
def run_installed_binary(self, bin, options, expected): def run_installed_binary(self, bin, options, expected):
"""run and check outputs for the installed binary""" """run and check outputs for the installed binary"""

View File

@@ -209,7 +209,7 @@ def cache_test_sources(self):
"""Copy the example source files after the package is installed to an """Copy the example source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
if os.path.exists(self.test_src_dir): if os.path.exists(self.test_src_dir):
self.cache_extra_test_sources([self.test_src_dir]) cache_extra_test_sources(self, [self.test_src_dir])
def test_smoke(self): def test_smoke(self):
"""Compile and run simple code against the installed papi library.""" """Compile and run simple code against the installed papi library."""

View File

@@ -42,7 +42,7 @@ def setup_run_environment(self, env):
def cache_test_sources(self): def cache_test_sources(self):
"""Copy the example source files after the package is installed to an """Copy the example source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources(join_path("kv", "tests")) cache_extra_test_sources(self, join_path("kv", "tests"))
@property @property
def _lib_dir(self): def _lib_dir(self):

View File

@@ -697,8 +697,9 @@ def setup_build_tests(self):
tty.warn("Stand-alone tests only available for v3.13:") tty.warn("Stand-alone tests only available for v3.13:")
return return
self.cache_extra_test_sources( cache_extra_test_sources(
[join_path("src", "ksp", "ksp", "tutorials"), join_path("src", "snes", "tutorials")] self,
[join_path("src", "ksp", "ksp", "tutorials"), join_path("src", "snes", "tutorials")],
) )
def get_runner(self): def get_runner(self):

View File

@@ -52,7 +52,7 @@ class PyChainer(PythonPackage):
@run_after("install") @run_after("install")
def cache_test_sources(self): def cache_test_sources(self):
if "+mn" in self.spec: if "+mn" in self.spec:
self.cache_extra_test_sources("examples") cache_extra_test_sources(self, "examples")
def test_chainermn(self): def test_chainermn(self):
"""run the ChainerMN test""" """run the ChainerMN test"""

View File

@@ -92,7 +92,9 @@ class PyLibensemble(PythonPackage):
def cache_test_sources(self): def cache_test_sources(self):
"""Copy the example source files after the package is installed to an """Copy the example source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources(join_path("examples", "calling_scripts", "regression_tests")) cache_extra_test_sources(
self, join_path("examples", "calling_scripts", "regression_tests")
)
def run_tutorial_script(self, script): def run_tutorial_script(self, script):
"""run the tutorial example regression test""" """run the tutorial example regression test"""

View File

@@ -114,7 +114,7 @@ def configure_args(self):
def setup_build_tests(self): def setup_build_tests(self):
"""Copy the build test files after the package is installed to an """Copy the build test files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources([join_path("test", "argparsing.h"), self.test_base_path]) cache_extra_test_sources(self, [join_path("test", "argparsing.h"), self.test_base_path])
def _build_and_run_test(self, test): def _build_and_run_test(self, test):
"""Build and run the test.""" """Build and run the test."""

View File

@@ -83,7 +83,7 @@ class RocmClangOcl(CMakePackage):
def cache_test_sources(self): def cache_test_sources(self):
"""Copy the tests source files after the package is installed to an """Copy the tests source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources([self.test_src_dir]) cache_extra_test_sources(self, [self.test_src_dir])
def test_make(self): def test_make(self):
"""Test make""" """Test make"""

View File

@@ -63,7 +63,7 @@ class RocmCmake(CMakePackage):
def cache_test_sources(self): def cache_test_sources(self):
"""Copy the tests source files after the package is installed to an """Copy the tests source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources([self.test_src_dir]) cache_extra_test_sources(self, [self.test_src_dir])
def test_cmake(self): def test_cmake(self):
"""Test cmake""" """Test cmake"""

View File

@@ -158,7 +158,7 @@ def cache_test_sources(self):
return return
"""Copy the example source files after the package is installed to an """Copy the example source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources(["examples"]) cache_extra_test_sources(self, ["examples"])
def mpi_launcher(self): def mpi_launcher(self):
searchpath = [self.spec["mpi"].prefix.bin] searchpath = [self.spec["mpi"].prefix.bin]

View File

@@ -208,7 +208,7 @@ def test_data_dir(self):
def cache_test_sources(self): def cache_test_sources(self):
"""Copy the example source files after the package is installed to an """Copy the example source files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources([self.test_data_dir, self.test_src_dir]) cache_extra_test_sources(self, [self.test_data_dir, self.test_src_dir])
def _test_example(self, test_prog, test_cmd, pre_args=[]): def _test_example(self, test_prog, test_cmd, pre_args=[]):
test_dir = join_path(self.test_suite.current_test_cache_dir, self.test_src_dir) test_dir = join_path(self.test_suite.current_test_cache_dir, self.test_src_dir)

View File

@@ -169,7 +169,7 @@ def flag_handler(self, name, flags):
def cache_test_sources(self): def cache_test_sources(self):
"""Copy the example matrices after the package is installed to an """Copy the example matrices after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources([self.examples_src_dir]) cache_extra_test_sources(self, [self.examples_src_dir])
def test_pddrive(self): def test_pddrive(self):
"""run cached pddrive""" """run cached pddrive"""

View File

@@ -116,7 +116,7 @@ def setup_standalone_tests(self):
filter_file(r"include \.\./" + filename, "include ./" + filename, makefile) filter_file(r"include \.\./" + filename, "include ./" + filename, makefile)
# Cache the examples directory for use by stand-alone tests # Cache the examples directory for use by stand-alone tests
self.pkg.cache_extra_test_sources(self.pkg.examples_src_dir) cache_extra_test_sources(self.pkg, self.pkg.examples_src_dir)
def _make_hdr_for_test(self, lib): def _make_hdr_for_test(self, lib):
"""Standard configure arguments for make.inc""" """Standard configure arguments for make.inc"""

View File

@@ -462,23 +462,23 @@ def setup_run_environment(self, env):
def setup_build_tests(self): def setup_build_tests(self):
"""Copy the build test files after the package is installed to an """Copy the build test files after the package is installed to an
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources(self.matmult_test) cache_extra_test_sources(self, self.matmult_test)
self.cache_extra_test_sources(self.makefile_test) cache_extra_test_sources(self, self.makefile_test)
self.cache_extra_test_sources(self.makefile_inc_test) cache_extra_test_sources(self, self.makefile_inc_test)
if "+dyninst" in self.spec: if "+dyninst" in self.spec:
self.cache_extra_test_sources(self.dyninst_test) cache_extra_test_sources(self, self.dyninst_test)
if "+cuda" in self.spec: if "+cuda" in self.spec:
self.cache_extra_test_sources(self.cuda_test) cache_extra_test_sources(self, self.cuda_test)
if "+level_zero" in self.spec: if "+level_zero" in self.spec:
self.cache_extra_test_sources(self.level_zero_test) cache_extra_test_sources(self, self.level_zero_test)
if "+rocm" in self.spec: if "+rocm" in self.spec:
self.cache_extra_test_sources(self.rocm_test) cache_extra_test_sources(self, self.rocm_test)
if "+syscall" in self.spec: if "+syscall" in self.spec:
self.cache_extra_test_sources(self.syscall_test) cache_extra_test_sources(self, self.syscall_test)
if "+ompt" in self.spec: if "+ompt" in self.spec:
self.cache_extra_test_sources(self.ompt_test) cache_extra_test_sources(self, self.ompt_test)
if "+python" in self.spec: if "+python" in self.spec:
self.cache_extra_test_sources(self.python_test) cache_extra_test_sources(self, self.python_test)
def _run_python_test(self, test_name, purpose, work_dir): def _run_python_test(self, test_name, purpose, work_dir):
tau_python = which(self.prefix.bin.tau_python) tau_python = which(self.prefix.bin.tau_python)