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' 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') @run_after('install')
def setup_smoke_tests(self): def setup_smoke_tests(self):
"""Copy the example source files after the package is installed to an """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]) self.cache_extra_test_sources([self.examples_src_dir])
def test(self): def test(self):
example_src_dir = join_path(self.install_test_root, """Perform stand-alone/smoke tests using installed package."""
self.examples_src_dir) cmake_args = [
test_build_dir = join_path(self.test_suite.stage, self.define('CMAKE_PREFIX_PATH', self.prefix),
'build_example') self.define('CMAKE_CXX_COMPILER', self.compiler.cxx),
with working_dir(test_build_dir, create=True): self.define('CMAKE_Fortran_COMPILER', self.compiler.fc),
cmake( self.cached_tests_work_dir
self.define('CMAKE_PREFIX_PATH', self.prefix), ]
self.define('CMAKE_CXX_COMPILER', self.compiler.cxx), self.run_test("cmake", cmake_args,
self.define('CMAKE_Fortran_COMPILER', self.compiler.fc), purpose="test: calling cmake",
example_src_dir work_dir=self.cached_tests_work_dir)
)
make() self.run_test("make", [],
self.run_test('ctest', ['-V'], [], installed=False, purpose="test: calling make",
purpose='test: installation') 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)