summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorAxel Huebl <axel.huebl@plasma.ninja>2021-08-06 16:55:32 -0700
committerGitHub <noreply@github.com>2021-08-06 16:55:32 -0700
commit98d4a7af24e3e69ee1dabce6f2a9ae94e01f166a (patch)
tree96e46fa2fd46820ee7946a8195dfb2e2a84ef85e /var
parent91b3dcca26f60688adcb2598d8700b297af30999 (diff)
downloadspack-98d4a7af24e3e69ee1dabce6f2a9ae94e01f166a.tar.gz
spack-98d4a7af24e3e69ee1dabce6f2a9ae94e01f166a.tar.bz2
spack-98d4a7af24e3e69ee1dabce6f2a9ae94e01f166a.tar.xz
spack-98d4a7af24e3e69ee1dabce6f2a9ae94e01f166a.zip
openPMD-api: CTest & Install Tests (#25300)
Run CTest at build time with: ``` spack install --test=root openpmd-api@<version> ``` and run smoke-tests after install and loading of the package via ``` spack load -r /<spec> spack test run /<spec> ```
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/openpmd-api/package.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/openpmd-api/package.py b/var/spack/repos/builtin/packages/openpmd-api/package.py
index 36b86182fa..1b85c85a12 100644
--- a/var/spack/repos/builtin/packages/openpmd-api/package.py
+++ b/var/spack/repos/builtin/packages/openpmd-api/package.py
@@ -130,3 +130,23 @@ class OpenpmdApi(CMakePackage):
env.prepend_path('CMAKE_PREFIX_PATH',
self.spec['mpark-variant'].prefix)
env.prepend_path('CPATH', self.spec['mpark-variant'].prefix.include)
+
+ def check(self):
+ """CTest checks after the build phase"""
+ # note: for MPI-parallel tests, you can overwrite the standard CMake
+ # option -DMPIEXEC_EXECUTABLE=$(which jsrun) for jsrun or srun,
+ # etc.. Alternatively, you can also use -E <regex> to exclude
+ # parallel and MPI tests
+ with working_dir(self.build_directory):
+ # -j1 because individual tests create files that are read again by
+ # later tests
+ ctest('--output-on-failure', '-j1')
+
+ def test(self):
+ """Perform smoke tests on the installed package."""
+ exes = ['openpmd-ls'] # in 0.11.1+
+ for exe in exes:
+ spec_vers_str = '{0}'.format(self.spec.version)
+ reason = 'test version of {0} is {1}'.format(exe, spec_vers_str)
+ self.run_test(exe, ['--version'], [spec_vers_str],
+ installed=True, purpose=reason, skip_missing=False)