diff options
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/CMakeTests.cmake | 94 | ||||
-rw-r--r-- | tools/h5dump/errfiles/treadfilter.err | 59 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 509 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 31 |
4 files changed, 672 insertions, 21 deletions
diff --git a/tools/h5dump/CMakeTests.cmake b/tools/h5dump/CMakeTests.cmake index 6edc9e4..9626183 100644 --- a/tools/h5dump/CMakeTests.cmake +++ b/tools/h5dump/CMakeTests.cmake @@ -101,6 +101,7 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tindicessub3.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tindicessub4.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tindicesyes.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tintsattrs.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tlarge_objname.ddl #${HDF5_TOOLS_SRC_DIR}/testfiles/tldouble.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tlonglinks.ddl @@ -120,9 +121,6 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tnoddlfile.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tno-subset.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tnullspace.ddl - ${HDF5_TOOLS_SRC_DIR}/testfiles/trawdatafile.ddl - ${HDF5_TOOLS_SRC_DIR}/testfiles/trawssetfile.ddl - ${HDF5_TOOLS_SRC_DIR}/testfiles/zerodim.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tordergr1.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tordergr2.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tordergr3.ddl @@ -137,10 +135,15 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/torderlinks1.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/torderlinks2.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tperror.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/trawdatafile.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/trawssetfile.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/treadfilter.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/treadintfilter.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/treference.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tsaf.ddl - ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarintsize.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarattrintsize.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarintattrsize.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarintsize.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarstring.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tscaleoffset.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tshuffle.ddl @@ -168,6 +171,7 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/twithddlfile.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/h5dump-help.txt ${HDF5_TOOLS_SRC_DIR}/testfiles/out3.h5import + ${HDF5_TOOLS_SRC_DIR}/testfiles/zerodim.ddl ) SET (HDF5_REFERENCE_EXP_FILES tall-6.exp @@ -237,6 +241,7 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tgrp_comments.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/thlink.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/thyperslab.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tintsattrs.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tlarge_objname.h5 #${HDF5_TOOLS_SRC_DIR}/testfiles/tldouble.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tlonglinks.h5 @@ -252,12 +257,12 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tnestedcmpddt.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tno-subset.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tnullspace.h5 - ${HDF5_TOOLS_SRC_DIR}/testfiles/zerodim.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/torderattr.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tordergr.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tsaf.h5 - ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarintsize.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarattrintsize.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarintattrsize.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarintsize.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tscalarstring.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tslink.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tsplit_file-m.h5 @@ -273,6 +278,7 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tvldtypes5.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tvlstr.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tvms.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/zerodim.h5 ) SET (HDF5_ERROR_REFERENCE_TEST_FILES ${PROJECT_SOURCE_DIR}/errfiles/filter_fail.err @@ -297,6 +303,7 @@ ${PROJECT_SOURCE_DIR}/errfiles/torderlinks2.err ${PROJECT_SOURCE_DIR}/errfiles/tgroup-2.err ${PROJECT_SOURCE_DIR}/errfiles/tperror.err + ${PROJECT_SOURCE_DIR}/errfiles/treadfilter.err ${PROJECT_SOURCE_DIR}/errfiles/tslink-D.err ) @@ -901,6 +908,8 @@ texceedsubblock.out.err tindicesyes.out tindicesyes.out.err + tintsattrs.out + tintsattrs.out.err tlarge_objname.out tlarge_objname.out.err tldouble.out @@ -919,12 +928,12 @@ # tstarfile.out.err tnamed_dtype_attr.out tnamed_dtype_attr.out.err + tnbit.out + tnbit.out.err tnestcomp-1.out tnestcomp-1.out.err tnestedcmpddt.out tnestedcmpddt.out.err - tnbit.out - tnbit.out.err tnoattrdata.out tnoattrdata.out.err tnoattrddl.out @@ -935,18 +944,10 @@ tnoddl.out.err tnoddlfile.out tnoddlfile.out.err - trawdatafile.out - trawdatafile.out.err - trawdatafile.txt - trawssetfile.out - trawssetfile.out.err - trawssetfile.txt tno-subset.out tno-subset.out.err tnullspace.out tnullspace.out.err - zerodim.out - zerodim.out.err tordergr1.out tordergr1.out.err tordergr2.out @@ -975,14 +976,26 @@ torderlinks2.out.err tperror.out tperror.out.err + trawdatafile.out + trawdatafile.out.err + trawdatafile.txt + trawssetfile.out + trawssetfile.out.err + trawssetfile.txt + treadfilter.out + treadfilter.out.err + treadintfilter.out + treadintfilter.out.err treference.out treference.out.err tsaf.out tsaf.out.err - tscalarintsize.out - tscalarintsize.out.err tscalarattrintsize.out tscalarattrintsize.out.err + tscalarintattrsize.out + tscalarintattrsize.out.err + tscalarintsize.out + tscalarintsize.out.err tscalarstring.out tscalarstring.out.err tscaleoffset.out @@ -1037,6 +1050,8 @@ twithddlfile.out twithddlfile.out.err twithddlfile.txt + zerodim.out + zerodim.out.err ) SET_TESTS_PROPERTIES (H5DUMP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") IF (NOT "${last_test}" STREQUAL "") @@ -1079,6 +1094,10 @@ ADD_H5_TEST (tscalarattrintsize 0 --enable-error-stack tscalarattrintsize.h5) # test for string scalar dataset and attribute ADD_H5_TEST (tscalarstring 0 --enable-error-stack tscalarstring.h5) + # test for signed/unsigned scalar datasets with attributes + ADD_H5_TEST (tscalarintattrsize 0 --enable-error-stack tscalarintattrsize.h5) + # test for signed/unsigned datasets attributes + ADD_H5_TEST (tintsattrs 0 --enable-error-stack tintsattrs.h5) # test for displaying groups ADD_H5_TEST (tgroup-1 0 --enable-error-stack tgroup.h5) # test for displaying the selected groups @@ -1302,6 +1321,45 @@ # user defined ADD_H5_TEST (tuserfilter 0 --enable-error-stack -H -p -d myfilter tfilters.h5) + +# See which filters are usable (and skip tests for filters we +# don't have). Do this by searching H5pubconf.h to see which +# filters are defined. + +# detect whether the encoder is present. + IF (H5_HAVE_FILTER_DEFLATE) + SET (USE_FILTER_DEFLATE "true") + ENDIF (H5_HAVE_FILTER_DEFLATE) + + IF (H5_HAVE_FILTER_SZIP) + SET (USE_FILTER_SZIP "true") + ENDIF (H5_HAVE_FILTER_SZIP) + + IF (H5_HAVE_FILTER_SHUFFLE) + SET (USE_FILTER_SHUFFLE "true") + ENDIF (H5_HAVE_FILTER_SHUFFLE) + + IF (H5_HAVE_FILTER_FLETCHER32) + SET (USE_FILTER_FLETCHER32 "true") + ENDIF (H5_HAVE_FILTER_FLETCHER32) + + IF (H5_HAVE_FILTER_NBIT) + SET (USE_FILTER_NBIT "true") + ENDIF (H5_HAVE_FILTER_NBIT) + + IF (H5_HAVE_FILTER_SCALEOFFSET) + SET (USE_FILTER_SCALEOFFSET "true") + ENDIF (H5_HAVE_FILTER_SCALEOFFSET) + + IF (USE_FILTER_DEFLATE AND USE_FILTER_SHUFFLE AND USE_FILTER_FLETCHER32 AND USE_FILTER_NBIT AND USE_FILTER_SCALEOFFSET) + # data read internal filters + ADD_H5_TEST (treadintfilter 0 --enable-error-stack -d deflate -d shuffle -d fletcher32 -d nbit -d scaleoffset tfilters.h5) + IF (HDF5_ENABLE_SZIP_SUPPORT) + # data read all filters + ADD_H5ERR_MASK_TEST (treadfilter 1 --enable-error-stack tfilters.h5) + ENDIF (HDF5_ENABLE_SZIP_SUPPORT) + ENDIF (USE_FILTER_DEFLATE AND USE_FILTER_SHUFFLE AND USE_FILTER_FLETCHER32 AND USE_FILTER_NBIT AND USE_FILTER_SCALEOFFSET) + # test for displaying objects with very long names ADD_H5_TEST (tlonglinks 0 --enable-error-stack tlonglinks.h5) diff --git a/tools/h5dump/errfiles/treadfilter.err b/tools/h5dump/errfiles/treadfilter.err new file mode 100644 index 0000000..9f3fe31 --- /dev/null +++ b/tools/h5dump/errfiles/treadfilter.err @@ -0,0 +1,59 @@ +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Dread(): can't read data + major: Dataset + minor: Read failed + #001: (file name) line (number) in H5D__read(): can't read data + major: Dataset + minor: Read failed + #002: (file name) line (number) in H5D__contig_read(): contiguous read failed + major: Dataset + minor: Read failed + #003: (file name) line (number) in H5D__select_read(): read error + major: Dataspace + minor: Read failed + #004: (file name) line (number) in H5D__select_io(): read error + major: Dataspace + minor: Read failed + #005: (file name) line (number) in H5D__efl_readvv(): can't perform vectorized EFL read + major: Dataset + minor: Can't operate on object + #006: (file name) line (number) in H5V_opvv(): can't perform operation + major: Internal error (too specific to document in detail) + minor: Can't operate on object + #007: (file name) line (number) in H5D__efl_readvv_cb(): EFL read failed + major: Dataset + minor: Read failed + #008: (file name) line (number) in H5D__efl_read(): unable to open external raw data file + major: External file list + minor: Unable to open file +h5dump error: unable to print data +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Dread(): can't read data + major: Dataset + minor: Read failed + #001: (file name) line (number) in H5D__read(): can't read data + major: Dataset + minor: Read failed + #002: (file name) line (number) in H5D__chunk_read(): unable to read raw data chunk + major: Low-level I/O + minor: Read failed + #003: (file name) line (number) in H5D__chunk_lock(): data pipeline read failed + major: Data filters + minor: Filter operation failed + #004: (file name) line (number) in H5Z_pipeline(): required filter 'myfilter' is not registered + major: Data filters + minor: Read failed + #005: (file name) line (number) in H5PL_load(): search in paths failed + major: Plugin for dynamically loaded library + minor: Can't get value + #006: (file name) line (number) in H5PL__find(): can't open directory + major: Plugin for dynamically loaded library + minor: Can't open directory or file +h5dump error: unable to print data +H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): + #000: (file name) line (number) in h5tools_dump_simple_dset(): H5Dread failed + major: Failure in tools library + minor: error in function + #001: (file name) line (number) in h5tools_dump_simple_dset(): H5Dread failed + major: Failure in tools library + minor: error in function diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 1687cc7..82e36db 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -107,6 +107,8 @@ #define FILE75 "tscalarstring.h5" #define FILE76 "tcmpdintarray.h5" #define FILE77 "tcmpdints.h5" +#define FILE78 "tscalarintattrsize.h5" +#define FILE79 "tintsattrs.h5" /*------------------------------------------------------------------------- * prototypes @@ -306,7 +308,7 @@ typedef struct s1_t { /* Name of dataset to create in datafile */ #define F71_DATASETNAME "CompoundAttrIntSize" -/* "FILE73" macros and for FILE69 */ +/* "FILE73" macros and for FILE69 and FILE78 */ #define F73_ARRAY_RANK 2 #define F73_XDIM 8 #define F73_DATASETU08 "DU08BITS" @@ -9073,6 +9075,509 @@ static void gent_compound_ints(void) { } /*------------------------------------------------------------------------- + * Function: gent_intscalars + * + * Purpose: Generate a file to be used in the h5dump scalar with attribute tests. + * Four datasets of 1, 2, 4 and 8 bytes of unsigned int types are created. + * Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created. + * Fill them with raw data such that no bit will be all zero in a dataset. + * A dummy dataset of double type is created for failure test. + *------------------------------------------------------------------------- + */ +static void +gent_intattrscalars(void) +{ + hid_t fid, attr, dataset, space, tid; + hsize_t dims[2]; + uint8_t dsetu8[F73_XDIM][F73_YDIM8], valu8bits; + uint16_t dsetu16[F73_XDIM][F73_YDIM16], valu16bits; + uint32_t dsetu32[F73_XDIM][F73_YDIM32], valu32bits; + uint64_t dsetu64[F73_XDIM][F73_YDIM64], valu64bits; + int8_t dset8[F73_XDIM][F73_YDIM8], val8bits; + int16_t dset16[F73_XDIM][F73_YDIM16], val16bits; + int32_t dset32[F73_XDIM][F73_YDIM32], val32bits; + int64_t dset64[F73_XDIM][F73_YDIM64], val64bits; + double dsetdbl[F73_XDIM][F73_YDIM8]; + unsigned int i, j; + + fid = H5Fcreate(FILE78, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Dataset of 8 bits unsigned int */ + dims[0] = F73_XDIM; dims[1] = F73_YDIM8; + space = H5Screate(H5S_SCALAR); + tid = H5Tarray_create2(H5T_STD_U8LE, F73_ARRAY_RANK, dims); + dataset = H5Dcreate2(fid, F73_DATASETU08, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + valu8bits = (uint8_t) ~0u; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dsetu8[i][0] = valu8bits; + for(j = 1; j < dims[1]; j++) { + dsetu8[i][j] = dsetu8[i][j-1] << 1; + } + valu8bits <<= 1; + } + + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8); + /* Attribute of 8 bits unsigned int */ + attr = H5Acreate2(dataset, F73_DATASETU08, tid, space, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, tid, dsetu8); + H5Aclose(attr); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 16 bits unsigned int */ + dims[0] = F73_XDIM; dims[1] = F73_YDIM16; + space = H5Screate(H5S_SCALAR); + tid = H5Tarray_create2(H5T_STD_U16LE, F73_ARRAY_RANK, dims); + dataset = H5Dcreate2(fid, F73_DATASETU16, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + valu16bits = (uint16_t) ~0u; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dsetu16[i][0] = valu16bits; + for(j = 1; j < dims[1]; j++) { + dsetu16[i][j] = dsetu16[i][j-1] << 1; + } + valu16bits <<= 1; + } + + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16); + /* Attribute of 16 bits unsigned int */ + attr = H5Acreate2(dataset, F73_DATASETU16, tid, space, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, tid, dsetu16); + H5Aclose(attr); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 32 bits unsigned int */ + dims[0] = F73_XDIM; dims[1] = F73_YDIM32; + space = H5Screate(H5S_SCALAR); + tid = H5Tarray_create2(H5T_STD_U32LE, F73_ARRAY_RANK, dims); + dataset = H5Dcreate2(fid, F73_DATASETU32, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + valu32bits = (uint32_t) ~0u; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dsetu32[i][0] = valu32bits; + for(j = 1; j < dims[1]; j++) { + dsetu32[i][j] = dsetu32[i][j-1] << 1; + } + valu32bits <<= 1; + } + + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32); + /* Attribute of 32 bits unsigned int */ + attr = H5Acreate2(dataset, F73_DATASETU32, tid, space, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, tid, dsetu32); + H5Aclose(attr); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 64 bits unsigned int */ + dims[0] = F73_XDIM; dims[1] = F73_YDIM64; + space = H5Screate(H5S_SCALAR); + tid = H5Tarray_create2(H5T_STD_U64LE, F73_ARRAY_RANK, dims); + dataset = H5Dcreate2(fid, F73_DATASETU64, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + valu64bits = (uint64_t) ~0Lu; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dsetu64[i][0] = valu64bits; + for(j = 1; j < dims[1]; j++) { + dsetu64[i][j] = dsetu64[i][j-1] << 1; + } + valu64bits <<= 1; + } + + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64); + /* Attribute of 64 bits unsigned int */ + attr = H5Acreate2(dataset, F73_DATASETU64, tid, space, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, tid, dsetu64); + H5Aclose(attr); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 8 bits signed int */ + dims[0] = F73_XDIM; dims[1] = F73_YDIM8; + space = H5Screate(H5S_SCALAR); + tid = H5Tarray_create2(H5T_STD_I8LE, F73_ARRAY_RANK, dims); + dataset = H5Dcreate2(fid, F73_DATASETS08, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + val8bits = (int8_t) ~0; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dset8[i][0] = val8bits; + for(j = 1; j < dims[1]; j++) { + dset8[i][j] = dset8[i][j-1] << 1; + } + val8bits <<= 1; + } + + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8); + /* Attribute of 8 bits signed int */ + attr = H5Acreate2(dataset, F73_DATASETS08, tid, space, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, tid, dset8); + H5Aclose(attr); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 16 bits signed int */ + dims[0] = F73_XDIM; dims[1] = F73_YDIM16; + space = H5Screate(H5S_SCALAR); + tid = H5Tarray_create2(H5T_STD_I16LE, F73_ARRAY_RANK, dims); + dataset = H5Dcreate2(fid, F73_DATASETS16, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + val16bits = (int16_t) ~0; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dset16[i][0] = val16bits; + for(j = 1; j < dims[1]; j++) { + dset16[i][j] = dset16[i][j-1] << 1; + } + val16bits <<= 1; + } + + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16); + /* Attribute of 16 bits signed int */ + attr = H5Acreate2(dataset, F73_DATASETS16, tid, space, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, tid, dset16); + H5Aclose(attr); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 32 bits signed int */ + dims[0] = F73_XDIM; dims[1] = F73_YDIM32; + space = H5Screate(H5S_SCALAR); + tid = H5Tarray_create2(H5T_STD_I32LE, F73_ARRAY_RANK, dims); + dataset = H5Dcreate2(fid, F73_DATASETS32, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + val32bits = (int32_t) ~0; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dset32[i][0] = val32bits; + for(j = 1; j < dims[1]; j++) { + dset32[i][j] = dset32[i][j-1] << 1; + } + val32bits <<= 1; + } + + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32); + /* Attribute of 32 bits signed int */ + attr = H5Acreate2(dataset, F73_DATASETS32, tid, space, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, tid, dset32); + H5Aclose(attr); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 64 bits signed int */ + dims[0] = F73_XDIM; dims[1] = F73_YDIM64; + space = H5Screate(H5S_SCALAR); + tid = H5Tarray_create2(H5T_STD_I64LE, F73_ARRAY_RANK, dims); + dataset = H5Dcreate2(fid, F73_DATASETS64, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + val64bits = (int64_t) ~0L; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dset64[i][0] = val64bits; + for(j = 1; j < dims[1]; j++) { + dset64[i][j] = dset64[i][j-1] << 1; + } + val64bits <<= 1; + } + + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64); + /* Attribute of 64 bits signed int */ + attr = H5Acreate2(dataset, F73_DATASETS64, tid, space, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, tid, dset64); + H5Aclose(attr); + H5Sclose(space); + H5Dclose(dataset); + + /* Double Dummy set for failure tests */ + dims[0] = F73_XDIM; dims[1] = F73_YDIM8; + space = H5Screate(H5S_SCALAR); + tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, F73_ARRAY_RANK, dims); + dataset = H5Dcreate2(fid, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + for(i = 0; i < dims[0]; i++) + for(j = 0; j < dims[1]; j++) + dsetdbl[i][j] = 0.0001 * j + i; + + H5Dwrite(dataset, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl); + /* Attribute of double */ + attr = H5Acreate2(dataset, F73_DUMMYDBL, tid, space, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, tid, dsetdbl); + H5Aclose(attr); + H5Sclose(space); + H5Dclose(dataset); + H5Fclose(fid); +} + +/*------------------------------------------------------------------------- + * Function: gent_packedbits + * + * Purpose: Generate a file to be used in the h5dump packed bits tests. + * Four datasets of 1, 2, 4 and 8 bytes of unsigned int types are created. + * Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created. + * Fill them with raw data such that no bit will be all zero in a dataset. + * A dummy dataset of double type is created for failure test. + * Created: Albert Cheng, 2010/5/10. + * Modified: Allen Byrne, 2011/1/5 Use file to test Signed/Unsigned datatypes + *------------------------------------------------------------------------- + */ +static void +gent_intsattrs(void) +{ + hid_t fid, attr, dataset, space, aspace; + hsize_t dims[2], adims[1]; + uint8_t dsetu8[F66_XDIM][F66_YDIM8], asetu8[F66_XDIM*F66_YDIM8], valu8bits; + uint16_t dsetu16[F66_XDIM][F66_YDIM16], asetu16[F66_XDIM*F66_YDIM16], valu16bits; + uint32_t dsetu32[F66_XDIM][F66_YDIM32], asetu32[F66_XDIM*F66_YDIM32], valu32bits; + uint64_t dsetu64[F66_XDIM][F66_YDIM64], asetu64[F66_XDIM*F66_YDIM64], valu64bits; + int8_t dset8[F66_XDIM][F66_YDIM8], aset8[F66_XDIM*F66_YDIM8], val8bits; + int16_t dset16[F66_XDIM][F66_YDIM16], aset16[F66_XDIM*F66_YDIM16], val16bits; + int32_t dset32[F66_XDIM][F66_YDIM32], aset32[F66_XDIM*F66_YDIM32], val32bits; + int64_t dset64[F66_XDIM][F66_YDIM64], aset64[F66_XDIM*F66_YDIM64], val64bits; + double dsetdbl[F66_XDIM][F66_YDIM8], asetdbl[F66_XDIM*F66_YDIM8]; + unsigned int i, j; + + fid = H5Fcreate(FILE79, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Dataset of 8 bits unsigned int */ + dims[0] = F66_XDIM; dims[1] = F66_YDIM8; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F66_DATASETU08, H5T_STD_U8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + valu8bits = (uint8_t) ~0u; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dsetu8[i][0] = valu8bits; + asetu8[i*dims[1]] = dsetu8[i][0]; + for(j = 1; j < dims[1]; j++) { + dsetu8[i][j] = dsetu8[i][j-1] << 1; + asetu8[i*dims[1]+j] = dsetu8[i][j]; + } + valu8bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8); + /* Attribute of 8 bits unsigned int */ + adims[0] = F66_XDIM * F66_YDIM8; + aspace = H5Screate_simple(1, adims, NULL); + attr = H5Acreate2(dataset, F66_DATASETU08, H5T_STD_U8LE, aspace, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, H5T_NATIVE_UINT8, asetu8); + H5Aclose(attr); + H5Sclose(aspace); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 16 bits unsigned int */ + dims[0] = F66_XDIM; dims[1] = F66_YDIM16; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + valu16bits = (uint16_t) ~0u; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dsetu16[i][0] = valu16bits; + asetu16[i*dims[1]] = dsetu16[i][0]; + for(j = 1; j < dims[1]; j++) { + dsetu16[i][j] = dsetu16[i][j-1] << 1; + asetu16[i*dims[1]+j] = dsetu16[i][j]; + } + valu16bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16); + /* Attribute of 16 bits unsigned int */ + adims[0] = F66_XDIM * F66_YDIM16; + aspace = H5Screate_simple(1, adims, NULL); + attr = H5Acreate2(dataset, F66_DATASETU16, H5T_STD_U16LE, aspace, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, H5T_NATIVE_UINT16, asetu16); + H5Aclose(attr); + H5Sclose(aspace); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 32 bits unsigned int */ + dims[0] = F66_XDIM; dims[1] = F66_YDIM32; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + valu32bits = (uint32_t) ~0u; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dsetu32[i][0] = valu32bits; + asetu32[i*dims[1]] = dsetu32[i][0]; + for(j = 1; j < dims[1]; j++) { + dsetu32[i][j] = dsetu32[i][j-1] << 1; + asetu32[i*dims[1]+j] = dsetu32[i][j]; + } + valu32bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32); + /* Attribute of 32 bits unsigned int */ + adims[0] = F66_XDIM * F66_YDIM32; + aspace = H5Screate_simple(1, adims, NULL); + attr = H5Acreate2(dataset, F66_DATASETU32, H5T_STD_U32LE, aspace, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, H5T_NATIVE_UINT32, asetu32); + H5Aclose(attr); + H5Sclose(aspace); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 64 bits unsigned int */ + dims[0] = F66_XDIM; dims[1] = F66_YDIM64; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F66_DATASETU64, H5T_STD_U64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + valu64bits = (uint64_t) ~0Lu; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dsetu64[i][0] = valu64bits; + asetu64[i*dims[1]] = dsetu64[i][0]; + for(j = 1; j < dims[1]; j++) { + dsetu64[i][j] = dsetu64[i][j-1] << 1; + asetu64[i*dims[1]+j] = dsetu64[i][j]; + } + valu64bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64); + /* Attribute of 64 bits unsigned int */ + adims[0] = F66_XDIM * F66_YDIM64; + aspace = H5Screate_simple(1, adims, NULL); + attr = H5Acreate2(dataset, F66_DATASETU64, H5T_STD_U64LE, aspace, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, H5T_NATIVE_UINT64, asetu64); + H5Aclose(attr); + H5Sclose(aspace); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 8 bits signed int */ + dims[0] = F66_XDIM; dims[1] = F66_YDIM8; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + val8bits = (int8_t) ~0; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dset8[i][0] = val8bits; + aset8[i*dims[1]] = dset8[i][0]; + for(j = 1; j < dims[1]; j++) { + dset8[i][j] = dset8[i][j-1] << 1; + aset8[i*dims[1]+j] = dset8[i][j]; + } + val8bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8); + /* Attribute of 8 bits signed int */ + adims[0] = F66_XDIM * F66_YDIM8; + aspace = H5Screate_simple(1, adims, NULL); + attr = H5Acreate2(dataset, F66_DATASETS08, H5T_STD_I8LE, aspace, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, H5T_NATIVE_INT8, aset8); + H5Aclose(attr); + H5Sclose(aspace); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 16 bits signed int */ + dims[0] = F66_XDIM; dims[1] = F66_YDIM16; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + val16bits = (int16_t) ~0; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dset16[i][0] = val16bits; + aset16[i*dims[1]] = dset16[i][0]; + for(j = 1; j < dims[1]; j++) { + dset16[i][j] = dset16[i][j-1] << 1; + aset16[i*dims[1]+j] = dset16[i][j]; + } + val16bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16); + /* Attribute of 16 bits signed int */ + adims[0] = F66_XDIM * F66_YDIM16; + aspace = H5Screate_simple(1, adims, NULL); + attr = H5Acreate2(dataset, F66_DATASETS16, H5T_STD_I16LE, aspace, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, H5T_NATIVE_INT16, aset16); + H5Aclose(attr); + H5Sclose(aspace); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 32 bits signed int */ + dims[0] = F66_XDIM; dims[1] = F66_YDIM32; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + val32bits = (int32_t) ~0; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dset32[i][0] = val32bits; + aset32[i*dims[1]] = dset32[i][0]; + for(j = 1; j < dims[1]; j++) { + dset32[i][j] = dset32[i][j-1] << 1; + aset32[i*dims[1]+j] = dset32[i][j]; + } + val32bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32); + /* Attribute of 32 bits signed int */ + adims[0] = F66_XDIM * F66_YDIM32; + aspace = H5Screate_simple(1, adims, NULL); + attr = H5Acreate2(dataset, F66_DATASETS32, H5T_STD_I32LE, aspace, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, H5T_NATIVE_INT32, aset32); + H5Aclose(attr); + H5Sclose(aspace); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 64 bits signed int */ + dims[0] = F66_XDIM; dims[1] = F66_YDIM64; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F66_DATASETS64, H5T_STD_I64LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + val64bits = (int64_t) ~0L; /* all 1s */ + for(i = 0; i < dims[0]; i++){ + dset64[i][0] = val64bits; + aset64[i*dims[1]] = dset64[i][0]; + for(j = 1; j < dims[1]; j++) { + dset64[i][j] = dset64[i][j-1] << 1; + aset64[i*dims[1]+j] = dset64[i][j]; + } + val64bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64); + /* Attribute of 64 bits signed int */ + adims[0] = F66_XDIM * F66_YDIM64; + aspace = H5Screate_simple(1, adims, NULL); + attr = H5Acreate2(dataset, F66_DATASETS64, H5T_STD_I64LE, aspace, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, H5T_NATIVE_INT64, aset64); + H5Aclose(attr); + H5Sclose(aspace); + H5Sclose(space); + H5Dclose(dataset); + + /* Double Dummy set for failure tests */ + dims[0] = F66_XDIM; dims[1] = F66_YDIM8; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F66_DUMMYDBL, H5T_IEEE_F64BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + for(i = 0; i < dims[0]; i++) + for(j = 0; j < dims[1]; j++) { + dsetdbl[i][j] = 0.0001 * j + i; + asetdbl[i*dims[1]+j] = dsetdbl[i][j]; + } + + H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl); + /* Attribute of double */ + adims[0] = F66_XDIM * F66_YDIM8; + aspace = H5Screate_simple(1, adims, NULL); + attr = H5Acreate2(dataset, F66_DUMMYDBL, H5T_IEEE_F64BE, aspace, H5P_DEFAULT, H5P_DEFAULT); + H5Awrite(attr, H5T_NATIVE_DOUBLE, asetdbl); + H5Aclose(attr); + H5Sclose(aspace); + H5Sclose(space); + H5Dclose(dataset); + H5Fclose(fid); +} + + +/*------------------------------------------------------------------------- * Function: main * *------------------------------------------------------------------------- @@ -9159,6 +9664,8 @@ int main(void) gent_string_scalars(); gent_compound_int_array(); gent_compound_ints(); + gent_intattrscalars(); + gent_intsattrs(); return 0; } diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index dc52469..88711c7 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -17,6 +17,13 @@ srcdir=@srcdir@ +USE_FILTER_SZIP="@USE_FILTER_SZIP@" +USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@" +USE_FILTER_SHUFFLE="@USE_FILTER_SHUFFLE@" +USE_FILTER_FLETCHER32="@USE_FILTER_FLETCHER32@" +USE_FILTER_NBIT="@USE_FILTER_NBIT@" +USE_FILTER_SCALEOFFSET="@USE_FILTER_SCALEOFFSET@" + TESTNAME=h5dump EXIT_SUCCESS=0 EXIT_FAILURE=1 @@ -129,6 +136,7 @@ $SRC_H5DUMP_TESTFILES/tgroup.h5 $SRC_H5DUMP_TESTFILES/tgrp_comments.h5 $SRC_H5DUMP_TESTFILES/thlink.h5 $SRC_H5DUMP_TESTFILES/thyperslab.h5 +$SRC_H5DUMP_TESTFILES/tintsattrs.h5 $SRC_H5DUMP_TESTFILES/tlarge_objname.h5 #$SRC_H5DUMP_TESTFILES/tldouble.h5 $SRC_H5DUMP_TESTFILES/tlonglinks.h5 @@ -148,8 +156,9 @@ $SRC_H5DUMP_TESTFILES/zerodim.h5 $SRC_H5DUMP_TESTFILES/torderattr.h5 $SRC_H5DUMP_TESTFILES/tordergr.h5 $SRC_H5DUMP_TESTFILES/tsaf.h5 -$SRC_H5DUMP_TESTFILES/tscalarintsize.h5 $SRC_H5DUMP_TESTFILES/tscalarattrintsize.h5 +$SRC_H5DUMP_TESTFILES/tscalarintattrsize.h5 +$SRC_H5DUMP_TESTFILES/tscalarintsize.h5 $SRC_H5DUMP_TESTFILES/tscalarstring.h5 $SRC_H5DUMP_TESTFILES/tslink.h5 $SRC_H5DUMP_TESTFILES/tsplit_file-m.h5 @@ -259,6 +268,7 @@ $SRC_H5DUMP_TESTFILES/tindicessub2.ddl $SRC_H5DUMP_TESTFILES/tindicessub3.ddl $SRC_H5DUMP_TESTFILES/tindicessub4.ddl $SRC_H5DUMP_TESTFILES/tindicesyes.ddl +$SRC_H5DUMP_TESTFILES/tintsattrs.ddl $SRC_H5DUMP_TESTFILES/tlarge_objname.ddl #$SRC_H5DUMP_TESTFILES/tldouble.ddl $SRC_H5DUMP_TESTFILES/tlonglinks.ddl @@ -298,10 +308,13 @@ $SRC_H5DUMP_TESTFILES/tordercontents2.ddl $SRC_H5DUMP_TESTFILES/torderlinks1.ddl $SRC_H5DUMP_TESTFILES/torderlinks2.ddl $SRC_H5DUMP_TESTFILES/tperror.ddl +$SRC_H5DUMP_TESTFILES/treadfilter.ddl +$SRC_H5DUMP_TESTFILES/treadintfilter.ddl $SRC_H5DUMP_TESTFILES/treference.ddl $SRC_H5DUMP_TESTFILES/tsaf.ddl -$SRC_H5DUMP_TESTFILES/tscalarintsize.ddl $SRC_H5DUMP_TESTFILES/tscalarattrintsize.ddl +$SRC_H5DUMP_TESTFILES/tscalarintattrsize.ddl +$SRC_H5DUMP_TESTFILES/tscalarintsize.ddl $SRC_H5DUMP_TESTFILES/tscalarstring.ddl $SRC_H5DUMP_TESTFILES/tscaleoffset.ddl $SRC_H5DUMP_TESTFILES/tshuffle.ddl @@ -359,6 +372,7 @@ ${SRC_H5DUMP_ERRORFILES}/tgroup-2.err ${SRC_H5DUMP_ERRORFILES}/torderlinks1.err ${SRC_H5DUMP_ERRORFILES}/torderlinks2.err ${SRC_H5DUMP_ERRORFILES}/tperror.err +${SRC_H5DUMP_ERRORFILES}/treadfilter.err ${SRC_H5DUMP_ERRORFILES}/tqmarkfile.err ${SRC_H5DUMP_ERRORFILES}/tslink-D.err " @@ -947,6 +961,10 @@ TOOLTEST tattrintsize.ddl --enable-error-stack tattrintsize.h5 TOOLTEST tcmpdattrintsize.ddl --enable-error-stack tcmpdattrintsize.h5 # test for signed/unsigned scalar attributes TOOLTEST tscalarattrintsize.ddl --enable-error-stack tscalarattrintsize.h5 +# test for signed/unsigned scalar datasets with attributes +TOOLTEST tscalarintattrsize.ddl --enable-error-stack tscalarintattrsize.h5 +# test for signed/unsigned datasets attributes +TOOLTEST tintsattrs.ddl --enable-error-stack tintsattrs.h5 # test for string scalar dataset attribute TOOLTEST tscalarstring.ddl --enable-error-stack tscalarstring.h5 # test for displaying groups @@ -1167,6 +1185,15 @@ TOOLTEST tallfilters.ddl --enable-error-stack -H -p -d all tfilters.h5 # user defined TOOLTEST tuserfilter.ddl --enable-error-stack -H -p -d myfilter tfilters.h5 +if test $USE_FILTER_DEFLATE = "yes" -a $USE_FILTER_SHUFFLE = "yes" -a $USE_FILTER_FLETCHER32 = "yes" -a $USE_FILTER_NBIT = "yes" -a $USE_FILTER_SCALEOFFSET = "yes" ; then + # data read internal filters + TOOLTEST treadintfilter.ddl --enable-error-stack -d deflate -d shuffle -d fletcher32 -d nbit -d scaleoffset tfilters.h5 + if test $USE_FILTER_SZIP = "yes"; then + # data read + TOOLTEST4 treadfilter.ddl --enable-error-stack tfilters.h5 + fi +fi + # test for displaying objects with very long names TOOLTEST tlonglinks.ddl --enable-error-stack tlonglinks.h5 |