summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorErik <epalmer@lbl.gov>2022-01-13 12:43:43 -0500
committerGitHub <noreply@github.com>2022-01-13 17:43:43 +0000
commiteda565f3b12236096cd9cd7a933fff1b19dfaf38 (patch)
tree706202ab463fdf83e449c7e91d81e934b422b81d /var
parent1ea4497802dde0ac63ec9aa95ea4d601331b7e2e (diff)
downloadspack-eda565f3b12236096cd9cd7a933fff1b19dfaf38.tar.gz
spack-eda565f3b12236096cd9cd7a933fff1b19dfaf38.tar.bz2
spack-eda565f3b12236096cd9cd7a933fff1b19dfaf38.tar.xz
spack-eda565f3b12236096cd9cd7a933fff1b19dfaf38.zip
AMReX Smoke Test (#27411)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/amrex/package.py56
1 files changed, 56 insertions, 0 deletions
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)