genesis: update stand-alone tests to use test stage work directory (#24193)
This commit is contained in:
parent
9edd281044
commit
cb87271a01
1 changed files with 28 additions and 12 deletions
|
@ -105,16 +105,26 @@ def install(self, spec, prefix):
|
|||
make("install")
|
||||
install_tree("doc", prefix.share.doc)
|
||||
|
||||
@property
|
||||
def cached_tests_work_dir(self):
|
||||
"""The working directory for cached test sources."""
|
||||
return join_path(self.test_suite.current_test_cache_dir,
|
||||
"tests")
|
||||
|
||||
@run_after("install")
|
||||
def cache_test_sources(self):
|
||||
"""Copy test files after the package is installed for test()."""
|
||||
if self.spec.satisfies("@master"):
|
||||
self.cache_extra_test_sources(["tests"])
|
||||
|
||||
def test(self):
|
||||
if self.spec.satisfies("@master"):
|
||||
exe_name = self.spec["python"].command.path
|
||||
"""Perform stand-alone/smoke tests using installed package."""
|
||||
if not self.spec.satisfies("@master"):
|
||||
print('Skipping: Tests are only available for the master branch')
|
||||
return
|
||||
|
||||
test_name = join_path(
|
||||
self.install_test_root, "tests", "regression_test", "test.py"
|
||||
self.cached_tests_work_dir, "regression_test", "test.py"
|
||||
)
|
||||
bin_name = join_path(self.prefix.bin, "spdyn")
|
||||
opts = [
|
||||
|
@ -122,4 +132,10 @@ def test(self):
|
|||
self.spec["mpi"].prefix.bin.mpirun + " -np 8 " + bin_name,
|
||||
]
|
||||
env["OMP_NUM_THREADS"] = "1"
|
||||
self.run_test(exe_name, options=opts, expected="Passed 53 / 53")
|
||||
self.run_test(
|
||||
self.spec["python"].command.path,
|
||||
options=opts,
|
||||
expected="Passed 53 / 53",
|
||||
purpose="test: running regression test",
|
||||
work_dir=self.cached_tests_work_dir
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue