diff options
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/caliper/package.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/caliper/package.py b/var/spack/repos/builtin/packages/caliper/package.py index ec47b873c8..b424c0e693 100644 --- a/var/spack/repos/builtin/packages/caliper/package.py +++ b/var/spack/repos/builtin/packages/caliper/package.py @@ -3,6 +3,7 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import os import sys from spack import * @@ -21,6 +22,8 @@ class Caliper(CMakePackage, CudaPackage): maintainers = ["daboehme"] + test_requires_compiler = True + version('master', branch='master') version('2.6.0', sha256='6efcd3e4845cc9a6169e0d934840766b12182c6d09aa3ceca4ae776e23b6360f') version('2.5.0', sha256='d553e60697d61c53de369b9ca464eb30710bda90fba9671201543b64eeac943c') @@ -137,3 +140,35 @@ class Caliper(CMakePackage, CudaPackage): args.append('-DWITH_CUPTI=Off') return args + + @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([join_path('examples', 'apps')]) + + def run_cxx_example_test(self): + """Run stand alone test: cxx_example""" + + test_dir = join_path(self.test_suite.current_test_cache_dir, 'examples', 'apps') + + if not os.path.exists(test_dir): + print('Skipping caliper test') + return + + exe = 'cxx-example' + + self.run_test(exe='gcc', + options=['{0}'.format(join_path(test_dir, 'cxx-example.cpp')), + '-L{0}'.format(join_path(self.prefix, 'lib64')), + '-I{0}'.format(join_path(self.prefix, 'include')), + '-std=c++11', '-lcaliper', '-lstdc++', '-o', exe], + purpose='test: compile {0} example'.format(exe), + work_dir=test_dir) + + self.run_test(exe, + purpose='test: run {0} example'.format(exe), + work_dir=test_dir) + + def test(self): + self.run_cxx_example_test() |