Skip to content

Commit

Permalink
slate: changed stand-alone test from old to new API (spack#44953)
Browse files Browse the repository at this point in the history
* slate: changed from old to new format
* make code tighter
* replace assert method
* SkipTest plus other cleanup

---------

Co-authored-by: Tamara Dahlgren <[email protected]>
  • Loading branch information
AcriusWinter and tldahlgren authored Jul 16, 2024
1 parent 5c3a23a commit d85668f
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions var/spack/repos/builtin/packages/slate/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,25 +165,26 @@ def mpi_launcher(self):
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")

0 comments on commit d85668f

Please sign in to comment.