Caliper: Add E4S testsuite stand alone test (#25094)

This commit is contained in:
Richarda Butler 2021-08-04 10:22:50 -07:00 committed by GitHub
parent 5f3c25f6e9
commit b5c82aa986
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,7 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import sys import sys
from spack import * from spack import *
@ -21,6 +22,8 @@ class Caliper(CMakePackage, CudaPackage):
maintainers = ["daboehme"] maintainers = ["daboehme"]
test_requires_compiler = True
version('master', branch='master') version('master', branch='master')
version('2.6.0', sha256='6efcd3e4845cc9a6169e0d934840766b12182c6d09aa3ceca4ae776e23b6360f') version('2.6.0', sha256='6efcd3e4845cc9a6169e0d934840766b12182c6d09aa3ceca4ae776e23b6360f')
version('2.5.0', sha256='d553e60697d61c53de369b9ca464eb30710bda90fba9671201543b64eeac943c') version('2.5.0', sha256='d553e60697d61c53de369b9ca464eb30710bda90fba9671201543b64eeac943c')
@ -137,3 +140,35 @@ def cmake_args(self):
args.append('-DWITH_CUPTI=Off') args.append('-DWITH_CUPTI=Off')
return args 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()