mfem: Add e4s testsuite-inspired smoke test (#21228)

This commit is contained in:
Sergei Shudler 2021-02-01 17:49:20 -08:00 committed by GitHub
parent 71b12e9b27
commit 8f2acc3123
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 @@ def install(self, spec, prefix):
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:')