Update stand-alone tests to use test stage work directory; also added expected ctest output (#24191)

This commit is contained in:
Tamara Dahlgren 2021-06-08 02:31:40 -07:00 committed by GitHub
parent 418db4e910
commit 11fd88ee3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,6 +77,12 @@ def cmake_args(self):
examples_src_dir = 'example/test-installation'
@property
def cached_tests_work_dir(self):
"""The working directory for cached test sources."""
return join_path(self.test_suite.current_test_cache_dir,
self.examples_src_dir)
@run_after('install')
def setup_smoke_tests(self):
"""Copy the example source files after the package is installed to an
@ -84,17 +90,22 @@ def setup_smoke_tests(self):
self.cache_extra_test_sources([self.examples_src_dir])
def test(self):
example_src_dir = join_path(self.install_test_root,
self.examples_src_dir)
test_build_dir = join_path(self.test_suite.stage,
'build_example')
with working_dir(test_build_dir, create=True):
cmake(
"""Perform stand-alone/smoke tests using installed package."""
cmake_args = [
self.define('CMAKE_PREFIX_PATH', self.prefix),
self.define('CMAKE_CXX_COMPILER', self.compiler.cxx),
self.define('CMAKE_Fortran_COMPILER', self.compiler.fc),
example_src_dir
)
make()
self.run_test('ctest', ['-V'], [], installed=False,
purpose='test: installation')
self.cached_tests_work_dir
]
self.run_test("cmake", cmake_args,
purpose="test: calling cmake",
work_dir=self.cached_tests_work_dir)
self.run_test("make", [],
purpose="test: calling make",
work_dir=self.cached_tests_work_dir)
self.run_test('ctest', ['-V'],
['100% tests passed'], installed=False,
purpose='test: testing the installation',
work_dir=self.cached_tests_work_dir)