mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-25 17:00:45 +08:00
[svn-r3230] Purpose:
Extra testing Description: Added tests to dump empty datasets to the h5dump and h5ls testing. Platforms tested: FreeBSD 4.2 (hawkwind)
This commit is contained in:
parent
cf4ff99bdf
commit
b5809e0780
@ -36,6 +36,7 @@
|
||||
#define FILE29 "tarray5.h5"
|
||||
#define FILE30 "tarray6.h5"
|
||||
#define FILE31 "tarray7.h5"
|
||||
#define FILE32 "tempty.h5"
|
||||
|
||||
#define LENSTR 50
|
||||
#define LENSTR2 11
|
||||
@ -2466,6 +2467,61 @@ static void test_array7(void)
|
||||
ret = H5Fclose(fid1);
|
||||
}
|
||||
|
||||
static void test_empty(void)
|
||||
{
|
||||
typedef struct {
|
||||
int a;
|
||||
float b;
|
||||
char c;
|
||||
} empty_struct;
|
||||
hid_t file, dset, space, type;
|
||||
hsize_t dims[] = { SPACE1_DIM1 };
|
||||
herr_t ret=0;
|
||||
|
||||
ret = ret; /* so that compiler won't complain "is set but never used" */
|
||||
file = H5Fcreate(FILE32, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
|
||||
space = H5Screate_simple(SPACE1_RANK, dims, NULL);
|
||||
|
||||
/* write out an empty vlen dataset */
|
||||
type = H5Tvlen_create(H5T_NATIVE_INT);
|
||||
dset = H5Dcreate(file, "Dataset1.0", type, space, H5P_DEFAULT);
|
||||
/* Don't write any data */
|
||||
ret = H5Dclose(dset);
|
||||
ret = H5Tclose(type);
|
||||
|
||||
/* write out an empty native integer dataset dataset */
|
||||
dset = H5Dcreate(file, "Dataset2.0", H5T_NATIVE_INT, space, H5P_DEFAULT);
|
||||
/* Don't write any data */
|
||||
ret = H5Dclose(dset);
|
||||
|
||||
/* write out an empty native floating-point dataset dataset */
|
||||
dset = H5Dcreate(file, "Dataset3.0", H5T_NATIVE_FLOAT, space, H5P_DEFAULT);
|
||||
/* Don't write any data */
|
||||
ret = H5Dclose(dset);
|
||||
|
||||
/* write out an empty array dataset */
|
||||
type = H5Tarray_create(H5T_NATIVE_INT,SPACE1_RANK,dims,NULL);
|
||||
dset = H5Dcreate(file, "Dataset4.0", type, space, H5P_DEFAULT);
|
||||
/* Don't write any data */
|
||||
ret = H5Dclose(dset);
|
||||
ret = H5Tclose(type);
|
||||
|
||||
/* write out an empty compound dataset */
|
||||
type = H5Tcreate(H5T_COMPOUND,sizeof(empty_struct));
|
||||
H5Tinsert(type, "a", HOFFSET(empty_struct, a),H5T_NATIVE_INT);
|
||||
H5Tinsert(type, "b", HOFFSET(empty_struct, b),H5T_NATIVE_FLOAT);
|
||||
H5Tinsert(type, "c", HOFFSET(empty_struct, c),H5T_NATIVE_CHAR);
|
||||
dset = H5Dcreate(file, "Dataset5.0", type, space, H5P_DEFAULT);
|
||||
/* Don't write any data */
|
||||
ret = H5Dclose(dset);
|
||||
ret = H5Tclose(type);
|
||||
|
||||
ret = H5Sclose(space);
|
||||
|
||||
ret = H5Fclose(file);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
test_group();
|
||||
@ -2509,5 +2565,7 @@ int main(void)
|
||||
test_array6();
|
||||
test_array7();
|
||||
|
||||
test_empty();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
65
tools/testfiles/tempty.ddl
Normal file
65
tools/testfiles/tempty.ddl
Normal file
@ -0,0 +1,65 @@
|
||||
#############################
|
||||
Expected output for 'h5dump tempty.h5'
|
||||
#############################
|
||||
HDF5 "tempty.h5" {
|
||||
GROUP "/" {
|
||||
DATASET "Dataset1.0" {
|
||||
DATATYPE H5T_VLEN { H5T_STD_I32LE}
|
||||
DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
|
||||
DATA {
|
||||
(), (), (), ()
|
||||
}
|
||||
}
|
||||
DATASET "Dataset2.0" {
|
||||
DATATYPE H5T_STD_I32LE
|
||||
DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
|
||||
DATA {
|
||||
0, 0, 0, 0
|
||||
}
|
||||
}
|
||||
DATASET "Dataset3.0" {
|
||||
DATATYPE H5T_IEEE_F32LE
|
||||
DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
|
||||
DATA {
|
||||
0, 0, 0, 0
|
||||
}
|
||||
}
|
||||
DATASET "Dataset4.0" {
|
||||
DATATYPE H5T_ARRAY { [4] H5T_STD_I32LE }
|
||||
DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
|
||||
DATA {
|
||||
[ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0, 0, 0 ]
|
||||
}
|
||||
}
|
||||
DATASET "Dataset5.0" {
|
||||
DATATYPE H5T_COMPOUND {
|
||||
H5T_STD_I32LE "a";
|
||||
H5T_IEEE_F32LE "b";
|
||||
H5T_STD_I8LE "c";
|
||||
}
|
||||
DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
|
||||
DATA {
|
||||
{
|
||||
0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
{
|
||||
0,
|
||||
0,
|
||||
0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
BIN
tools/testfiles/tempty.h5
Normal file
BIN
tools/testfiles/tempty.h5
Normal file
Binary file not shown.
18
tools/testfiles/tempty.ls
Normal file
18
tools/testfiles/tempty.ls
Normal file
@ -0,0 +1,18 @@
|
||||
#############################
|
||||
output for 'h5ls -w80 -d tempty.h5'
|
||||
#############################
|
||||
Dataset1.0 Dataset {4}
|
||||
Data:
|
||||
(0) (), (), (), ()
|
||||
Dataset2.0 Dataset {4}
|
||||
Data:
|
||||
(0) 0, 0, 0, 0
|
||||
Dataset3.0 Dataset {4}
|
||||
Data:
|
||||
(0) 0, 0, 0, 0
|
||||
Dataset4.0 Dataset {4}
|
||||
Data:
|
||||
(0) [0,0,0,0], [0,0,0,0], [0,0,0,0], [0,0,0,0]
|
||||
Dataset5.0 Dataset {4}
|
||||
Data:
|
||||
(0) {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}
|
@ -128,20 +128,20 @@ TOOLTEST tsaf.ddl tsaf.h5
|
||||
TOOLTEST tvldtypes1.ddl tvldtypes1.h5
|
||||
TOOLTEST tvldtypes2.ddl tvldtypes2.h5
|
||||
TOOLTEST tvldtypes3.ddl tvldtypes3.h5
|
||||
#dumping tvldtypes4.h5 is causing core-dumps on modi4 currently - QAK
|
||||
TOOLTEST tvldtypes4.ddl tvldtypes4.h5
|
||||
|
||||
# test for files with array data
|
||||
TOOLTEST tarray1.ddl tarray1.h5
|
||||
TOOLTEST tarray2.ddl tarray2.h5
|
||||
TOOLTEST tarray3.ddl tarray3.h5
|
||||
#dumping tarray4.h5 is causing core-dumps on modi4 currently - QAK
|
||||
TOOLTEST tarray4.ddl tarray4.h5
|
||||
#dumping tarray5.h5 is causing core-dumps on hawkwind currently - QAK
|
||||
TOOLTEST tarray5.ddl tarray5.h5
|
||||
TOOLTEST tarray6.ddl tarray6.h5
|
||||
TOOLTEST tarray7.ddl tarray7.h5
|
||||
|
||||
# test for files with empty data
|
||||
TOOLTEST tempty.ddl tempty.h5
|
||||
|
||||
if test $nerrors -eq 0 ; then
|
||||
echo "All $h5tool tests passed."
|
||||
fi
|
||||
|
@ -130,6 +130,9 @@ TOOLTEST tvldtypes1.ls -w80 -r -d tvldtypes1.h5
|
||||
# test for array data types
|
||||
TOOLTEST tarray1.ls -w80 -r -d tarray1.h5
|
||||
|
||||
# test for empty data
|
||||
TOOLTEST tempty.ls -w80 -d tempty.h5
|
||||
|
||||
if test $nerrors -eq 0 ; then
|
||||
echo "All $h5tool tests passed."
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user