summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/arborx/package.py
diff options
context:
space:
mode:
authorDaniel Arndt <arndtd@ornl.gov>2021-03-19 08:39:06 -0400
committerGitHub <noreply@github.com>2021-03-19 12:39:06 +0000
commit245d67ed5cedb22a7e3ccfafde51133a7ac695f8 (patch)
treefcb527bede0dbdb0efd219522a4be55273121dde /var/spack/repos/builtin/packages/arborx/package.py
parent020c60649ec170dc66a22978f27b94e8fadd9ae2 (diff)
downloadspack-245d67ed5cedb22a7e3ccfafde51133a7ac695f8.tar.gz
spack-245d67ed5cedb22a7e3ccfafde51133a7ac695f8.tar.bz2
spack-245d67ed5cedb22a7e3ccfafde51133a7ac695f8.tar.xz
spack-245d67ed5cedb22a7e3ccfafde51133a7ac695f8.zip
Add ArborX smoke tests (#22356)
Diffstat (limited to 'var/spack/repos/builtin/packages/arborx/package.py')
-rw-r--r--var/spack/repos/builtin/packages/arborx/package.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/arborx/package.py b/var/spack/repos/builtin/packages/arborx/package.py
index bc973e68da..93cc206f66 100644
--- a/var/spack/repos/builtin/packages/arborx/package.py
+++ b/var/spack/repos/builtin/packages/arborx/package.py
@@ -69,3 +69,42 @@ class Arborx(CMakePackage):
'-DCMAKE_CXX_COMPILER=%s' % spec["kokkos"].kokkos_cxx)
return options
+
+ examples_src_dir = "examples"
+
+ @run_after('install')
+ def setup_build_tests(self):
+ """Copy the example source files after the package is installed to an
+ install test subdirectory for use during `spack test run`."""
+ self.cache_extra_test_sources([self.examples_src_dir])
+
+ def build_tests(self):
+ """Build test."""
+ cmake_build_path = join_path(self.install_test_root,
+ self.examples_src_dir, "build")
+ mkdirp(cmake_build_path)
+ cmake_prefix_path = "-DCMAKE_PREFIX_PATH={0}".format(self.spec['arborx'].prefix)
+
+ # We don't need to append the path to Kokkos to CMAKE_PREFIX_PATH
+ # since a hint is already hardcoded inside the CMake ArborX configuration.
+ # Omitting it here allows us to avoid to distinguish between Kokkos
+ # being installed as a standalone or as part of Trilinos.
+ if '+mpi' in self.spec:
+ cmake_prefix_path += ";{0}".format(self.spec['mpi'].prefix)
+ with working_dir(cmake_build_path):
+ cmake_args = ["..",
+ cmake_prefix_path,
+ "-DCMAKE_CXX_COMPILER={0}".format(self.compiler.cxx)]
+ cmake(*cmake_args)
+ make()
+
+ def run_tests(self):
+ """Run test."""
+ reason = 'Checking ability to execute.'
+ run_path = join_path(self.install_test_root, self.examples_src_dir, 'build')
+ with working_dir(run_path):
+ self.run_test('ctest', ['-V'], [], installed=False, purpose=reason)
+
+ def test(self):
+ self.build_tests()
+ self.run_tests()