diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2011-02-08 15:55:31 (GMT) |
---|---|---|
committer | Neil Fortner <nfortne2@hdfgroup.org> | 2011-02-08 15:55:31 (GMT) |
commit | f3ee1cc38d0604116afbffe72cd98dabfe1014a7 (patch) | |
tree | b7b11d751b526c91b0e0695d34c66991b80d74b3 /tools/h5dump | |
parent | e1cd1485b8bb78b4a99ca4246c522bbaf3c0ed76 (diff) | |
parent | a6d5fa2c7db165fa2cecee86bdbd201339349968 (diff) | |
download | hdf5-f3ee1cc38d0604116afbffe72cd98dabfe1014a7.zip hdf5-f3ee1cc38d0604116afbffe72cd98dabfe1014a7.tar.gz hdf5-f3ee1cc38d0604116afbffe72cd98dabfe1014a7.tar.bz2 |
[svn-r20063] Merge changes from trunk from revision 19519 to 20062 into open_file_pool branch. No testing needed as the branch is currently identical to the trunk.
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/CMakeLists.txt | 420 | ||||
-rw-r--r-- | tools/h5dump/Makefile.in | 3 | ||||
-rw-r--r-- | tools/h5dump/h5dump.c | 35 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 213 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 5 |
5 files changed, 648 insertions, 28 deletions
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index 075a3b3..e8e88ad 100644 --- a/tools/h5dump/CMakeLists.txt +++ b/tools/h5dump/CMakeLists.txt @@ -11,8 +11,7 @@ INCLUDE_DIRECTORIES (${HDF5_PROJECT_DIR}/test) # Add the h5dump executables # -------------------------------------------------------------------- ADD_EXECUTABLE (h5dump ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dump.c) -H5_NAMING (h5dump) -TARGET_WIN_PROPERTIES (h5dump) +H5_NAMING (h5dump ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5dump ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) SET (H5_DEP_EXECUTABLES h5dump) @@ -29,8 +28,7 @@ IF (BUILD_TESTING) # -------------------------------------------------------------------- IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5dumpgentest ${HDF5_TOOLS_H5DUMP_SOURCE_DIR}/h5dumpgentest.c) - H5_NAMING (h5dumpgentest) - TARGET_WIN_PROPERTIES (h5dumpgentest) + H5_NAMING (h5dumpgentest ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5dumpgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) #ADD_TEST (NAME h5dumpgentest COMMAND $<TARGET_FILE:h5dumpgentest>) @@ -40,6 +38,7 @@ IF (BUILD_TESTING) # Copy all the HDF5 files from the test directory into the source directory # -------------------------------------------------------------------- SET (HDF5_REFERENCE_FILES + packedbits.ddl tall-1.ddl tall-2.ddl tall-2A.ddl @@ -84,6 +83,7 @@ IF (BUILD_TESTING) texternal.ddl textlinksrc.ddl textlinkfar.ddl + textlink.ddl tfamily.ddl tfill.ddl tfletcher32.ddl @@ -219,6 +219,7 @@ IF (BUILD_TESTING) tbin3.ddl tbin4.ddl out3.h5import + packedbits.h5 taindices.h5 tall.h5 tarray1.h5 @@ -243,6 +244,7 @@ IF (BUILD_TESTING) textlinkfar.h5 textlinksrc.h5 textlinktar.h5 + textlink.h5 tfamily00000.h5 tfamily00001.h5 tfamily00002.h5 @@ -473,6 +475,240 @@ IF (BUILD_TESTING) ############################################################################## ############################################################################## + # Remove any output file left over from previous test run + ADD_TEST ( + NAME H5DUMP-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + packedbits.out + packedbits.out.err + tall-1.out + tall-1.out.err + tall-2.out + tall-2.out.err + tall-2A.out + tall-2A.out.err + tall-2B.out + tall-2B.out.err + tall-3.out + tall-3.out.err + tall-4s.out + tall-4s.out.err + tall-5s.out + tall-5s.out.err + tallfilters.out + tallfilters.out.err + tarray1.out + tarray1.out.err + tarray2.out + tarray2.out.err + tarray3.out + tarray3.out.err + tarray4.out + tarray4.out.err + tarray5.out + tarray5.out.err + tarray6.out + tarray6.out.err + tarray7.out + tarray7.out.err + tarray8.out + tarray8.out.err + tattr-1.out + tattr-1.out.err + tattr-2.out + tattr-2.out.err + tattr-3.out + tattr-3.out.err + tattrreg.out + tattrreg.out.err + tattrregR.out + tattrregR.out.err + tbinregR.out + tbinregR.out.err + tbigdims.out + tbigdims.out.err + tboot1.out + tboot1.out.err + tboot2.out + tboot2.out.err + tchar1.out + tchar1.out.err + tchunked.out + tchunked.out.err + tcomp-1.out + tcomp-1.out.err + tcomp-2.out + tcomp-2.out.err + tcomp-3.out + tcomp-3.out.err + tcomp-4.out + tcomp-4.out.err + tcompact.out + tcompact.out.err + tcontents.out + tcontents.out.err + tcontiguos.out + tcontiguos.out.err + tdatareg.out + tdatareg.out.err + tdataregR.out + tdataregR.out.err + tdeflate.out + tdeflate.out.err + tdset-1.out + tdset-1.out.err + tdset-2.out + tdset-2.out.err + tdset-3s.out + tdset-3s.out.err + tempty.out + tempty.out.err + texternal.out + texternal.out.err + textlinksrc.out + textlinksrc.out.err + textlinkfar.out + textlinkfar.out.err + textlink.out + textlink.out.err + tfamily.out + tfamily.out.err + tfill.out + tfill.out.err + tfletcher32.out + tfletcher32.out.err + tfpformat.out + tfpformat.out.err + tgroup-1.out + tgroup-1.out.err + tgroup-2.out + tgroup-2.out.err + tgrp_comments.out + tgrp_comments.out.err + thlink-1.out + thlink-1.out.err + thlink-2.out + thlink-2.out.err + thlink-3.out + thlink-3.out.err + thlink-4.out + thlink-4.out.err + thlink-5.out + thlink-5.out.err + thyperslab.out + thyperslab.out.err + tindicesno.out + tindicesno.out.err + tindicessub1.out + tindicessub1.out.err + tindicessub2.out + tindicessub2.out.err + tindicessub3.out + tindicessub3.out.err + tindicessub4.out + tindicessub4.out.err + tindicesyes.out + tindicesyes.out.err + tlarge_objname.out + tlarge_objname.out.err + tldouble.out + tldouble.out.err + tlonglinks.out + tlonglinks.out.err + tloop-1.out + tloop-1.out.err + tmulti.out + tmulti.out.err + tnamed_dtype_attr.out + tnamed_dtype_attr.out.err + tnestcomp-1.out + tnestcomp-1.out.err + tnbit.out + tnbit.out.err + tnofilename.out + tnofilename.out.err + tnullspace.out + tnullspace.out.err + tordergr1.out + tordergr1.out.err + tordergr2.out + tordergr2.out.err + tordergr3.out + tordergr3.out.err + tordergr4.out + tordergr4.out.err + tordergr5.out + tordergr5.out.err + torderattr1.out + torderattr1.out.err + torderattr2.out + torderattr2.out.err + torderattr3.out + torderattr3.out.err + torderattr4.out + torderattr4.out.err + tperror.out + tperror.out.err + treference.out + treference.out.err + tsaf.out + tsaf.out.err + tscaleoffset.out + tscaleoffset.out.err + tshuffle.out + tshuffle.out.err + tslink-1.out + tslink-1.out.err + tslink-2.out + tslink-2.out.err + tsplit_file.out + tsplit_file.out.err + tstr-1.out + tstr-1.out.err + tstr-2.out + tstr-2.out.err + tstring.out + tstring.out.err + tstring2.out + tstring2.out.err + tstringe.out + tstringe.out.err + tszip.out + tszip.out.err + tudlink-1.out + tudlink-1.out.err + tudlink-2.out + tudlink-2.out.err + tuserfilter.out + tuserfilter.out.err + tvldtypes1.out + tvldtypes1.out.err + tvldtypes2.out + tvldtypes2.out.err + tvldtypes3.out + tvldtypes3.out.err + tvldtypes4.out + tvldtypes4.out.err + tvldtypes5.out + tvldtypes5.out.err + tvlstr.out + tvlstr.out.err + tvms.out + tvms.out.err + ) + + # If using memchecker add tests without using scripts + IF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST (NAME H5DUMP-tgroup COMMAND h5dump tgroup.h5) + ADD_TEST (NAME H5DUMP-tdset COMMAND h5dump tdset.h5) + ADD_TEST (NAME H5DUMP-tattr COMMAND h5dump tattr.h5) + ADD_TEST (NAME H5DUMP-tslink COMMAND h5dump tslink.h5) + ADD_TEST (NAME H5DUMP-thlink COMMAND h5dump thlink.h5) + ENDIF (HDF5_ENABLE_USING_MEMCHECKER) + + # test for signed/unsigned datasets + ADD_H5_TEST (packedbits 0 packedbits.h5) # test for displaying groups ADD_H5_TEST (tgroup-1 0 tgroup.h5) # test for displaying the selected groups @@ -583,11 +819,7 @@ IF (BUILD_TESTING) # test failure handling # Missing file name - IF (${USE_PACKED_BITS}) - ADD_H5_TEST (tnofilename-with-packed-bits 1) - ELSE (${USE_PACKED_BITS}) - ADD_H5_TEST (tnofilename 1) - ENDIF (${USE_PACKED_BITS}) + ADD_H5_TEST (tnofilename 1) # rev. 2004 @@ -774,15 +1006,171 @@ IF (BUILD_TESTING) ADD_H5_TEST (textlinksrc 0 textlinksrc.h5) ADD_H5_TEST (textlinkfar 0 textlinkfar.h5) - # test for dataset packed bits - SET (TESTTYPE "TEST") - IF (NOT ${USE_PACKED_BITS}) - SET (TESTTYPE "SKIP") - ENDIF (NOT ${USE_PACKED_BITS}) - ADD_SKIP_H5_TEST (tpackedbits 0 ${TESTTYPE} -d /dset1 -M 0,2 tdset.h5) - ADD_SKIP_H5_TEST (tpackedbits2 0 ${TESTTYPE} -d /dset1 -M 0,2,2,1 tdset.h5) + # test for dangling external links + ADD_H5_TEST (textlink 0 textlink.h5) + + ####### test for dataset packed bits ###### + IF (HDF5_USE_H5DUMP_PACKED_BITS) + # Remove any output file left over from previous test run + ADD_TEST ( + NAME H5DUMP_PACKED_BITS-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + tpackedbits.out + tpackedbits.out.err + tpackedbits2.out + tpackedbits2.out.err + ) + ADD_H5_TEST (tpackedbits 0 -d /dset1 -M 0,2 tdset.h5) + ADD_H5_TEST (tpackedbits2 0 -d /dset1 -M 0,2,2,1 tdset.h5) + ENDIF (HDF5_USE_H5DUMP_PACKED_BITS) + + # Remove any output file left over from previous test run + ADD_TEST ( + NAME H5DUMP-XML-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + tall.h5.out + tall.h5.out.err + tall-2A.h5.out + tall-2A.h5.out.err + tarray1.h5.out + tarray1.h5.out.err + tarray2.h5.out + tarray2.h5.out.err + tarray3.h5.out + tarray3.h5.out.err + tarray6.h5.out + tarray6.h5.out.err + tarray7.h5.out + tarray7.h5.out.err + tattr.h5.out + tattr.h5.out.err + tbitfields.h5.out + tbitfields.h5.out.err + tcompound.h5.out + tcompound.h5.out.err + tcompound2.h5.out + tcompound2.h5.out.err + tcompound_complex.h5.out + tcompound_complex.h5.out.err + tdatareg.h5.out + tdatareg.h5.out.err + tdset.h5.out + tdset.h5.out.err + tdset2.h5.out + tdset2.h5.out.err + tempty-dtd-2.h5.out + tempty-dtd-2.h5.out.err + tempty-dtd-uri.h5.out + tempty-dtd-uri.h5.out.err + tempty-dtd.h5.out + tempty-dtd.h5.out.err + tempty-nons-2.h5.out + tempty-nons-2.h5.out.err + tempty-nons-uri.h5.out + tempty-nons-uri.h5.out.err + tempty-nons.h5.out + tempty-nons.h5.out.err + tempty-ns-2.h5.out + tempty-ns-2.h5.out.err + tempty-ns.h5.out + tempty-ns.h5.out.err + tempty.h5.out + tempty.h5.out.err + tenum.h5.out + tenum.h5.out.err + textlink.h5.out + textlink.h5.out.err + tfpformat.h5.out + tfpformat.h5.out.err + tgroup.h5.out + tgroup.h5.out.err + thlink.h5.out + thlink.h5.out.err + tloop.h5.out + tloop.h5.out.err + tloop2.h5.out + tloop2.h5.out.err + tmany.h5.out + tmany.h5.out.err + tname-amp.h5.out + tname-amp.h5.out.err + tname-apos.h5.out + tname-apos.h5.out.err + tname-gt.h5.out + tname-gt.h5.out.err + tname-lt.h5.out + tname-lt.h5.out.err + tname-quot.h5.out + tname-quot.h5.out.err + tname-sp.h5.out + tname-sp.h5.out.err + tnamed_dtype_attr.h5.out + tnamed_dtype_attr.h5.out.err + tnestedcomp.h5.out + tnestedcomp.h5.out.err + tnodata.h5.out + tnodata.h5.out.err + tnoname.h5.out + tnoname.h5.out.err + tobjref.h5.out + tobjref.h5.out.err + topaque.h5.out + topaque.h5.out.err + torderattr1.h5.out + torderattr1.h5.out.err + torderattr2.h5.out + torderattr2.h5.out.err + torderattr3.h5.out + torderattr3.h5.out.err + torderattr4.h5.out + torderattr4.h5.out.err + tref-escapes-at.h5.out + tref-escapes-at.h5.out.err + tref-escapes.h5.out + tref-escapes.h5.out.err + tref.h5.out + tref.h5.out.err + tsaf.h5.out + tsaf.h5.out.err + tslink.h5.out + tslink.h5.out.err + tstr.h5.out + tstr.h5.out.err + tstr2.h5.out + tstr2.h5.out.err + tstring.h5.out + tstring.h5.out.err + tstring-at.h5.out + tstring-at.h5.out.err + tudlink.h5.out + tudlink.h5.out.err + tvldtypes1.h5.out + tvldtypes1.h5.out.err + tvldtypes2.h5.out + tvldtypes2.h5.out.err + tvldtypes3.h5.out + tvldtypes3.h5.out.err + tvldtypes4.h5.out + tvldtypes4.h5.out.err + tvldtypes5.h5.out + tvldtypes5.h5.out.err + tvlstr.h5.out + tvlstr.h5.out.err + ) ########## test XML + + # If using memchecker add tests without using scripts + IF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST (NAME H5DUMP-XML-tgroup COMMAND h5dump --xml tgroup.h5) + ADD_TEST (NAME H5DUMP-XML-tdset COMMAND h5dump --xml tdset.h5) + ADD_TEST (NAME H5DUMP-XML-tattr COMMAND h5dump --xml tattr.h5) + ADD_TEST (NAME H5DUMP-XML-tslink COMMAND h5dump --xml tslink.h5) + ADD_TEST (NAME H5DUMP-XML-thlink COMMAND h5dump --xml thlink.h5) + ENDIF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_XML_H5_TEST (tall.h5 0 tall.h5) ADD_XML_H5_TEST (tattr.h5 0 tattr.h5) ADD_XML_H5_TEST (tbitfields.h5 0 tbitfields.h5) diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in index 338e08c..40af398 100644 --- a/tools/h5dump/Makefile.in +++ b/tools/h5dump/Makefile.in @@ -151,6 +151,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -212,6 +213,7 @@ LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MPE = @MPE@ MPI_GET_SIZE = @MPI_GET_SIZE@ @@ -268,6 +270,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 261fe15..6b1f576 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -132,7 +132,7 @@ static h5tool_format_t dataformat = { "", /*fmt_raw */ "%d", /*fmt_int */ "%u", /*fmt_uint */ - "%d", /*fmt_schar */ + "%hhd", /*fmt_schar */ "%u", /*fmt_uchar */ "%d", /*fmt_short */ "%u", /*fmt_ushort */ @@ -216,7 +216,7 @@ static h5tool_format_t xml_dataformat = { "", /*fmt_raw */ "%d", /*fmt_int */ "%u", /*fmt_uint */ - "%d", /*fmt_schar */ + "%hhd", /*fmt_schar */ "%u", /*fmt_uchar */ "%d", /*fmt_short */ "%u", /*fmt_ushort */ @@ -2211,7 +2211,6 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) unsigned attr_crt_order_flags; hid_t dcpl_id; /* dataset creation property list ID */ - if ((dcpl_id = H5Dget_create_plist(did)) < 0) { error_msg("error in getting creation property list ID\n"); @@ -2646,15 +2645,27 @@ dump_oid(hid_t oid) static void dump_comment(hid_t obj_id) { - char comment[50]; - - comment[0] = '\0'; - H5Oget_comment(obj_id, comment, sizeof(comment)); + size_t buf_size = 0; + char* comment = NULL; + ssize_t cmt_bufsize = -1; + + cmt_bufsize = H5Oget_comment(obj_id, comment, buf_size); + + /* call H5Oget_comment again with the correct value. + * If the call to H5Oget_comment returned an error, skip this block */ + if (cmt_bufsize > 0) { + comment = (char *)HDmalloc((size_t)cmt_bufsize); /* new_size including null terminator */ + if(comment) { + cmt_bufsize = H5Oget_comment(obj_id, comment, cmt_bufsize); + if(cmt_bufsize > 0) { + comment[cmt_bufsize] = '\0'; /* necessary because null char is not returned */ + indentation(indent); + printf("COMMENT \"%s\"\n", comment); + } /* end if */ + HDfree(comment); + } + } - if(comment[0]) { - indentation(indent); - printf("COMMENT \"%s\"\n", comment); - } /* end if */ } /* end dump_comment() */ @@ -3988,7 +3999,7 @@ parse_start: leave(EXIT_SUCCESS); break; case 'w': - nCols = atoi(opt_arg); + nCols = HDatoi(opt_arg); last_was_dset = FALSE; break; case 'a': diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 95caa5e..8401000 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -95,6 +95,7 @@ /*#define FILE64 "tarray8.h5"*/ #define FILE65 "tattrreg.h5" #define FILE66 "file_space.h5" +#define FILE67 "packedbits.h5" @@ -253,6 +254,22 @@ typedef struct s1_t { #define STRATEGY H5F_FILE_SPACE_AGGR_VFD /* File space handling strategy */ #define THRESHOLD10 10 /* Free space section threshold */ +/* "FILE67" macros */ +#define F67_XDIM 8 +#define F67_DATASETU08 "DU08BITS" +#define F67_DATASETS08 "DS08BITS" +#define F67_YDIM8 8 +#define F67_DATASETU16 "DU16BITS" +#define F67_DATASETS16 "DS16BITS" +#define F67_YDIM16 16 +#define F67_DATASETU32 "DU32BITS" +#define F67_DATASETS32 "DS32BITS" +#define F67_YDIM32 32 +#define F67_DATASETU64 "DU64BITS" +#define F67_DATASETS64 "DS64BITS" +#define F67_YDIM64 64 +#define F67_DUMMYDBL "DummyDBL" + static void gent_group(void) { @@ -3383,6 +3400,11 @@ gent_group_comments(void) H5Oset_comment_by_name(group, "/g2/g2.1/g2.1.3", "Comment for group /g2/g2.1/g2.1.3", H5P_DEFAULT); H5Gclose(group); + /* /glongcomment */ + group = H5Gcreate2(fid, "/glongcomment", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + H5Oset_comment_by_name(group, "/glongcomment", "Comment for group /glongcomment with a really, really, really long, long, long comment", H5P_DEFAULT); + H5Gclose(group); + H5Fclose(fid); } @@ -6775,6 +6797,196 @@ gent_fs_strategy_threshold(void) } /*------------------------------------------------------------------------- + * Function: gent_packedbits + * + * Purpose: Generate a file to be used in the h5dump packed bits tests. + * Three datasets of 1, 2 and 4 bytes of unsigned int types are created. + * Three more datasets of 1, 2 and 4 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_packedbits(void) +{ + hid_t fid, dataset, space; + hsize_t dims[2]; + uint8_t dsetu8[F67_XDIM][F67_YDIM8], valu8bits; + uint16_t dsetu16[F67_XDIM][F67_YDIM16], valu16bits; + uint32_t dsetu32[F67_XDIM][F67_YDIM32], valu32bits; + uint64_t dsetu64[F67_XDIM][F67_YDIM64], valu64bits; + int8_t dset8[F67_XDIM][F67_YDIM8], val8bits; + int16_t dset16[F67_XDIM][F67_YDIM16], val16bits; + int32_t dset32[F67_XDIM][F67_YDIM32], val32bits; + int64_t dset64[F67_XDIM][F67_YDIM64], val64bits; + double dsetdbl[F67_XDIM][F67_YDIM8]; + unsigned int i, j; + + fid = H5Fcreate(FILE66, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Dataset of 8 bits unsigned int */ + dims[0] = F67_XDIM; dims[1] = F67_YDIM8; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F67_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; + for(j = 1; j < dims[1]; j++) { + dsetu8[i][j] = dsetu8[i][j-1] << 1; + } + valu8bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_UINT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu8); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 16 bits unsigned int */ + dims[0] = F67_XDIM; dims[1] = F67_YDIM16; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F67_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; + for(j = 1; j < dims[1]; j++) { + dsetu16[i][j] = dsetu16[i][j-1] << 1; + } + valu16bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_UINT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu16); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 32 bits unsigned int */ + dims[0] = F67_XDIM; dims[1] = F67_YDIM32; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F67_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; + for(j = 1; j < dims[1]; j++) { + dsetu32[i][j] = dsetu32[i][j-1] << 1; + } + valu32bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_UINT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu32); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 64 bits unsigned int */ + dims[0] = F67_XDIM; dims[1] = F67_YDIM64; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F67_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; + for(j = 1; j < dims[1]; j++) { + dsetu64[i][j] = dsetu64[i][j-1] << 1; + } + valu64bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_UINT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetu64); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 8 bits signed int */ + dims[0] = F67_XDIM; dims[1] = F67_YDIM8; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F67_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; + for(j = 1; j < dims[1]; j++) { + dset8[i][j] = dset8[i][j-1] << 1; + } + val8bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_INT8, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 16 bits signed int */ + dims[0] = F67_XDIM; dims[1] = F67_YDIM16; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F67_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; + for(j = 1; j < dims[1]; j++) { + dset16[i][j] = dset16[i][j-1] << 1; + } + val16bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_INT16, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset16); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 32 bits signed int */ + dims[0] = F67_XDIM; dims[1] = F67_YDIM32; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F67_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; + for(j = 1; j < dims[1]; j++) { + dset32[i][j] = dset32[i][j-1] << 1; + } + val32bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_INT32, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset32); + H5Sclose(space); + H5Dclose(dataset); + + /* Dataset of 64 bits signed int */ + dims[0] = F67_XDIM; dims[1] = F67_YDIM64; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F67_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; + for(j = 1; j < dims[1]; j++) { + dset64[i][j] = dset64[i][j-1] << 1; + } + val64bits <<= 1; + } + + H5Dwrite(dataset, H5T_NATIVE_INT64, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset64); + H5Sclose(space); + H5Dclose(dataset); + + /* Double Dummy set for failure tests */ + dims[0] = F67_XDIM; dims[1] = F67_YDIM8; + space = H5Screate_simple(2, dims, NULL); + dataset = H5Dcreate2(fid, F67_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; + + H5Dwrite(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dsetdbl); + + H5Sclose(space); + H5Dclose(dataset); + H5Fclose(fid); +} + +/*------------------------------------------------------------------------- * Function: main * *------------------------------------------------------------------------- @@ -6847,6 +7059,7 @@ int main(void) gent_fpformat(); gent_extlinks(); gent_fs_strategy_threshold(); + gent_packedbits(); return 0; } diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 50ff098..1d7a361 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -270,6 +270,8 @@ IMPORTTEST() ############################################################################## ############################################################################## +# test for signed/unsigned datasets +TOOLTEST packedbits.ddl packedbits.h5 # test for displaying groups TOOLTEST tgroup-1.ddl tgroup.h5 # test for displaying the selected groups @@ -574,6 +576,9 @@ TOOLTEST tfpformat.ddl -m %.7f tfpformat.h5 TOOLTEST textlinksrc.ddl textlinksrc.h5 TOOLTEST textlinkfar.ddl textlinkfar.h5 +# test for dangling external links +TOOLTEST textlink.ddl textlink.h5 + # Report test results and exit if test $nerrors -eq 0 ; then |