Update stand-alone tests to use test stage work directory (#24130)

This commit is contained in:
Tamara Dahlgren 2021-06-04 04:28:03 -07:00 committed by GitHub
parent d5d1d9548f
commit a0259cc4f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,20 +61,28 @@ def setup_smoke_tests(self):
install test subdirectory for use during `spack test run`.""" install test subdirectory for use during `spack test run`."""
self.cache_extra_test_sources([self.examples_src_dir]) self.cache_extra_test_sources([self.examples_src_dir])
def test(self): @property
example_src_dir = join_path(self.install_test_root, 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) self.examples_src_dir)
test_build_dir = join_path(self.test_suite.stage,
'build_example')
def test(self):
"""Perform stand-alone/smoke tests."""
cmake_args = [ cmake_args = [
self.define('CMAKE_PREFIX_PATH', self.prefix), self.define('CMAKE_PREFIX_PATH', self.prefix),
self.define('CMAKE_Fortran_COMPILER', self.compiler.fc), self.define('CMAKE_Fortran_COMPILER', self.compiler.fc),
] ]
cmake_args.append(example_src_dir) cmake_args.append(self.cached_tests_work_dir)
with working_dir(test_build_dir, create=True):
cmake(*cmake_args) self.run_test("cmake", cmake_args,
make() purpose="test: calling cmake",
self.run_test(join_path(example_src_dir, 'run-examples.sh'), work_dir=self.cached_tests_work_dir)
[], [], installed=False,
purpose='test: installation') self.run_test("make", [],
purpose="test: building the tests",
work_dir=self.cached_tests_work_dir)
self.run_test("run-examples.sh", [],
purpose="test: running the examples",
work_dir=self.cached_tests_work_dir)