summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/heffte/package.py63
1 files changed, 9 insertions, 54 deletions
diff --git a/var/spack/repos/builtin/packages/heffte/package.py b/var/spack/repos/builtin/packages/heffte/package.py
index 13fe2ec2ee..7565ec8702 100644
--- a/var/spack/repos/builtin/packages/heffte/package.py
+++ b/var/spack/repos/builtin/packages/heffte/package.py
@@ -28,6 +28,8 @@ class Heffte(CMakePackage, CudaPackage, ROCmPackage):
patch('threads10.patch', when='@1.0')
patch('fortran200.patch', when='@2.0.0')
+ depends_on('cmake@3.10:', type=('build', 'run'))
+
variant('shared', default=True, description='Builds with shared libraries')
variant('fftw', default=False, description='Builds with support for FFTW backend')
variant('mkl', default=False, description='Builds with support for MKL backend')
@@ -97,59 +99,12 @@ class Heffte(CMakePackage, CudaPackage, ROCmPackage):
return args
- @run_after('install')
- def cache_test_sources(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 test(self):
- cmake_file = join_path(self.install_test_root, 'CMakeLists.txt')
- test_bld_dir = join_path(self.install_test_root, '_build')
- exe_files = []
- mpi_procs = []
-
- with open(cmake_file, 'w') as cmkf:
- cmkf.write('cmake_minimum_required(VERSION 3.13)\n\n')
- cmkf.write('project(heffte_example LANGUAGES CXX)\n\n')
- cmkf.write('find_package(Heffte REQUIRED)\n\n')
- if '+fftw' in self.spec:
- src_file = '{0}/heffte_example_fftw.cpp'.format(
- self.examples_src_dir)
- cmkf.write(
- 'add_executable(hf_fftw {0})\n'.format(src_file))
- cmkf.write(
- 'target_link_libraries(hf_fftw Heffte::Heffte)\n')
- exe_files.append('./hf_fftw')
- mpi_procs.append(4)
- if '+cuda' in self.spec:
- src_file = '{0}/heffte_example_cuda.cpp'.format(
- self.examples_src_dir)
- cmkf.write(
- 'add_executable(hf_cuda {0})\n'.format(src_file))
- cmkf.write(
- 'target_link_libraries(hf_cuda Heffte::Heffte)\n')
- exe_files.append('./hf_cuda')
- mpi_procs.append(4)
- if '+fortran' in self.spec:
- src_file = '{0}/heffte_example_fftw.f90'.format(
- self.examples_src_dir)
- cmkf.write(
- 'add_executable(hf_fort {0})\n'.format(src_file))
- cmkf.write(
- 'target_link_libraries(hf_fort Heffte::Fortran)\n')
- exe_files.append('./hf_fort')
- mpi_procs.append(2)
-
- with working_dir(test_bld_dir, create=True):
- cmake('..')
+ # using the tests installed in <prefix>/share/heffte/testing
+ cmake_dir = join_path(self.prefix, 'share', 'heffte', 'testing')
+ test_dir = join_path(self.test_suite.current_test_cache_dir,
+ 'test_install')
+ with working_dir(test_dir, create=True):
+ cmake(cmake_dir)
make()
- test_args = ['-n', '4', ' ']
- mpiexe_f = which('srun', 'mpirun', 'mpiexec')
- if mpiexe_f:
- for exf, procs in zip(exe_files, mpi_procs):
- test_args[-1] = exf
- test_args[-2] = str(procs)
- reason_str = 'Heffte smoke test, exe: {0}'.format(exf)
- self.run_test(mpiexe_f.command, test_args,
- purpose=reason_str)
+ make('test')