From 138c3ee3667f0c6df69ee4dfdc8e4d4dea8ff15a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 21 Aug 2017 11:56:31 -0500 Subject: HDFFV-10188 Add tests and files --- MANIFEST | 4 +++ tools/test/h5dump/CMakeTests.cmake | 5 ++++ tools/test/h5dump/h5dumpgentest.c | 51 ++++++++++++++++++++++++++++++++----- tools/test/h5dump/testh5dump.sh.in | 3 +++ tools/test/h5ls/CMakeTests.cmake | 7 +++++ tools/test/h5ls/testh5ls.sh.in | 5 ++++ tools/testfiles/tgrpnullspace.ddl | 33 ++++++++++++++++++++++++ tools/testfiles/tgrpnullspace.h5 | Bin 0 -> 2504 bytes tools/testfiles/tgrpnullspace.ls | 7 +++++ 9 files changed, 109 insertions(+), 6 deletions(-) create mode 100644 tools/testfiles/tgrpnullspace.ddl create mode 100644 tools/testfiles/tgrpnullspace.h5 create mode 100644 tools/testfiles/tgrpnullspace.ls diff --git a/MANIFEST b/MANIFEST index 2c3659e..bb2dc14 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1712,6 +1712,9 @@ ./tools/testfiles/tgrp_comments.ls ./tools/testfiles/tgrp_comments.ddl ./tools/testfiles/tgrp_comments.h5 +./tools/testfiles/tgrpnullspace.h5 +./tools/testfiles/tgrpnullspace.ddl +./tools/testfiles/tgrpnullspace.ls ./tools/testfiles/thlink-1.ddl ./tools/testfiles/thlink-2.ddl ./tools/testfiles/thlink-3.ddl @@ -1767,6 +1770,7 @@ ./tools/testfiles/tno-subset.h5 ./tools/testfiles/tno-subset.ddl ./tools/testfiles/tnullspace.h5 +./tools/testfiles/tnullspace.h5.xml ./tools/testfiles/tnullspace.ddl ./tools/testfiles/tobjref.h5 ./tools/testfiles/topaque.h5 diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 0a72709..d3d1c4d 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -104,6 +104,7 @@ ${HDF5_TOOLS_DIR}/testfiles/tgroup-1.ddl ${HDF5_TOOLS_DIR}/testfiles/tgroup-2.ddl ${HDF5_TOOLS_DIR}/testfiles/tgrp_comments.ddl + ${HDF5_TOOLS_DIR}/testfiles/tgrpnullspace.ddl ${HDF5_TOOLS_DIR}/testfiles/thlink-1.ddl ${HDF5_TOOLS_DIR}/testfiles/thlink-2.ddl ${HDF5_TOOLS_DIR}/testfiles/thlink-3.ddl @@ -272,6 +273,7 @@ ${HDF5_TOOLS_DIR}/testfiles/tfvalues.h5 ${HDF5_TOOLS_DIR}/testfiles/tgroup.h5 ${HDF5_TOOLS_DIR}/testfiles/tgrp_comments.h5 + ${HDF5_TOOLS_DIR}/testfiles/tgrpnullspace.h5 ${HDF5_TOOLS_DIR}/testfiles/thlink.h5 ${HDF5_TOOLS_DIR}/testfiles/thyperslab.h5 ${HDF5_TOOLS_DIR}/testfiles/tints4dims.h5 @@ -887,6 +889,8 @@ tgroup-2.out.err tgrp_comments.out tgrp_comments.out.err + tgrpnullspace.out + tgrpnullspace.out.err thlink-1.out thlink-1.out.err thlink-2.out @@ -1394,6 +1398,7 @@ # test for displaying dataset and attribute of null space ADD_H5_TEST (tnullspace 0 --enable-error-stack tnullspace.h5) + ADD_H5_TEST (tgrpnullspace 0 -p --enable-error-stack tgrpnullspace.h5) # test for displaying dataset and attribute of space with 0 dimension size ADD_H5_TEST (zerodim 0 --enable-error-stack zerodim.h5) diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 2128acb..0eaa2d0 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -112,6 +112,7 @@ #define FILE82 "tcompound_complex2.h5" #define FILE83 "tvlenstr_array.h5" #define FILE84 "tudfilter.h5" +#define FILE85 "tgrpnullspace.h5" /*------------------------------------------------------------------------- * prototypes @@ -286,9 +287,9 @@ typedef struct s1_t { #define F64_DIM1 (F64_ARRAY_BUF_LEN / sizeof(int) + 1) /* File 65 macros */ -#define STRATEGY H5F_FSPACE_STRATEGY_NONE /* File space handling strategy */ -#define THRESHOLD10 10 /* Free-space section threshold */ -#define FSPACE_PAGE_SIZE 8192 /* File space page size */ +#define STRATEGY H5F_FSPACE_STRATEGY_NONE /* File space handling strategy */ +#define THRESHOLD10 10 /* Free-space section threshold */ +#define FSPACE_PAGE_SIZE 8192 /* File space page size */ /* "FILE66" macros and for FILE69 */ #define F66_XDIM 8 @@ -7041,8 +7042,8 @@ gent_extlinks(void) * Function: gent_fs_strategy_threshold * * Purpose: Generate a file with non-default file space strategy, - * non-default free-space section threshold, - * non-default file space page size. + * non-default free-space section threshold, + * non-default file space page size. *------------------------------------------------------------------------- */ static void @@ -9721,7 +9722,7 @@ static void gent_bitnopaquefields(void) uint32_t c; uint64_t d; } s_t; - + hid_t file, grp=-1, type=-1, space=-1, dset=-1; size_t i; hsize_t nelmts = F80_DIM32; @@ -10437,6 +10438,43 @@ H5Z_filter_dynlibud(unsigned int flags, size_t cd_nelmts, *------------------------------------------------------------------------- */ +/*------------------------------------------------------------------------- + * Function: gent_null_space_group + * + * Purpose: generates dataset and attribute of null dataspace in a group + *------------------------------------------------------------------------- + */ +static void gent_null_space_group(void) +{ + hid_t fid, root, group, dataset, space, attr; + int dset_buf = 10; + int point = 4; + + fid = H5Fcreate(FILE85, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + root = H5Gopen2(fid, "/", H5P_DEFAULT); + + group = H5Gcreate2(fid, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + /* null space */ + space = H5Screate(H5S_NULL); + + /* dataset */ + dataset = H5Dcreate2(group, "dset", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + /* nothing should be written */ + H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dset_buf); + + /* attribute */ + attr = H5Acreate2(group, "attr", H5T_NATIVE_UINT, space, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, H5T_NATIVE_INT, &point); /* Nothing can be written */ + + H5Dclose(dataset); + H5Aclose(attr); + H5Gclose(group); + H5Gclose(root); + H5Sclose(space); + H5Fclose(fid); +} + int main(void) { gent_group(); @@ -10526,6 +10564,7 @@ int main(void) gent_bitnopaquefields(); gent_intsfourdims(); + gent_null_space_group(); gent_udfilter(); diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index f0c01e6..1935b0d 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -132,6 +132,7 @@ $SRC_H5DUMP_TESTFILES/tfpformat.h5 $SRC_H5DUMP_TESTFILES/tfvalues.h5 $SRC_H5DUMP_TESTFILES/tgroup.h5 $SRC_H5DUMP_TESTFILES/tgrp_comments.h5 +$SRC_H5DUMP_TESTFILES/tgrpnullspace.h5 $SRC_H5DUMP_TESTFILES/thlink.h5 $SRC_H5DUMP_TESTFILES/thyperslab.h5 $SRC_H5DUMP_TESTFILES/tintsattrs.h5 @@ -260,6 +261,7 @@ $SRC_H5DUMP_TESTFILES/tfpformat.ddl $SRC_H5DUMP_TESTFILES/tgroup-1.ddl $SRC_H5DUMP_TESTFILES/tgroup-2.ddl $SRC_H5DUMP_TESTFILES/tgrp_comments.ddl +$SRC_H5DUMP_TESTFILES/tgrpnullspace.ddl $SRC_H5DUMP_TESTFILES/thlink-1.ddl $SRC_H5DUMP_TESTFILES/thlink-2.ddl $SRC_H5DUMP_TESTFILES/thlink-3.ddl @@ -1268,6 +1270,7 @@ TOOLTEST thyperslab.ddl --enable-error-stack thyperslab.h5 # test for displaying dataset and attribute of null space TOOLTEST tnullspace.ddl --enable-error-stack tnullspace.h5 +TOOLTEST tgrpnullspace.ddl -p --enable-error-stack tgrpnullspace.h5 # test for displaying dataset and attribute of space with 0 dimension size TOOLTEST zerodim.ddl --enable-error-stack zerodim.h5 diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index 5f61eab..62ee835 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -33,6 +33,7 @@ ${HDF5_TOOLS_DIR}/testfiles/textlinktar.h5 ${HDF5_TOOLS_DIR}/testfiles/tgroup.h5 ${HDF5_TOOLS_DIR}/testfiles/tgrp_comments.h5 + ${HDF5_TOOLS_DIR}/testfiles/tgrpnullspace.h5 ${HDF5_TOOLS_DIR}/testfiles/thlink.h5 ${HDF5_TOOLS_DIR}/testfiles/tloop.h5 ${HDF5_TOOLS_DIR}/testfiles/tnestedcomp.h5 @@ -89,6 +90,7 @@ ${HDF5_TOOLS_DIR}/testfiles/tgroup-1.ls ${HDF5_TOOLS_DIR}/testfiles/tgroup-2.ls ${HDF5_TOOLS_DIR}/testfiles/tgroup-3.ls + ${HDF5_TOOLS_DIR}/testfiles/tgrpnullspace.ls ${HDF5_TOOLS_DIR}/testfiles/thlink-1.ls ${HDF5_TOOLS_DIR}/testfiles/tloop-1.ls ${HDF5_TOOLS_DIR}/testfiles/tmultifile.ls @@ -241,6 +243,8 @@ textlinksrc-7-old.out.err tgrp_comments.out tgrp_comments.out.err + tgrpnullspace.out + tgrpnullspace.out.err tsoftlinks-1.out tsoftlinks-1.out.err tsoftlinks-2.out @@ -415,6 +419,9 @@ # test for empty data ADD_H5_TEST (tempty 0 -w80 -d tempty.h5) + # test for displaying dataset and attribute of null space + ADD_H5_TEST (tgrpnullspace 0 -w80 -v tgrpnullspace.h5) + # test for all dataset types written to attributes # enable -S for avoiding printing NATIVE types ADD_H5_TEST (tattr2 0 -w80 -v -S tattr2.h5) diff --git a/tools/test/h5ls/testh5ls.sh.in b/tools/test/h5ls/testh5ls.sh.in index a88ae88..6259af8 100644 --- a/tools/test/h5ls/testh5ls.sh.in +++ b/tools/test/h5ls/testh5ls.sh.in @@ -80,6 +80,7 @@ $SRC_H5LS_TESTFILES/textlinksrc.h5 $SRC_H5LS_TESTFILES/textlinktar.h5 $SRC_H5LS_TESTFILES/tgroup.h5 $SRC_H5LS_TESTFILES/tgrp_comments.h5 +$SRC_H5LS_TESTFILES/tgrpnullspace.h5 $SRC_H5LS_TESTFILES/thlink.h5 $SRC_H5LS_TESTFILES/tloop.h5 $SRC_H5LS_TESTFILES/tnestedcomp.h5 @@ -135,6 +136,7 @@ $SRC_H5LS_TESTFILES/tgroup.ls $SRC_H5LS_TESTFILES/tgroup-1.ls $SRC_H5LS_TESTFILES/tgroup-2.ls $SRC_H5LS_TESTFILES/tgroup-3.ls +$SRC_H5LS_TESTFILES/tgrpnullspace.ls $SRC_H5LS_TESTFILES/thlink-1.ls $SRC_H5LS_TESTFILES/tloop-1.ls $SRC_H5LS_TESTFILES/tmultifile.ls @@ -392,6 +394,9 @@ TOOLTEST tarray1.ls 0 -w80 -r -d tarray1.h5 # test for empty data TOOLTEST tempty.ls 0 -w80 -d tempty.h5 +# test for displaying dataset and attribute of null space +TOOLTEST tgrpnullspace.ls 0 -w80 -v tgrpnullspace.h5 + # test for all dataset types written to attributes # enable -S for avoiding printing NATIVE types TOOLTEST tattr2.ls 0 -w80 -v -S tattr2.h5 diff --git a/tools/testfiles/tgrpnullspace.ddl b/tools/testfiles/tgrpnullspace.ddl new file mode 100644 index 0000000..2b91527 --- /dev/null +++ b/tools/testfiles/tgrpnullspace.ddl @@ -0,0 +1,33 @@ +HDF5 "tgrpnullspace.h5" { +GROUP "/" { + GROUP "g1" { + ATTRIBUTE "attr" { + DATATYPE H5T_STD_U32LE + DATASPACE NULL + DATA { + } + } + DATASET "dset" { + DATATYPE H5T_STD_I32BE + DATASPACE NULL + STORAGE_LAYOUT { + CONTIGUOUS + SIZE 0 + OFFSET 18446744073709551615 + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE H5D_FILL_VALUE_DEFAULT + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + DATA { + } + } + } +} +} diff --git a/tools/testfiles/tgrpnullspace.h5 b/tools/testfiles/tgrpnullspace.h5 new file mode 100644 index 0000000..82a405e Binary files /dev/null and b/tools/testfiles/tgrpnullspace.h5 differ diff --git a/tools/testfiles/tgrpnullspace.ls b/tools/testfiles/tgrpnullspace.ls new file mode 100644 index 0000000..b1a1223 --- /dev/null +++ b/tools/testfiles/tgrpnullspace.ls @@ -0,0 +1,7 @@ +Opened "tgrpnullspace.h5" with sec2 driver. +g1 Group + Attribute: attr null + Type: native unsigned int + + Location: 1:800 + Links: 1 -- cgit v0.12