dsqss: convert to new stand-alone test process (#38372)

This commit is contained in:
Tamara Dahlgren 2023-06-14 11:54:47 -07:00 committed by GitHub
parent c2371263d1
commit 62525d9076
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,13 +50,17 @@ def cmake_args(self):
return args return args
def test(self): def test_dla(self):
"""prepare, run, and confirm dla results"""
test01 = find(self.prefix.share, "01_spindimer")[0] test01 = find(self.prefix.share, "01_spindimer")[0]
copy(join_path(test01, "std.toml"), ".") copy(join_path(test01, "std.toml"), ".")
# prepare # prepare
pythonexe = self.spec["python"].command.path python = self.spec["python"].command
opts = [self.spec.prefix.bin.dla_pre, "std.toml"] opts = [self.spec.prefix.bin.dla_pre, "std.toml"]
self.run_test(pythonexe, options=opts) with test_part(self, "test_dla_pre", purpose="prepare dla"):
python(*opts)
# (mpi) run # (mpi) run
opts = [] opts = []
if self.spec.satisfies("+mpi"): if self.spec.satisfies("+mpi"):
@ -66,6 +70,11 @@ def test(self):
else: else:
exe_name = "dla" exe_name = "dla"
opts.append("param.in") opts.append("param.in")
expected = ["R ene = -3.74300000e-01 2.96344394e-03"] with test_part(self, "test_dla_run", purpose="run dla"):
self.run_test(exe_name, options=opts) exe = which(exe_name)
self.run_test("cat", options=["sample.log"], expected=expected) exe(*opts)
with test_part(self, "test_dla_results", purpose="confirming dla results"):
cat = which("cat")
out = cat("sample.log", output=str.split, error=str.split)
assert "R ene = -3.74300000e-01 2.96344394e-03" in out