summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Shudler <shudler1@llnl.gov>2021-02-01 17:49:20 -0800
committerGitHub <noreply@github.com>2021-02-01 17:49:20 -0800
commit8f2acc31237be225884c738c7c0e8446325b0dac (patch)
tree78e9056f1baff6d918d1d70e22a6bd8e05c634e5
parent71b12e9b270939312c3f95778948040c22ff8dbe (diff)
downloadspack-8f2acc31237be225884c738c7c0e8446325b0dac.tar.gz
spack-8f2acc31237be225884c738c7c0e8446325b0dac.tar.bz2
spack-8f2acc31237be225884c738c7c0e8446325b0dac.tar.xz
spack-8f2acc31237be225884c738c7c0e8446325b0dac.zip
mfem: Add e4s testsuite-inspired smoke test (#21228)
-rw-r--r--var/spack/repos/builtin/packages/mfem/package.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/mfem/package.py b/var/spack/repos/builtin/packages/mfem/package.py
index 8fbd6c73cf..3b4c31c4b4 100644
--- a/var/spack/repos/builtin/packages/mfem/package.py
+++ b/var/spack/repos/builtin/packages/mfem/package.py
@@ -19,6 +19,8 @@ class Mfem(Package):
maintainers = ['v-dobrev', 'tzanio', 'acfisher',
'goxberry', 'markcmiller86']
+ test_requires_compiler = True
+
# Recommended mfem builds to test when updating this file: see the shell
# script 'test_builds.sh' in the same directory as this file.
@@ -697,6 +699,32 @@ class Mfem(Package):
if install_em:
install_tree('data', join_path(prefix_share, 'data'))
+ examples_src_dir = 'examples'
+ examples_data_dir = 'data'
+
+ @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,
+ self.examples_data_dir])
+
+ def test(self):
+ test_dir = join_path(self.install_test_root, self.examples_src_dir)
+ with working_dir(test_dir, create=False):
+ # MFEM has many examples to serve as a suitable smoke check. ex10
+ # was chosen arbitrarily among the examples that work both with
+ # MPI and without it
+ test_exe = 'ex10p' if ('+mpi' in self.spec) else 'ex10'
+ make('CONFIG_MK={0}/share/mfem/config.mk'.format(self.prefix),
+ test_exe, parallel=False)
+ self.run_test('./{0}'.format(test_exe),
+ ['--mesh', '../{0}/beam-quad.mesh'.format(
+ self.examples_data_dir)],
+ [], installed=True, purpose='Smoke test for mfem',
+ skip_missing=False, work_dir='.')
+ make('clean')
+
# The files referenced in this patch method do not exist in stable
# versions earlier than 4.1.
@when('@4.1:')