summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/hpctoolkit/package.py
diff options
context:
space:
mode:
Diffstat (limited to 'var/spack/repos/builtin/packages/hpctoolkit/package.py')
-rw-r--r--var/spack/repos/builtin/packages/hpctoolkit/package.py37
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')