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: if "+hdf5" in self.spec:
env.prepend_path("HDF5_PLUGIN_PATH", self.prefix.lib64) env.prepend_path("HDF5_PLUGIN_PATH", self.prefix.lib64)
def _test_2d_float(self): def test_2d_float(self):
"""This test performs simple 2D compression/decompression (float)""" """Run simple 2D compression/decompression"""
test_data_dir = self.test_suite.current_test_data_dir test_data_dir = self.test_suite.current_test_data_dir
filename = "testfloat_8_8_128.dat" exe = which(self.prefix.bin.sz)
orifile = test_data_dir.join(filename) if exe is None:
raise SkipTest(f"sz is not installed for version {self.version}")
exe = "sz" with working_dir(test_data_dir):
reason = "testing 2D compression of {0}".format(exe) filename = "testfloat_8_8_128.dat"
options = ["-z", "-f", "-i", orifile, "-M", "REL", "-R", "1E-3", "-2", "8", "1024"] 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( filename = "testfloat_8_8_128.dat.sz"
exe, decfile = test_data_dir.join(filename)
options,
[],
installed=True,
purpose=reason,
skip_missing=True,
work_dir=test_data_dir,
)
filename = "testfloat_8_8_128.dat.sz" with test_part(
decfile = test_data_dir.join(filename) self, "test_2d_float_decompression", purpose="testing 2D decompression of sz"
):
reason = "testing 2D decompression of {0}".format(exe) options = ["-x", "-f", "-i", orifile, "-s", decfile, "-2", "8", "1024", "-a"]
options = ["-x", "-f", "-i", orifile, "-s", decfile, "-2", "8", "1024", "-a"] exe(*options)
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)"""
def test_3d_float(self):
"""Run simple 3D compression/decompression"""
test_data_dir = self.test_suite.current_test_data_dir test_data_dir = self.test_suite.current_test_data_dir
filename = "testfloat_8_8_128.dat" exe = which(self.prefix.bin.sz)
orifile = test_data_dir.join(filename) if exe is None:
raise SkipTest(f"sz is not installed for version {self.version}")
exe = "sz" with working_dir(test_data_dir):
reason = "testing 3D compression of {0}".format(exe) filename = "testfloat_8_8_128.dat"
options = ["-z", "-f", "-i", orifile, "-M", "REL", "-R", "1E-3", "-3", "8", "8", "128"] 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( filename = "testfloat_8_8_128.dat.sz"
exe, decfile = test_data_dir.join(filename)
options, with test_part(
[], self, "test_3d_float_decompression", purpose="testing 3D decompression of sz"
installed=True, ):
purpose=reason, options = ["-x", "-f", "-i", orifile, "-s", decfile, "-3", "8", "8", "128", "-a"]
skip_missing=True, exe(*options)
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()
class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder): class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder):