From d85668f096872c406e5e03064551c66110bc7f42 Mon Sep 17 00:00:00 2001 From: AcriusWinter <152348900+AcriusWinter@users.noreply.github.com> Date: Mon, 15 Jul 2024 20:10:50 -0700 Subject: slate: changed stand-alone test from old to new API (#44953) * slate: changed from old to new format * make code tighter * replace assert method * SkipTest plus other cleanup --------- Co-authored-by: Tamara Dahlgren --- var/spack/repos/builtin/packages/slate/package.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/var/spack/repos/builtin/packages/slate/package.py b/var/spack/repos/builtin/packages/slate/package.py index 4a04e4af96..80f5a98097 100644 --- a/var/spack/repos/builtin/packages/slate/package.py +++ b/var/spack/repos/builtin/packages/slate/package.py @@ -165,25 +165,26 @@ class Slate(CMakePackage, CudaPackage, ROCmPackage): commands = ["srun", "mpirun", "mpiexec"] return which(*commands, path=searchpath) or which(*commands) - def test(self): + def test_example(self): + """build and run slate example""" + if self.spec.satisfies("@2020.10.00") or "+mpi" not in self.spec: - print("Skipping: stand-alone tests") - return + raise SkipTest("Package must be installed with +mpi and version @2021.05.01 or later") test_dir = join_path(self.test_suite.current_test_cache_dir, "examples", "build") with working_dir(test_dir, create=True): - cmake_bin = join_path(self.spec["cmake"].prefix.bin, "cmake") + cmake = self.spec["cmake"].command + # This package must directly depend on all packages listed here. # Otherwise, it will not work when some packages are external to spack. deps = "slate blaspp lapackpp mpi" if self.spec.satisfies("+rocm"): deps += " rocblas hip llvm-amdgpu comgr hsa-rocr-dev rocsolver " prefixes = ";".join([self.spec[x].prefix for x in deps.split()]) - self.run_test(cmake_bin, ["-DCMAKE_PREFIX_PATH=" + prefixes, ".."]) + + cmake("-DCMAKE_PREFIX_PATH=" + prefixes, "..") + make = which("make") make() - test_args = ["-n", "4", "./ex05_blas"] launcher = self.mpi_launcher() - if not launcher: - raise RuntimeError("Cannot run tests due to absence of MPI launcher") - self.run_test(launcher.command, test_args, purpose="SLATE smoke test") - make("clean") + assert launcher is not None, "Cannot run tests due to absence of MPI launcher" + launcher("-n", "4", "./ex05_blas") -- cgit v1.2.3-70-g09d2