From 8f2acc31237be225884c738c7c0e8446325b0dac Mon Sep 17 00:00:00 2001 From: Sergei Shudler Date: Mon, 1 Feb 2021 17:49:20 -0800 Subject: mfem: Add e4s testsuite-inspired smoke test (#21228) --- var/spack/repos/builtin/packages/mfem/package.py | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'var') 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:') -- cgit v1.2.3-70-g09d2