From b64a7fe1ff72b0ceaa744241674bb7bf2126e7d2 Mon Sep 17 00:00:00 2001 From: Miroslav Stoyanov <30537612+mkstoyanov@users.noreply.github.com> Date: Thu, 14 Oct 2021 11:58:29 -0400 Subject: switch to the smoke testing included in heffte (#26720) --- var/spack/repos/builtin/packages/heffte/package.py | 63 ++++------------------ 1 file 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 /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') -- cgit v1.2.3-70-g09d2