summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorAcriusWinter <152348900+AcriusWinter@users.noreply.github.com>2024-07-25 18:39:24 -0700
committerGitHub <noreply@github.com>2024-07-25 18:39:24 -0700
commit1e6bef079d1ee3b83c2ea04710dd1009feb3e529 (patch)
tree560b53fd4da79bb61c764fb608727d1ea5e28ed4 /var
parent564155fd1ac886377124f8b0651c01bf5574398f (diff)
downloadspack-1e6bef079d1ee3b83c2ea04710dd1009feb3e529.tar.gz
spack-1e6bef079d1ee3b83c2ea04710dd1009feb3e529.tar.bz2
spack-1e6bef079d1ee3b83c2ea04710dd1009feb3e529.tar.xz
spack-1e6bef079d1ee3b83c2ea04710dd1009feb3e529.zip
kokkos: new test API (#45010)
* kokkos: new test API * kokkos: added import llnl.util.lang as lang because earlier versions couldn't be installed without it --------- Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/kokkos/package.py56
1 files changed, 10 insertions, 46 deletions
diff --git a/var/spack/repos/builtin/packages/kokkos/package.py b/var/spack/repos/builtin/packages/kokkos/package.py
index 8b7efad300..f6fa1f6cb1 100644
--- a/var/spack/repos/builtin/packages/kokkos/package.py
+++ b/var/spack/repos/builtin/packages/kokkos/package.py
@@ -4,7 +4,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os.path
-from llnl.util import lang, tty
+import llnl.util.lang as lang
from spack.package import *
@@ -378,20 +378,6 @@ class Kokkos(CMakePackage, CudaPackage, ROCmPackage):
test_script_relative_path = join_path("scripts", "spack_test")
- # TODO: Replace this method and its 'get' use for cmake path with
- # join_path(self.spec['cmake'].prefix.bin, 'cmake') once stand-alone
- # tests can access build dependencies through self.spec['cmake'].
- def cmake_bin(self, set=True):
- """(Hack) Set/get cmake dependency path."""
- filepath = join_path(self.install_test_root, "cmake_bin_path.txt")
- if set:
- with open(filepath, "w") as out_file:
- cmake_bin = join_path(self.spec["cmake"].prefix.bin, "cmake")
- out_file.write("{0}\n".format(cmake_bin))
- elif os.path.isfile(filepath):
- with open(filepath, "r") as in_file:
- return in_file.read().strip()
-
@run_after("install")
def setup_build_tests(self):
# Skip if unsupported version
@@ -410,41 +396,19 @@ class Kokkos(CMakePackage, CudaPackage, ROCmPackage):
]
cmake(*cmake_args)
self.cache_extra_test_sources(cmake_out_path)
- self.cmake_bin(set=True)
-
- def build_tests(self, cmake_path):
- """Build test."""
- cmake_bin = self.cmake_bin(set=False)
-
- if not cmake_bin:
- tty.msg("Skipping kokkos test: cmake_bin_path.txt not found")
- return
-
- cmake_args = [cmake_path, "-DEXECUTABLE_OUTPUT_PATH=" + cmake_path]
-
- if not self.run_test(cmake_bin, options=cmake_args, purpose="Generate the Makefile"):
- tty.warn("Skipping kokkos test: failed to generate Makefile")
- return
- if not self.run_test("make", purpose="Build test software"):
- tty.warn("Skipping kokkos test: failed to build test")
-
- def run_tests(self, cmake_path):
- """Run test."""
- if not self.run_test(
- "make", options=[cmake_path, "test"], purpose="Checking ability to execute."
- ):
- tty.warn("Failed to run kokkos test")
-
- def test(self):
- # Skip if unsupported version
+ def test_run(self):
+ """Test if kokkos builds and runs"""
cmake_path = join_path(
self.test_suite.current_test_cache_dir, self.test_script_relative_path, "out"
)
if not os.path.exists(cmake_path):
- tty.warn("Skipping smoke tests: {0} is missing".format(cmake_path))
- return
+ raise SkipTest(f"{cmake_path} is missing")
+
+ cmake = self.spec["cmake"].command
+ cmake(cmake_path, "-DEXECUTABLE_OUTPUT_PATH=" + cmake_path)
- self.build_tests(cmake_path)
- self.run_tests(cmake_path)
+ make = which("make")
+ make()
+ make(cmake_path, "test")