summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>2021-07-26 01:24:29 -0700
committerGitHub <noreply@github.com>2021-07-26 10:24:29 +0200
commitcb87271a01ab55671a05db2820c72734a6428753 (patch)
tree21b22df39422aa8139bc67ff00ac157ac91ba1e8
parent9edd2810440a36cee391a7fb287c0d059d104a9c (diff)
downloadspack-cb87271a01ab55671a05db2820c72734a6428753.tar.gz
spack-cb87271a01ab55671a05db2820c72734a6428753.tar.bz2
spack-cb87271a01ab55671a05db2820c72734a6428753.tar.xz
spack-cb87271a01ab55671a05db2820c72734a6428753.zip
genesis: update stand-alone tests to use test stage work directory (#24193)
-rw-r--r--var/spack/repos/builtin/packages/genesis/package.py40
1 files changed, 28 insertions, 12 deletions
diff --git a/var/spack/repos/builtin/packages/genesis/package.py b/var/spack/repos/builtin/packages/genesis/package.py
index 7e433e5e94..942c334a3b 100644
--- a/var/spack/repos/builtin/packages/genesis/package.py
+++ b/var/spack/repos/builtin/packages/genesis/package.py
@@ -105,21 +105,37 @@ class Genesis(AutotoolsPackage, CudaPackage):
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
- test_name = join_path(
- self.install_test_root, "tests", "regression_test", "test.py"
- )
- bin_name = join_path(self.prefix.bin, "spdyn")
- opts = [
- test_name,
- 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")
+ """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.cached_tests_work_dir, "regression_test", "test.py"
+ )
+ bin_name = join_path(self.prefix.bin, "spdyn")
+ opts = [
+ test_name,
+ self.spec["mpi"].prefix.bin.mpirun + " -np 8 " + bin_name,
+ ]
+ env["OMP_NUM_THREADS"] = "1"
+ 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
+ )