summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorRicharda Butler <39577672+RikkiButler20@users.noreply.github.com>2021-08-04 10:22:50 -0700
committerGitHub <noreply@github.com>2021-08-04 10:22:50 -0700
commitb5c82aa986a5446605eb9480b3a838610da90d7e (patch)
treee5c8879d1ac6cb61b1d21dc0d7324db39245a7e8 /var
parent5f3c25f6e938c1f94761ca3d71be0bf26404e6a1 (diff)
downloadspack-b5c82aa986a5446605eb9480b3a838610da90d7e.tar.gz
spack-b5c82aa986a5446605eb9480b3a838610da90d7e.tar.bz2
spack-b5c82aa986a5446605eb9480b3a838610da90d7e.tar.xz
spack-b5c82aa986a5446605eb9480b3a838610da90d7e.zip
Caliper: Add E4S testsuite stand alone test (#25094)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/caliper/package.py35
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()