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.
This commit is contained in:
parent
bd2b5cc7aa
commit
34c1d196a4
@ -3,6 +3,8 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
|
import llnl.util.tty as tty
|
||||||
|
|
||||||
from spack import *
|
from spack import *
|
||||||
|
|
||||||
|
|
||||||
@ -20,6 +22,8 @@ class Hpctoolkit(AutotoolsPackage):
|
|||||||
|
|
||||||
tags = ['e4s']
|
tags = ['e4s']
|
||||||
|
|
||||||
|
test_requires_compiler = True
|
||||||
|
|
||||||
version('develop', branch='develop')
|
version('develop', branch='develop')
|
||||||
version('master', branch='master')
|
version('master', branch='master')
|
||||||
version('2021.10.15', commit='a8f289e4dc87ff98e05cfc105978c09eb2f5ea16')
|
version('2021.10.15', commit='a8f289e4dc87ff98e05cfc105978c09eb2f5ea16')
|
||||||
@ -202,3 +206,36 @@ def setup_run_environment(self, env):
|
|||||||
if '+viewer' in spec:
|
if '+viewer' in spec:
|
||||||
env.prepend_path('PATH', spec['hpcviewer'].prefix.bin)
|
env.prepend_path('PATH', spec['hpcviewer'].prefix.bin)
|
||||||
env.prepend_path('MANPATH', spec['hpcviewer'].prefix.share.man)
|
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')
|
||||||
|
Loading…
Reference in New Issue
Block a user