Update/caliper stand alone test compiler (#28526)

This commit is contained in:
Richarda Butler 2022-02-11 15:02:40 -08:00 committed by GitHub
parent dc949a5bda
commit af4d555c20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -154,30 +154,36 @@ def cache_test_sources(self):
def run_cxx_example_test(self): def run_cxx_example_test(self):
"""Run stand alone test: cxx_example""" """Run stand alone test: cxx_example"""
test_dir = join_path(self.test_suite.current_test_cache_dir, 'examples', 'apps') test_dir = self.test_suite.current_test_cache_dir.examples.apps
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' exe = 'cxx-example'
source_file = 'cxx-example.cpp'
if not os.path.isfile(join_path(test_dir, source_file)):
tty.warn('Skipping caliper test:'
'{0} does not exist'.format(source_file))
return
if os.path.exists(self.prefix.lib): if os.path.exists(self.prefix.lib):
lib_dir = self.prefix.lib lib_dir = self.prefix.lib
else: else:
lib_dir = self.prefix.lib64 lib_dir = self.prefix.lib64
self.run_test(exe='gcc', options = ['-L{0}'.format(lib_dir),
options=['{0}'.format(join_path(test_dir, 'cxx-example.cpp')), '-I{0}'.format(self.prefix.include),
'-L{0}'.format(lib_dir), '{0}'.format(join_path(test_dir, source_file)),
'-I{0}'.format(self.prefix.include), '-o', exe, '-std=c++11', '-lcaliper', '-lstdc++']
'-std=c++11', '-lcaliper', '-lstdc++', '-o', exe],
purpose='test: compile {0} example'.format(exe),
work_dir=test_dir)
self.run_test(exe, if not self.run_test(exe=os.environ['CXX'],
purpose='test: run {0} example'.format(exe), options=options,
work_dir=test_dir) purpose='test: compile {0} example'.format(exe),
work_dir=test_dir):
tty.warn('Skipping caliper test: failed to compile example')
return
if not self.run_test(exe,
purpose='test: run {0} example'.format(exe),
work_dir=test_dir):
tty.warn('Skipping caliper test: failed to run example')
def test(self): def test(self):
self.run_cxx_example_test() self.run_cxx_example_test()