diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2011-02-22 19:37:06 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2011-02-22 19:37:06 (GMT) |
commit | 727b687ae6c80c9854cb53814fa1c12f27c2994c (patch) | |
tree | fabe359aaddbe3b4d1e2bb58ceb3b94311d66a1c /tools/h5dump | |
parent | 25486d50895fa4a30809d289b9aff4de583a9b84 (diff) | |
download | hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.zip hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.tar.gz hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.tar.bz2 |
[svn-r20146] Description:
Bring r19714:20145 from trunk to revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.6 (amazon) in debug mode
Mac OS X/32 10.6.6 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'tools/h5dump')
-rw-r--r-- | tools/h5dump/CMakeLists.txt | 75 | ||||
-rw-r--r-- | tools/h5dump/Makefile.in | 3 | ||||
-rw-r--r-- | tools/h5dump/h5dump.c | 35 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 314 | ||||
-rw-r--r-- | tools/h5dump/testh5dump.sh.in | 8 |
5 files changed, 415 insertions, 20 deletions
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt index 5458b9d..77f3763 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 @@ -49,6 +48,7 @@ IF (BUILD_TESTING) tall-5s.ddl tallfilters.ddl tarray1.ddl + tarray1_big.ddl tarray2.ddl tarray3.ddl tarray4.ddl @@ -84,6 +84,7 @@ IF (BUILD_TESTING) texternal.ddl textlinksrc.ddl textlinkfar.ddl + textlink.ddl tfamily.ddl tfill.ddl tfletcher32.ddl @@ -219,9 +220,11 @@ IF (BUILD_TESTING) tbin3.ddl tbin4.ddl out3.h5import + packedbits.h5 taindices.h5 tall.h5 tarray1.h5 + tarray1_big.h5 tarray2.h5 tarray3.h5 tarray4.h5 @@ -243,6 +246,7 @@ IF (BUILD_TESTING) textlinkfar.h5 textlinksrc.h5 textlinktar.h5 + textlink.h5 tfamily00000.h5 tfamily00001.h5 tfamily00002.h5 @@ -413,6 +417,10 @@ IF (BUILD_TESTING) -D "TEST_REFERENCE=${resultfile}.ddl" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5DUMP-${resultfile}") ENDMACRO (ADD_H5_TEST file) MACRO (ADD_H5_EXPORT_TEST resultfile targetfile resultcode) @@ -420,11 +428,16 @@ IF (BUILD_TESTING) NAME H5DUMP-output-${resultfile} COMMAND $<TARGET_FILE:h5dump> -d /Dataset1 -s 0 -R -y -o ${PROJECT_BINARY_DIR}/${resultfile}.txt ${PROJECT_BINARY_DIR}/${targetfile} ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5DUMP-output-${resultfile} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") ADD_TEST ( NAME H5DUMP-output-cmp-${resultfile} COMMAND ${CMAKE_COMMAND} -E compare_files ${PROJECT_BINARY_DIR}/${resultfile}.txt ${PROJECT_BINARY_DIR}/${resultfile}.exp ) + SET_TESTS_PROPERTIES (H5DUMP-output-cmp-${resultfile} PROPERTIES DEPENDS H5DUMP-output-${resultfile}) + SET (last_test "H5DUMP-output-cmp-${resultfile}") ENDMACRO (ADD_H5_EXPORT_TEST file) MACRO (ADD_XML_SKIP_H5_TEST skipresultfile skipresultcode testtype) @@ -450,6 +463,10 @@ IF (BUILD_TESTING) -D "TEST_REFERENCE=${resultfile}.xml" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5DUMP-XML-${resultfile} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5DUMP-XML-${resultfile}") ENDMACRO (ADD_XML_H5_TEST file) # -------------------------------------------------------------------- @@ -478,6 +495,8 @@ IF (BUILD_TESTING) NAME H5DUMP-clearall-objects COMMAND ${CMAKE_COMMAND} -E remove + packedbits.out + packedbits.out.err tall-1.out tall-1.out.err tall-2.out @@ -496,6 +515,8 @@ IF (BUILD_TESTING) tallfilters.out.err tarray1.out tarray1.out.err + tarray1_big.out + tarray1_big.out.err tarray2.out tarray2.out.err tarray3.out @@ -566,6 +587,8 @@ IF (BUILD_TESTING) textlinksrc.out.err textlinkfar.out textlinkfar.out.err + textlink.out + textlink.out.err tfamily.out tfamily.out.err tfill.out @@ -691,7 +714,22 @@ IF (BUILD_TESTING) tvms.out tvms.out.err ) - + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5DUMP-clearall-objects PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5DUMP-clearall-objects") + + # 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 @@ -764,6 +802,8 @@ IF (BUILD_TESTING) # test for files with array data ADD_H5_TEST (tarray1 0 tarray1.h5) + # # added for bug# 2092 - tarray1_big.h5 + ADD_H5_TEST (tarray1_big 0 -R tarray1_big.h5) ADD_H5_TEST (tarray2 0 tarray2.h5) ADD_H5_TEST (tarray3 0 tarray3.h5) ADD_H5_TEST (tarray4 0 tarray4.h5) @@ -960,6 +1000,10 @@ IF (BUILD_TESTING) out3.h5 ) ENDIF (NOT HDF5_NOCLEANUP) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5DUMP-clear-objects PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5DUMP-clear-objects") # test for dataset region references ADD_H5_TEST (tdatareg 0 tdatareg.h5) @@ -989,6 +1033,9 @@ IF (BUILD_TESTING) ADD_H5_TEST (textlinksrc 0 textlinksrc.h5) ADD_H5_TEST (textlinkfar 0 textlinkfar.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 @@ -1001,6 +1048,10 @@ IF (BUILD_TESTING) tpackedbits2.out tpackedbits2.out.err ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5DUMP_PACKED_BITS-clearall-objects") 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) @@ -1139,8 +1190,22 @@ IF (BUILD_TESTING) tvlstr.h5.out tvlstr.h5.out.err ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5DUMP-XML-clearall-objects PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5DUMP-XML-clearall-objects") ########## 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 196e5e9..cb30d09 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -54,6 +54,7 @@ #define FILE23 "tvldtypes3.h5" #define FILE24 "tvldtypes4.h5" #define FILE25 "tarray1.h5" +#define FILE25_BIG "tarray1_big.h5" #define FILE26 "tarray2.h5" #define FILE27 "tarray3.h5" #define FILE28 "tarray4.h5" @@ -95,7 +96,8 @@ /*#define FILE64 "tarray8.h5"*/ #define FILE65 "tattrreg.h5" #define FILE66 "file_space.h5" -#define FILE67 "tdset_idx.h5" +#define FILE67 "packedbits.h5" +#define FILE68 "tdset_idx.h5" @@ -254,7 +256,23 @@ typedef struct s1_t { #define STRATEGY H5F_FILE_SPACE_AGGR_VFD /* File space handling strategy */ #define THRESHOLD10 10 /* Free space section threshold */ -/* Declarations for gent_dataset_idx() for "FILE66" */ +/* "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" + +/* Declarations for gent_dataset_idx() for "FILE68" */ #define DSET_FIXED "dset_fixed" #define DSET_FIXED_FILTER "dset_filter" #define DSET_BTREE "dset_btree" @@ -2807,6 +2825,99 @@ static void gent_vldatatypes5(void) assert(ret >= 0); } +/* This is big enough to make h5dump to use hyperslap to read + from file and display portion by portion. This also prints out array indices + via region reference for testing refion reference output. + Note: this was added originally prepared for bug2092. before the fix h5dump didn't + display array indices every 262 x N (N > 0) based on 2000x1000 dims. +*/ +#define SPACE_ARRAY1BIG_DIM 2000 +#define ARRAY1BIG_DIM 1000 + +static void gent_array1_big(void) +{ + int wdata[SPACE_ARRAY1BIG_DIM][ARRAY1BIG_DIM]; /* Information to write */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Datatype ID */ + hsize_t sdims1[] = {SPACE_ARRAY1BIG_DIM}; + hsize_t tdims1[] = {ARRAY1BIG_DIM}; + int i,j; /* counting variables */ + herr_t ret; /* Generic return value */ + + + /* for region reference dataset */ + hid_t dset2; + hid_t sid2; + hsize_t dims2[] = {SPACE1_DIM1}; + hsize_t start[SPACE1_RANK]; /* Starting location of hyperslab */ + hsize_t stride[SPACE1_RANK]; /* Stride of hyperslab */ + hsize_t count[SPACE1_RANK]; /* Element count of hyperslab */ + hsize_t block[SPACE1_RANK]; /* Block size of hyperslab */ + start[0]=0; + stride[0]=1; + count[0]=999; + block[0]=1; + hdset_reg_ref_t *wbuf; /* buffer to write to disk */ + /* Allocate write & read buffers */ + wbuf = (hdset_reg_ref_t*) calloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1); + + /* Allocate and initialize array data to write */ + for(i=0; i<SPACE_ARRAY1BIG_DIM; i++) + for(j=0; j<ARRAY1BIG_DIM; j++) + wdata[i][j]=i*1; + + /* Create file */ + fid1 = H5Fcreate(FILE25_BIG, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /*------------------------- + * Array type dataset + * + /* Create dataspace for datasets */ + sid1 = H5Screate_simple(SPACE1_RANK, sdims1, NULL); + + /* Create a datatype to refer to */ + tid1 = H5Tarray_create2(H5T_NATIVE_INT, ARRAY1_RANK, tdims1); + + /* Create a dataset */ + dataset = H5Dcreate2(fid1, "Dataset1", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + /* Write dataset to disk */ + ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); + assert(ret >= 0); + + /*--------------------------- + * Region Reference dataset + */ + /* Create dataspace for the reference dataset */ + sid2 = H5Screate_simple(SPACE1_RANK, dims2, NULL); + + /* Create a dataset */ + dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_REF_DSETREG, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + /* Create references */ + H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, stride, count, block); + + H5Sget_select_npoints(sid1); + + /* Create Dataset1 region */ + H5Rcreate(&wbuf[0], fid1, "/Dataset1", H5R_DATASET_REGION, sid1); + + /* Write selection to disk */ + H5Dwrite(dset2,H5T_STD_REF_DSETREG,H5S_ALL,H5S_ALL,H5P_DEFAULT,wbuf); + + /* Close Dataset */ + ret = H5Dclose(dataset); + assert(ret >= 0); + ret = H5Tclose(tid1); + assert(ret >= 0); + ret = H5Sclose(sid1); + assert(ret >= 0); + ret = H5Fclose(fid1); + assert(ret >= 0); +} + static void gent_array1(void) { int wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ @@ -3394,6 +3505,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); } @@ -6815,7 +6931,7 @@ gent_dataset_idx(void) ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); assert(ret >= 0); - fid = H5Fcreate(FILE67, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); + fid = H5Fcreate(FILE68, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); dcpl = H5Pcreate(H5P_DATASET_CREATE); dims[0] = CHUNK; @@ -6870,6 +6986,196 @@ gent_dataset_idx(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 * *------------------------------------------------------------------------- @@ -6906,6 +7212,7 @@ int main(void) gent_vldatatypes3(); gent_vldatatypes4(); gent_vldatatypes5(); + gent_array1_big(); gent_array1(); gent_array2(); gent_array3(); @@ -6942,6 +7249,7 @@ int main(void) gent_fpformat(); gent_extlinks(); gent_fs_strategy_threshold(); + gent_packedbits(); gent_dataset_idx(); return 0; diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 1c152da..e289391 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 @@ -342,6 +344,8 @@ TOOLTEST tvlstr.ddl tvlstr.h5 # test for files with array data TOOLTEST tarray1.ddl tarray1.h5 +# # added for bug# 2092 - tarray1_big.h +TOOLTEST tarray1_big.ddl -R tarray1_big.h5 TOOLTEST tarray2.ddl tarray2.h5 TOOLTEST tarray3.ddl tarray3.h5 TOOLTEST tarray4.ddl tarray4.h5 @@ -574,9 +578,13 @@ 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 + # tests for Fixed Array chunk indices TOOLTEST tdset_idx.ddl -p -H tdset_idx.h5 + # Report test results and exit if test $nerrors -eq 0 ; then echo "All $TESTNAME tests passed." |