caliper: fix stand alone test (#28390)

This commit is contained in:
Richarda Butler 2022-01-19 02:59:46 -08:00 committed by GitHub
parent d853e2db57
commit 7fb11ea84f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,8 @@
import os
import sys
from llnl.util import tty
from spack import *
@ -154,16 +156,21 @@ def run_cxx_example_test(self):
test_dir = join_path(self.test_suite.current_test_cache_dir, 'examples', 'apps')
if not os.path.exists(test_dir):
print('Skipping caliper test')
if not os.path.isfile(join_path(test_dir, 'cxx-example.cpp')):
tty.msg('Skipping caliper test: file does not exist')
return
exe = 'cxx-example'
if os.path.exists(self.prefix.lib):
lib_dir = self.prefix.lib
else:
lib_dir = self.prefix.lib64
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')),
'-L{0}'.format(lib_dir),
'-I{0}'.format(self.prefix.include),
'-std=c++11', '-lcaliper', '-lstdc++', '-o', exe],
purpose='test: compile {0} example'.format(exe),
work_dir=test_dir)