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>
This commit is contained in:
AcriusWinter 2024-07-24 18:09:57 -07:00 committed by GitHub
parent ff144df549
commit c6cc97953b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -97,87 +97,69 @@ def setup_run_environment(self, env):
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 = which(self.prefix.bin.sz)
if exe is None:
raise SkipTest(f"sz is not installed for version {self.version}")
exe = "sz"
reason = "testing 2D compression of {0}".format(exe)
options = ["-z", "-f", "-i", orifile, "-M", "REL", "-R", "1E-3", "-2", "8", "1024"]
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)
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)
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)"""
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 = which(self.prefix.bin.sz)
if exe is None:
raise SkipTest(f"sz is not installed for version {self.version}")
exe = "sz"
reason = "testing 3D compression of {0}".format(exe)
options = ["-z", "-f", "-i", orifile, "-M", "REL", "-R", "1E-3", "-3", "8", "8", "128"]
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)
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()
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):