diff options
author | Mark W. Krentel <krentel@rice.edu> | 2021-12-03 14:52:34 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-03 12:52:34 -0800 |
commit | 34c1d196a45cc0c81e929b834c6de03a31848bf8 (patch) | |
tree | 8632e185f1499152ff14769f62a6b279bc8b9b11 | |
parent | bd2b5cc7aabc672cf1e62878506321080a182aff (diff) | |
download | spack-34c1d196a45cc0c81e929b834c6de03a31848bf8.tar.gz spack-34c1d196a45cc0c81e929b834c6de03a31848bf8.tar.bz2 spack-34c1d196a45cc0c81e929b834c6de03a31848bf8.tar.xz spack-34c1d196a45cc0c81e929b834c6de03a31848bf8.zip |
hpctoolkit: add support for smoke tests (#27783)
This adds support in spack for both build/install tests (spack install
--run-tests) and post-install smoke tests (spack test run).
Hpctoolkit itself only recently added tests, so for now, this only
applies to branch master.
-rw-r--r-- | var/spack/repos/builtin/packages/hpctoolkit/package.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/hpctoolkit/package.py b/var/spack/repos/builtin/packages/hpctoolkit/package.py index 42eaf1aba9..f7d188932b 100644 --- a/var/spack/repos/builtin/packages/hpctoolkit/package.py +++ b/var/spack/repos/builtin/packages/hpctoolkit/package.py @@ -3,6 +3,8 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import llnl.util.tty as tty + from spack import * @@ -20,6 +22,8 @@ class Hpctoolkit(AutotoolsPackage): tags = ['e4s'] + test_requires_compiler = True + version('develop', branch='develop') version('master', branch='master') version('2021.10.15', commit='a8f289e4dc87ff98e05cfc105978c09eb2f5ea16') @@ -202,3 +206,36 @@ class Hpctoolkit(AutotoolsPackage): if '+viewer' in spec: env.prepend_path('PATH', spec['hpcviewer'].prefix.bin) env.prepend_path('MANPATH', spec['hpcviewer'].prefix.share.man) + + # Build tests (spack install --run-tests). Disable the default + # spack tests and run autotools 'make check', but only from the + # tests directory. + build_time_test_callbacks = [] + install_time_test_callbacks = [] + + @run_after('install') + @on_package_attributes(run_tests=True) + def check_install(self): + if self.spec.satisfies('@master'): + with working_dir('tests'): + make('check') + else: + tty.warn('spack test for hpctoolkit requires branch master') + + # Post-Install tests (spack test run). These are the same tests + # but with a different Makefile that works outside the build + # directory. + @run_after('install') + def copy_test_files(self): + if self.spec.satisfies('@master'): + self.cache_extra_test_sources(['tests']) + + def test(self): + test_dir = join_path(self.test_suite.current_test_cache_dir, 'tests') + if self.spec.satisfies('@master'): + with working_dir(test_dir): + make('-f', 'Makefile.spack', 'all') + self.run_test('./run-sort', status=[0], installed=False, + purpose='selection sort unit test') + else: + tty.warn('spack test for hpctoolkit requires branch master') |