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.
This commit is contained in:
parent
c1b51d6e99
commit
500e05ee50
@ -32,6 +32,9 @@ class Slate(CMakePackage, CudaPackage, ROCmPackage):
|
|||||||
variant('openmp', default=True, description='Build with OpenMP support.')
|
variant('openmp', default=True, description='Build with OpenMP support.')
|
||||||
variant('shared', default=True, description='Build shared library')
|
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('mpi', when='+mpi')
|
||||||
depends_on('blas')
|
depends_on('blas')
|
||||||
depends_on('blaspp ~cuda', when='~cuda')
|
depends_on('blaspp ~cuda', when='~cuda')
|
||||||
@ -72,28 +75,32 @@ def cmake_args(self):
|
|||||||
'-DSCALAPACK_LIBRARIES=%s' % spec['scalapack'].libs.joined(';')
|
'-DSCALAPACK_LIBRARIES=%s' % spec['scalapack'].libs.joined(';')
|
||||||
]
|
]
|
||||||
|
|
||||||
examples_src_dir = 'examples'
|
|
||||||
|
|
||||||
@run_after('install')
|
@run_after('install')
|
||||||
def cache_test_sources(self):
|
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
|
"""Copy the example source files after the package is installed to an
|
||||||
install test subdirectory for use during `spack test run`."""
|
install test subdirectory for use during `spack test run`."""
|
||||||
if self.spec.satisfies('@master'):
|
self.cache_extra_test_sources(['examples'])
|
||||||
self.cache_extra_test_sources([self.examples_src_dir])
|
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
if not self.spec.satisfies('@master') or '+mpi' not in self.spec:
|
if self.spec.satisfies('@2020.10.00') or '+mpi' not in self.spec:
|
||||||
print('Skipping: stand-alone tests only run on master with +mpi')
|
print('Skipping: stand-alone tests')
|
||||||
return
|
return
|
||||||
|
|
||||||
test_dir = join_path(self.install_test_root, self.examples_src_dir)
|
test_dir = join_path(self.test_suite.current_test_cache_dir,
|
||||||
test_bld_dir = join_path(test_dir, 'build')
|
'examples', 'build')
|
||||||
with working_dir(test_bld_dir, create=True):
|
with working_dir(test_dir, create=True):
|
||||||
cmake('..')
|
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()
|
make()
|
||||||
test_args = ['-n', '4', './ex05_blas']
|
test_args = ['-n', '4', './ex05_blas']
|
||||||
mpiexe_f = which('srun', 'mpirun', 'mpiexec')
|
mpi_path = self.spec['mpi'].prefix.bin
|
||||||
if mpiexe_f:
|
mpiexe_f = which('srun', 'mpirun', 'mpiexec', path=mpi_path)
|
||||||
self.run_test(mpiexe_f.command, test_args,
|
self.run_test(mpiexe_f.command, test_args,
|
||||||
purpose='SLATE smoke test')
|
purpose='SLATE smoke test')
|
||||||
make('clean')
|
make('clean')
|
||||||
|
Loading…
Reference in New Issue
Block a user