summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorG-Ragghianti <33492707+G-Ragghianti@users.noreply.github.com>2022-02-08 13:30:57 -0500
committerGitHub <noreply@github.com>2022-02-08 10:30:57 -0800
commit500e05ee50255d65d9a92bde7f6b4a49d252ce2a (patch)
tree907549a430a185ff515bb872b70774a4372ea62e
parentc1b51d6e997667120f31b27efbf9d5c99e540566 (diff)
downloadspack-500e05ee50255d65d9a92bde7f6b4a49d252ce2a.tar.gz
spack-500e05ee50255d65d9a92bde7f6b4a49d252ce2a.tar.bz2
spack-500e05ee50255d65d9a92bde7f6b4a49d252ce2a.tar.xz
spack-500e05ee50255d65d9a92bde7f6b4a49d252ce2a.zip
SLATE package: tests (#28723)
This improves the stand-alone tests for slate by providing most of the dependencies to the test framework and enabling stand-alone tests on all versions except the oldest.
-rw-r--r--var/spack/repos/builtin/packages/slate/package.py35
1 files changed, 21 insertions, 14 deletions
diff --git a/var/spack/repos/builtin/packages/slate/package.py b/var/spack/repos/builtin/packages/slate/package.py
index a7e02fbec5..051c6287f6 100644
--- a/var/spack/repos/builtin/packages/slate/package.py
+++ b/var/spack/repos/builtin/packages/slate/package.py
@@ -32,6 +32,9 @@ class Slate(CMakePackage, CudaPackage, ROCmPackage):
variant('openmp', default=True, description='Build with OpenMP support.')
variant('shared', default=True, description='Build shared library')
+ # The runtime dependency on cmake is needed by the stand-alone tests (spack test).
+ depends_on('cmake', type='run')
+
depends_on('mpi', when='+mpi')
depends_on('blas')
depends_on('blaspp ~cuda', when='~cuda')
@@ -72,28 +75,32 @@ class Slate(CMakePackage, CudaPackage, ROCmPackage):
'-DSCALAPACK_LIBRARIES=%s' % spec['scalapack'].libs.joined(';')
]
- examples_src_dir = 'examples'
-
@run_after('install')
def cache_test_sources(self):
+ if self.spec.satisfies('@2020.10.00'):
+ return
"""Copy the example source files after the package is installed to an
install test subdirectory for use during `spack test run`."""
- if self.spec.satisfies('@master'):
- self.cache_extra_test_sources([self.examples_src_dir])
+ self.cache_extra_test_sources(['examples'])
def test(self):
- if not self.spec.satisfies('@master') or '+mpi' not in self.spec:
- print('Skipping: stand-alone tests only run on master with +mpi')
+ if self.spec.satisfies('@2020.10.00') or '+mpi' not in self.spec:
+ print('Skipping: stand-alone tests')
return
- test_dir = join_path(self.install_test_root, self.examples_src_dir)
- test_bld_dir = join_path(test_dir, 'build')
- with working_dir(test_bld_dir, create=True):
- cmake('..')
+ 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')
+ prefixes = ';'.join([self.spec['blaspp'].prefix,
+ self.spec['lapackpp'].prefix,
+ self.spec['mpi'].prefix,
+ ])
+ self.run_test(cmake_bin, ['-DCMAKE_PREFIX_PATH=' + prefixes, '..'])
make()
test_args = ['-n', '4', './ex05_blas']
- mpiexe_f = which('srun', 'mpirun', 'mpiexec')
- if mpiexe_f:
- self.run_test(mpiexe_f.command, test_args,
- purpose='SLATE smoke test')
+ mpi_path = self.spec['mpi'].prefix.bin
+ mpiexe_f = which('srun', 'mpirun', 'mpiexec', path=mpi_path)
+ self.run_test(mpiexe_f.command, test_args,
+ purpose='SLATE smoke test')
make('clean')