Smoke test: Add test of a sequence of hdf5 commands (#17686)
This commit is contained in:
committed by
Tamara Dahlgren
parent
0b8bc43fb0
commit
f49fa74bf7
@@ -3,9 +3,11 @@
|
||||
#
|
||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
import llnl.util.tty as tty
|
||||
from spack import *
|
||||
|
||||
|
||||
@@ -391,10 +393,35 @@ def _test_check_versions(self):
|
||||
self.run_test(exe, [option], spec_vers_str, None, installed=True,
|
||||
purpose=reason, skip_missing=True)
|
||||
|
||||
def _test_example(self):
|
||||
"""This test performs copy, dump, and diff on an example hdf5 file."""
|
||||
h5_file = os.path.join(self.test_dir, 'data', 'spack.h5')
|
||||
|
||||
reason = 'test: ensure h5dump produces expected output'
|
||||
dump_file = os.path.join(self.test_dir, 'data', 'dump.out')
|
||||
output = ''
|
||||
with open(dump_file) as fd:
|
||||
output == fd.read()
|
||||
self.run_test('h5dump', [h5_file], output, None, installed=True,
|
||||
purpose=reason, skip_missing=True, work_dir='.')
|
||||
|
||||
reason = 'test: ensure h5copy runs'
|
||||
options = ['-i', h5_file, '-s', 'Spack', '-o', 'test.h5', '-d', 'Spack']
|
||||
self.run_test('h5copy', options, '', None, installed=True,
|
||||
purpose=reason, skip_missing=True, work_dir='.')
|
||||
|
||||
reason = 'test: ensure h5diff shows no differences in orig and copy'
|
||||
options = [h5_file, 'test.h5']
|
||||
self.run_test('h5diff', options, '', None, installed=True,
|
||||
purpose=reason, skip_missing=True, work_dir='.')
|
||||
|
||||
def test(self):
|
||||
"""Perform smoke tests on the installed package."""
|
||||
# Simple version check tests on known binaries
|
||||
self._test_check_versions()
|
||||
|
||||
# Run sequence of commands on an hdf5 file
|
||||
self._test_example()
|
||||
|
||||
# Run existing install check
|
||||
self.check_install()
|
||||
|
||||
45
var/spack/repos/builtin/packages/hdf5/test/dump.out
Normal file
45
var/spack/repos/builtin/packages/hdf5/test/dump.out
Normal file
@@ -0,0 +1,45 @@
|
||||
HDF5 "spack.h5" {
|
||||
GROUP "/" {
|
||||
GROUP "Spack" {
|
||||
GROUP "Software" {
|
||||
ATTRIBUTE "Distribution" {
|
||||
DATATYPE H5T_STRING {
|
||||
STRSIZE H5T_VARIABLE;
|
||||
STRPAD H5T_STR_NULLTERM;
|
||||
CSET H5T_CSET_UTF8;
|
||||
CTYPE H5T_C_S1;
|
||||
}
|
||||
DATASPACE SCALAR
|
||||
DATA {
|
||||
(0): "Open Source"
|
||||
}
|
||||
}
|
||||
DATASET "data" {
|
||||
DATATYPE H5T_IEEE_F64LE
|
||||
DATASPACE SIMPLE { ( 7, 11 ) / ( 7, 11 ) }
|
||||
DATA {
|
||||
(0,0): 0.371141, 0.508482, 0.585975, 0.0944911, 0.684849,
|
||||
(0,5): 0.580396, 0.720271, 0.693561, 0.340432, 0.217145,
|
||||
(0,10): 0.636083,
|
||||
(1,0): 0.686996, 0.773501, 0.656767, 0.617543, 0.226132,
|
||||
(1,5): 0.768632, 0.0548711, 0.54572, 0.355544, 0.591548,
|
||||
(1,10): 0.233007,
|
||||
(2,0): 0.230032, 0.192087, 0.293845, 0.0369338, 0.038727,
|
||||
(2,5): 0.0977931, 0.966522, 0.0821391, 0.857921, 0.495703,
|
||||
(2,10): 0.746006,
|
||||
(3,0): 0.598494, 0.990266, 0.993009, 0.187481, 0.746391,
|
||||
(3,5): 0.140095, 0.122661, 0.929242, 0.542415, 0.802758,
|
||||
(3,10): 0.757941,
|
||||
(4,0): 0.372124, 0.411982, 0.270479, 0.950033, 0.329948,
|
||||
(4,5): 0.936704, 0.105097, 0.742285, 0.556565, 0.18988, 0.72797,
|
||||
(5,0): 0.801669, 0.271807, 0.910649, 0.186251, 0.868865,
|
||||
(5,5): 0.191484, 0.788371, 0.920173, 0.582249, 0.682022,
|
||||
(5,10): 0.146883,
|
||||
(6,0): 0.826824, 0.0886705, 0.402606, 0.0532444, 0.72509,
|
||||
(6,5): 0.964683, 0.330362, 0.833284, 0.630456, 0.411489, 0.247806
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
var/spack/repos/builtin/packages/hdf5/test/spack.h5
Normal file
BIN
var/spack/repos/builtin/packages/hdf5/test/spack.h5
Normal file
Binary file not shown.
Reference in New Issue
Block a user