summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorAcriusWinter <152348900+AcriusWinter@users.noreply.github.com>2024-07-24 18:09:57 -0700
committerGitHub <noreply@github.com>2024-07-24 19:09:57 -0600
commitc6cc97953b5d4861f3269bcd804311e75af42d50 (patch)
tree308573fccb8b88ad8ed154db82bf813e2c80e653 /var
parentff144df54906a659a53e4de3b1d47a4194b6962d (diff)
downloadspack-c6cc97953b5d4861f3269bcd804311e75af42d50.tar.gz
spack-c6cc97953b5d4861f3269bcd804311e75af42d50.tar.bz2
spack-c6cc97953b5d4861f3269bcd804311e75af42d50.tar.xz
spack-c6cc97953b5d4861f3269bcd804311e75af42d50.zip
sz: new test API (#45363)
* sz: new test API * fix typo; check installed executable; conform to subpart naming convention * skip tests early if not installed; remove unnecessary "_sz" from test part names --------- Co-authored-by: Tamara Dahlgren <dahlgren1@llnl.gov>
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/sz/package.py136
1 files changed, 59 insertions, 77 deletions
diff --git a/var/spack/repos/builtin/packages/sz/package.py b/var/spack/repos/builtin/packages/sz/package.py
index 22c08a1281..b73cad5aa2 100644
--- a/var/spack/repos/builtin/packages/sz/package.py
+++ b/var/spack/repos/builtin/packages/sz/package.py
@@ -97,87 +97,69 @@ class Sz(CMakePackage, AutotoolsPackage):
if "+hdf5" in self.spec:
env.prepend_path("HDF5_PLUGIN_PATH", self.prefix.lib64)
- def _test_2d_float(self):
- """This test performs simple 2D compression/decompression (float)"""
+ def test_2d_float(self):
+ """Run simple 2D compression/decompression"""
test_data_dir = self.test_suite.current_test_data_dir
- filename = "testfloat_8_8_128.dat"
- orifile = test_data_dir.join(filename)
-
- exe = "sz"
- reason = "testing 2D compression of {0}".format(exe)
- options = ["-z", "-f", "-i", orifile, "-M", "REL", "-R", "1E-3", "-2", "8", "1024"]
-
- self.run_test(
- exe,
- options,
- [],
- installed=True,
- purpose=reason,
- skip_missing=True,
- work_dir=test_data_dir,
- )
-
- filename = "testfloat_8_8_128.dat.sz"
- decfile = test_data_dir.join(filename)
-
- reason = "testing 2D decompression of {0}".format(exe)
- options = ["-x", "-f", "-i", orifile, "-s", decfile, "-2", "8", "1024", "-a"]
-
- self.run_test(
- exe,
- options,
- [],
- installed=True,
- purpose=reason,
- skip_missing=True,
- work_dir=test_data_dir,
- )
-
- def _test_3d_float(self):
- """This test performs simple 3D compression/decompression (float)"""
-
+ exe = which(self.prefix.bin.sz)
+ if exe is None:
+ raise SkipTest(f"sz is not installed for version {self.version}")
+
+ with working_dir(test_data_dir):
+ filename = "testfloat_8_8_128.dat"
+ orifile = test_data_dir.join(filename)
+ with test_part(
+ self, "test_2d_float_compression", purpose="testing 2D compression of sz"
+ ):
+ options = ["-z", "-f", "-i", orifile, "-M", "REL", "-R", "1E-3", "-2", "8", "1024"]
+ exe(*options)
+
+ filename = "testfloat_8_8_128.dat.sz"
+ decfile = test_data_dir.join(filename)
+
+ with test_part(
+ self, "test_2d_float_decompression", purpose="testing 2D decompression of sz"
+ ):
+ options = ["-x", "-f", "-i", orifile, "-s", decfile, "-2", "8", "1024", "-a"]
+ exe(*options)
+
+ def test_3d_float(self):
+ """Run simple 3D compression/decompression"""
test_data_dir = self.test_suite.current_test_data_dir
- filename = "testfloat_8_8_128.dat"
- orifile = test_data_dir.join(filename)
-
- exe = "sz"
- reason = "testing 3D compression of {0}".format(exe)
- options = ["-z", "-f", "-i", orifile, "-M", "REL", "-R", "1E-3", "-3", "8", "8", "128"]
-
- self.run_test(
- exe,
- options,
- [],
- installed=True,
- purpose=reason,
- skip_missing=True,
- work_dir=test_data_dir,
- )
-
- filename = "testfloat_8_8_128.dat.sz"
- decfile = test_data_dir.join(filename)
-
- reason = "testing 3D decompression of {0}".format(exe)
- options = ["-x", "-f", "-i", orifile, "-s", decfile, "-3", "8", "8", "128", "-a"]
-
- self.run_test(
- exe,
- options,
- [],
- installed=True,
- purpose=reason,
- skip_missing=True,
- work_dir=test_data_dir,
- )
-
- def test(self):
- """Perform smoke tests on the installed package"""
- # run 2D compression and decompression (float)
- self._test_2d_float()
- # run 3D compression and decompression (float)
- self._test_3d_float()
+ exe = which(self.prefix.bin.sz)
+ if exe is None:
+ raise SkipTest(f"sz is not installed for version {self.version}")
+
+ with working_dir(test_data_dir):
+ filename = "testfloat_8_8_128.dat"
+ orifile = test_data_dir.join(filename)
+ with test_part(
+ self, "test_3d_float_compression", purpose="testing 3D compression of sz"
+ ):
+ options = [
+ "-z",
+ "-f",
+ "-i",
+ orifile,
+ "-M",
+ "REL",
+ "-R",
+ "1E-3",
+ "-3",
+ "8",
+ "8",
+ "128",
+ ]
+ exe(*options)
+
+ filename = "testfloat_8_8_128.dat.sz"
+ decfile = test_data_dir.join(filename)
+ with test_part(
+ self, "test_3d_float_decompression", purpose="testing 3D decompression of sz"
+ ):
+ options = ["-x", "-f", "-i", orifile, "-s", decfile, "-3", "8", "8", "128", "-a"]
+ exe(*options)
class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder):