From eda565f3b12236096cd9cd7a933fff1b19dfaf38 Mon Sep 17 00:00:00 2001 From: Erik Date: Thu, 13 Jan 2022 12:43:43 -0500 Subject: AMReX Smoke Test (#27411) --- var/spack/repos/builtin/packages/amrex/package.py | 56 +++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/var/spack/repos/builtin/packages/amrex/package.py b/var/spack/repos/builtin/packages/amrex/package.py index c71994080e..7a6bc7bd39 100644 --- a/var/spack/repos/builtin/packages/amrex/package.py +++ b/var/spack/repos/builtin/packages/amrex/package.py @@ -15,6 +15,8 @@ class Amrex(CMakePackage, CudaPackage, ROCmPackage): url = "https://github.com/AMReX-Codes/amrex/releases/download/22.01/amrex-22.01.tar.gz" git = "https://github.com/AMReX-Codes/amrex.git" + test_requires_compiler = True + tags = ['ecp', 'e4s'] maintainers = ['WeiqunZhang', 'asalmgren'] @@ -244,3 +246,57 @@ class Amrex(CMakePackage, CudaPackage, ROCmPackage): args.append('-DCUDA_ARCH=' + self.get_cuda_arch_string(cuda_arch)) return args + + # TODO: Replace this method and its 'get' use for cmake path with + # join_path(self.spec['cmake'].prefix.bin, 'cmake') once stand-alone + # tests can access build dependencies through self.spec['cmake']. + def cmake_bin(self, set=True): + """(Hack) Set/get cmake dependency path.""" + filepath = join_path(self.install_test_root, 'cmake_bin_path.txt') + if set: + with open(filepath, 'w') as out_file: + cmake_bin = join_path(self.spec['cmake'].prefix.bin, 'cmake') + out_file.write('{0}\n'.format(cmake_bin)) + else: + with open(filepath, 'r') as in_file: + return in_file.read().strip() + + @run_after('build') + def setup_smoke_test(self): + """Skip setup smoke tests for AMReX versions less than 21.12.""" + if self.spec.satisfies('@:21.11'): + return + + self.cache_extra_test_sources(['Tests']) + + # TODO: Remove once self.spec['cmake'] is available here + self.cmake_bin(set=True) + + def test(self): + """Skip smoke tests for AMReX versions less than 21.12.""" + if self.spec.satisfies('@:21.11'): + print("SKIPPED: Stand-alone tests not supported for this version of AMReX.") + return + + """Perform smoke tests on installed package.""" + # TODO: Remove/replace once self.spec['cmake'] is available here + cmake_bin = self.cmake_bin(set=False) + + args = [] + args.append('-S./cache/amrex/Tests/SpackSmokeTest') + args.append('-DAMReX_ROOT=' + self.prefix) + args.append('-DMPI_C_COMPILER=' + self.spec['mpi'].mpicc) + args.append('-DMPI_CXX_COMPILER=' + self.spec['mpi'].mpicxx) + args.extend(self.cmake_args()) + self.run_test(cmake_bin, + args, + purpose='Build with same CMake version as install') + + make() + + self.run_test('install_test', + ['./cache/amrex/Tests/Amr/Advection_AmrCore/Exec/inputs-ci'], + ['finalized'], + installed=False, + purpose='AMReX Stand-Alone Smoke Test -- AmrCore', + skip_missing=False) -- cgit v1.2.3-70-g09d2