summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-01-03 19:20:18 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-01-03 19:20:18 (GMT)
commitb5809e0780b136f7062b1aaa27c793ef4399996b (patch)
tree3731540041283b03dc22aad35a585da559a838d5
parentcf4ff99bdfa213a17e666a587a27b0314ac353c0 (diff)
downloadhdf5-b5809e0780b136f7062b1aaa27c793ef4399996b.zip
hdf5-b5809e0780b136f7062b1aaa27c793ef4399996b.tar.gz
hdf5-b5809e0780b136f7062b1aaa27c793ef4399996b.tar.bz2
[svn-r3230] Purpose:
Extra testing Description: Added tests to dump empty datasets to the h5dump and h5ls testing. Platforms tested: FreeBSD 4.2 (hawkwind)
-rw-r--r--tools/h5dumptst.c58
-rw-r--r--tools/testfiles/tempty.ddl65
-rw-r--r--tools/testfiles/tempty.h5bin0 -> 4304 bytes
-rw-r--r--tools/testfiles/tempty.ls18
-rwxr-xr-xtools/testh5dump.sh6
-rwxr-xr-xtools/testh5ls.sh3
6 files changed, 147 insertions, 3 deletions
diff --git a/tools/h5dumptst.c b/tools/h5dumptst.c
index c1c59d2..f31658e 100644
--- a/tools/h5dumptst.c
+++ b/tools/h5dumptst.c
@@ -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;
}
diff --git a/tools/testfiles/tempty.ddl b/tools/testfiles/tempty.ddl
new file mode 100644
index 0000000..7751725
--- /dev/null
+++ b/tools/testfiles/tempty.ddl
@@ -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
+ }
+ }
+ }
+}
+}
diff --git a/tools/testfiles/tempty.h5 b/tools/testfiles/tempty.h5
new file mode 100644
index 0000000..ad4c2c4
--- /dev/null
+++ b/tools/testfiles/tempty.h5
Binary files differ
diff --git a/tools/testfiles/tempty.ls b/tools/testfiles/tempty.ls
new file mode 100644
index 0000000..96ea64a
--- /dev/null
+++ b/tools/testfiles/tempty.ls
@@ -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}
diff --git a/tools/testh5dump.sh b/tools/testh5dump.sh
index d11c388..8046a10 100755
--- a/tools/testh5dump.sh
+++ b/tools/testh5dump.sh
@@ -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
diff --git a/tools/testh5ls.sh b/tools/testh5ls.sh
index 7e37100..7681b47 100755
--- a/tools/testh5ls.sh
+++ b/tools/testh5ls.sh
@@ -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