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/h5diff | |
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/h5diff')
-rw-r--r-- | tools/h5diff/CMakeLists.txt | 20 | ||||
-rw-r--r-- | tools/h5diff/Makefile.in | 3 | ||||
-rw-r--r-- | tools/h5diff/h5diffgentest.c | 664 | ||||
-rw-r--r-- | tools/h5diff/ph5diff_main.c | 200 | ||||
-rw-r--r-- | tools/h5diff/testfiles/h5diff_530.txt | 28 | ||||
-rw-r--r-- | tools/h5diff/testfiles/h5diff_comp_vl_strs.h5 | bin | 8504 -> 18536 bytes | |||
-rwxr-xr-x | tools/h5diff/testh5diff.sh | 18 | ||||
-rwxr-xr-x | tools/h5diff/testph5diff.sh | 3 |
8 files changed, 699 insertions, 237 deletions
diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt index b86a804..3041171 100644 --- a/tools/h5diff/CMakeLists.txt +++ b/tools/h5diff/CMakeLists.txt @@ -14,8 +14,7 @@ ADD_EXECUTABLE (h5diff ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diff_common.c ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diff_main.c ) -H5_NAMING (h5diff) -TARGET_WIN_PROPERTIES (h5diff) +H5_NAMING (h5diff ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5diff ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) SET (H5_DEP_EXECUTABLES h5diff) @@ -32,8 +31,7 @@ IF (BUILD_TESTING) # -------------------------------------------------------------------- IF (HDF5_BUILD_GENERATORS AND NOT BUILD_SHARED_LIBS) ADD_EXECUTABLE (h5diffgentest ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/h5diffgentest.c) - H5_NAMING (h5diffgentest) - TARGET_WIN_PROPERTIES (h5diffgentest) + H5_NAMING (h5diffgentest ${LIB_TYPE}) TARGET_LINK_LIBRARIES (h5diffgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) #ADD_TEST (NAME h5diffgentest COMMAND $<TARGET_FILE:h5diffgentest>) @@ -284,6 +282,10 @@ IF (BUILD_TESTING) -D "TEST_APPEND=EXIT CODE:" -P "${HDF5_RESOURCES_DIR}/runTest.cmake" ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5DIFF-${resultfile}") ENDMACRO (ADD_H5_TEST file) ############################################################################## @@ -607,6 +609,16 @@ IF (BUILD_TESTING) h5diff_90.out h5diff_90.out.err ) + IF (NOT "${last_test}" STREQUAL "") + SET_TESTS_PROPERTIES (H5DIFF-clearall-objects PROPERTIES DEPENDS ${last_test}) + ENDIF (NOT "${last_test}" STREQUAL "") + SET (last_test "H5DIFF-clearall-objects") + + # If using memchecker add tests without using scripts + IF (HDF5_ENABLE_USING_MEMCHECKER) + ADD_TEST (NAME H5DIFF-help COMMAND h5diff -h) + ADD_TEST (NAME H5DIFF-normal-mode COMMAND h5diff ${FILE1} ${FILE2}) + ENDIF (HDF5_ENABLE_USING_MEMCHECKER) # ############################################################################ # # Common usage diff --git a/tools/h5diff/Makefile.in b/tools/h5diff/Makefile.in index 3bfbf8e..457f6c3 100644 --- a/tools/h5diff/Makefile.in +++ b/tools/h5diff/Makefile.in @@ -153,6 +153,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DIRECT_VFD = @DIRECT_VFD@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ @@ -214,6 +215,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@ @@ -270,6 +272,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/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index 176814e..4b397a5 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -3035,12 +3035,12 @@ out: * *-------------------------------------------------------------------------*/ #define STR_RANK 1 -#define VLSTR1_DIM 1 -#define FLSTR2_SIZE 21 -#define FLSTR2_DIM 1 -#define VLSTRARRY3_DIM 3 -#define FLSTRARRY4_DIM 3 -#define FLSTRARRY4_SIZE 30 +#define VLEN_STR_DIM 1 +#define FIXLEN_STR_SIZE 21 +#define FIXLEN_STR_DIM 1 +#define VLEN_STR_ARRY_DIM 3 +#define FIXLEN_STR_ARRY_DIM 3 +#define FIXLEN_STR_ARRY_SIZE 30 #define COMP_RANK 1 #define COMP_DIM 1 static int test_comp_vlen_strings(const char *fname1) @@ -3049,88 +3049,292 @@ static int test_comp_vlen_strings(const char *fname1) hid_t fid1; /* file id */ - /* compound datatype */ - typedef struct comp_t - { - char *str1; /* vlen string */ - char *str1_again; /* vlen string */ - char str2[FLSTR2_SIZE]; /* fixed len string */ - char str2_again[FLSTR2_SIZE]; /* fixed len string */ - char *str3[VLSTRARRY3_DIM]; /* vlen string array */ - char *str3_again[VLSTRARRY3_DIM]; /* vlen string array */ - char str4[FLSTRARRY4_DIM][FLSTRARRY4_SIZE]; /* fixed len string array */ - char str4_again[FLSTRARRY4_DIM][FLSTRARRY4_SIZE]; /* fixed len string array */ - } comp_t; - - /* vlen string1 */ - hid_t sid_str1=0; /* dataspace ID */ - hid_t tid_str1=0; /* datatype ID */ - hid_t did_str1=0; /* dataset ID */ - const char vlstr1_buf[]= { + /* compound1 datatype */ + typedef struct comp1_t + { + char *str_vlen; /* vlen string */ + char *str_vlen_repeat; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + } comp1_t; + + /* compound2 datatype */ + typedef struct comp2_t + { + char *str_vlen; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen_repeat; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + } comp2_t; + + /* compound3 datatype */ + typedef struct comp3_t + { + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen; /* vlen string */ + char *str_vlen_repeat; /* vlen string */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + } comp3_t; + + /* compound4 datatype */ + typedef struct comp4_t + { + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen_repeat; /* vlen string */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + } comp4_t; + + /* compound5 datatype */ + typedef struct comp5_t + { + char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_vlen; /* vlen string */ + char *str_vlen_repeat; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + } comp5_t; + + /* compound6 datatype */ + typedef struct comp6_t + { + char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_vlen; /* vlen string */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen_repeat; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + } comp6_t; + + /* compound7 datatype */ + typedef struct comp7_t + { + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen; /* vlen string */ + char *str_vlen_repeat; /* vlen string */ + } comp7_t; + + /* compound8 datatype */ + typedef struct comp8_t + { + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen; /* vlen string */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + char *str_vlen_repeat; /* vlen string */ + } comp8_t; + + /* compound9 datatype */ + typedef struct comp9_t + { + char str_array_fixlen[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char str_fixlen_array_again[FIXLEN_STR_ARRY_DIM][FIXLEN_STR_ARRY_SIZE]; /* fixed len string array */ + char *str_array_vlen[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char *str_vlen_array_again[VLEN_STR_ARRY_DIM]; /* vlen string array */ + char str_fixlen[FIXLEN_STR_SIZE]; /* fixed len string */ + int int_data1; + hobj_ref_t objref1; /* reference */ + char str_fixlen_repeat[FIXLEN_STR_SIZE]; /* fixed len string */ + hobj_ref_t objref2; /* reference */ + char *str_vlen; /* vlen string */ + int int_data2; + char *str_vlen_repeat; /* vlen string */ + hobj_ref_t objref3; /* reference */ + int int_data3; + } comp9_t; + + /* vlen string */ + hid_t sid_vlen_str=0; /* dataspace ID */ + hid_t tid_vlen_str=0; /* datatype ID */ + const char vlen_str_buf[]= { "Variable length string" }; - hsize_t dims_str1[] = {VLSTR1_DIM}; + hsize_t dims_vlen_str[] = {VLEN_STR_DIM}; - /* fixlen string2 */ - hid_t sid_str2=0; /* dataspace ID */ - hid_t tid_str2=0; /* datatype ID */ - hid_t did_str2=0; /* dataset ID */ - const char flstr2_buf[FLSTR2_SIZE]= { + /* fixlen string */ + hid_t sid_fixlen_str=0; /* dataspace ID */ + hid_t tid_fixlen_str=0; /* datatype ID */ + const char fixlen_str_buf[FIXLEN_STR_SIZE]= { "Fixed length string" }; - hsize_t dims_str2[] = {FLSTR2_DIM}; - - /* vlen string3 array */ - hid_t sid_str3=0; /* dataspace ID */ - hid_t tid_str3=0; /* datatype ID */ - hid_t tid_str3_array=0; /* datatype ID */ - hid_t did_str3=0; /* dataset ID */ - const char *vlstr3_buf[VLSTRARRY3_DIM]= { + hsize_t dims_fixlen_str[] = {FIXLEN_STR_DIM}; + + /* vlen string array */ + hid_t sid_vlen_str_array=0; /* dataspace ID */ + hid_t tid_vlen_str_array_pre=0; /* datatype ID */ + hid_t tid_vlen_str_array=0; /* datatype ID */ + const char *vlen_str_array_buf[VLEN_STR_ARRY_DIM]= { "1 - Variable length string Array", "2 - Testing variable length string array in compound type", "3 - Four score and seven\n years ago our forefathers brought forth on this continent a new nation," }; - hsize_t dims_str3[] = {VLSTRARRY3_DIM}; - - /* fixlen string array 4 */ - hid_t sid_str4=0; /* dataspace ID */ - hid_t tid_str4=0; /* datatype ID */ - hid_t tid_str4_array=0; /* datatype ID */ - hid_t did_str4=0; /* dataset ID */ - const char *flstr4_buf[FLSTRARRY4_DIM]= { + hsize_t dims_vlen_str_array[] = {VLEN_STR_ARRY_DIM}; + + /* fixlen string array */ + hid_t sid_fixlen_str_array=0; /* dataspace ID */ + hid_t tid_fixlen_str_array_pre=0; /* datatype ID */ + hid_t tid_fixlen_str_array=0; /* datatype ID */ + const char *fixlen_str_array_buf[FIXLEN_STR_ARRY_DIM]= { "1 - Fixed length string Array", "2 - Fixed length string Array", "3 - Fixed length string Array" }; - hsize_t dims_str4[] = {FLSTRARRY4_DIM}; + hsize_t dims_fixlen_str_array[] = {FIXLEN_STR_ARRY_DIM}; + + /* objref */ + hsize_t objref_dims[1]={1}; /*------------------------------------------ * compound dataset *------------------------------------------*/ hid_t sid_comp=0; /* dataspace ID */ - hid_t tid_comp=0; /* datatype ID */ + hid_t tid1_comp=0; /* datatype ID */ + hid_t tid2_comp=0; /* datatype ID */ + hid_t tid3_comp=0; /* datatype ID */ + hid_t tid4_comp=0; /* datatype ID */ + hid_t tid5_comp=0; /* datatype ID */ + hid_t tid6_comp=0; /* datatype ID */ + hid_t tid7_comp=0; /* datatype ID */ + hid_t tid8_comp=0; /* datatype ID */ + hid_t tid9_comp=0; /* datatype ID */ hid_t did_comp=0; /* dataset ID */ hsize_t dims_comp[] = {COMP_DIM}; herr_t status = SUCCEED; /* make compound strings data */ - comp_t comp_buf; + comp1_t comp1_buf; + comp2_t comp2_buf; + comp3_t comp3_buf; + comp4_t comp4_buf; + comp5_t comp5_buf; + comp6_t comp6_buf; + comp7_t comp7_buf; + comp8_t comp8_buf; + comp9_t comp9_buf; + + /* copy vlen string data to compound buffers */ + comp1_buf.str_vlen = comp1_buf.str_vlen_repeat = vlen_str_buf; + comp2_buf.str_vlen = comp2_buf.str_vlen_repeat = vlen_str_buf; + comp3_buf.str_vlen = comp3_buf.str_vlen_repeat = vlen_str_buf; + comp4_buf.str_vlen = comp4_buf.str_vlen_repeat = vlen_str_buf; + comp5_buf.str_vlen = comp5_buf.str_vlen_repeat = vlen_str_buf; + comp6_buf.str_vlen = comp6_buf.str_vlen_repeat = vlen_str_buf; + comp7_buf.str_vlen = comp7_buf.str_vlen_repeat = vlen_str_buf; + comp8_buf.str_vlen = comp8_buf.str_vlen_repeat = vlen_str_buf; + comp9_buf.str_vlen = comp9_buf.str_vlen_repeat = vlen_str_buf; + + /* copy fixlen string data to compound buffers */ + HDstrcpy(comp1_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp1_buf.str_fixlen_repeat, fixlen_str_buf); + + HDstrcpy(comp2_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp2_buf.str_fixlen_repeat, fixlen_str_buf); + + HDstrcpy(comp3_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp3_buf.str_fixlen_repeat, fixlen_str_buf); + + HDstrcpy(comp3_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp3_buf.str_fixlen_repeat, fixlen_str_buf); + + HDstrcpy(comp4_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp4_buf.str_fixlen_repeat, fixlen_str_buf); + + HDstrcpy(comp5_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp5_buf.str_fixlen_repeat, fixlen_str_buf); + + HDstrcpy(comp6_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp6_buf.str_fixlen_repeat, fixlen_str_buf); - /* copy string1 type to compound buffer */ - comp_buf.str1 = comp_buf.str1_again = vlstr1_buf; - /* copy string2 type to compound buffer */ - HDstrcpy(comp_buf.str2, flstr2_buf); - HDstrcpy(comp_buf.str2_again, flstr2_buf); - /* copy string3 type to compound buffer */ - for (i=0; i < VLSTRARRY3_DIM; i++) - comp_buf.str3[i] = comp_buf.str3_again[i] = vlstr3_buf[i]; - /* copy string4 type to compound buffer */ - for (i=0; i < FLSTRARRY4_DIM; i++) + HDstrcpy(comp7_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp7_buf.str_fixlen_repeat, fixlen_str_buf); + + HDstrcpy(comp8_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp8_buf.str_fixlen_repeat, fixlen_str_buf); + + HDstrcpy(comp9_buf.str_fixlen, fixlen_str_buf); + HDstrcpy(comp9_buf.str_fixlen_repeat, fixlen_str_buf); + + /* copy vlen string array data to compound buffers */ + for (i=0; i < VLEN_STR_ARRY_DIM; i++) { - HDstrcpy(comp_buf.str4[i], flstr4_buf[i]); - HDstrcpy(comp_buf.str4_again[i], flstr4_buf[i]); + comp1_buf.str_array_vlen[i] = comp1_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp2_buf.str_array_vlen[i] = comp2_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp3_buf.str_array_vlen[i] = comp3_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp4_buf.str_array_vlen[i] = comp4_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp5_buf.str_array_vlen[i] = comp5_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp6_buf.str_array_vlen[i] = comp6_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp7_buf.str_array_vlen[i] = comp7_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp8_buf.str_array_vlen[i] = comp8_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + comp9_buf.str_array_vlen[i] = comp9_buf.str_vlen_array_again[i] = vlen_str_array_buf[i]; + } + /* copy fixlen string attay data to compound buffers */ + for (i=0; i < FIXLEN_STR_ARRY_DIM; i++) + { + HDstrcpy(comp1_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); + HDstrcpy(comp1_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); + + HDstrcpy(comp2_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); + HDstrcpy(comp2_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); + + HDstrcpy(comp3_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); + HDstrcpy(comp3_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); + + HDstrcpy(comp4_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); + HDstrcpy(comp4_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); + + HDstrcpy(comp5_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); + HDstrcpy(comp5_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); + + HDstrcpy(comp6_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); + HDstrcpy(comp6_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); + + HDstrcpy(comp7_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); + HDstrcpy(comp7_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); + + HDstrcpy(comp8_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); + HDstrcpy(comp8_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); + + HDstrcpy(comp9_buf.str_array_fixlen[i], fixlen_str_array_buf[i]); + HDstrcpy(comp9_buf.str_fixlen_array_again[i], fixlen_str_array_buf[i]); + } + + /* int data */ + comp9_buf.int_data1 = 10; + comp9_buf.int_data2 = 20; + comp9_buf.int_data3 = 30; + + /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ @@ -3145,16 +3349,16 @@ static int test_comp_vlen_strings(const char *fname1) /*----------------------------------------------------------------------- * Variable length String1 - Create space and type *------------------------------------------------------------------------*/ - sid_str1 = H5Screate_simple(STR_RANK, dims_str1, NULL); - if (sid_str1 < 0) + sid_vlen_str = H5Screate_simple(STR_RANK, dims_vlen_str, NULL); + if (sid_vlen_str < 0) { fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; } - tid_str1 = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid_str1, H5T_VARIABLE); + tid_vlen_str = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid_vlen_str, H5T_VARIABLE); if (status < 0) { fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); @@ -3165,16 +3369,16 @@ static int test_comp_vlen_strings(const char *fname1) /*----------------------------------------------------------------------- * Fixed length String2 - Create space and type *------------------------------------------------------------------------*/ - sid_str2 = H5Screate_simple(STR_RANK, dims_str2, NULL); - if (sid_str2 < 0) + sid_fixlen_str = H5Screate_simple(STR_RANK, dims_fixlen_str, NULL); + if (sid_fixlen_str < 0) { fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; } - tid_str2 = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid_str2, FLSTR2_SIZE); + tid_fixlen_str = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid_fixlen_str, FIXLEN_STR_SIZE); if (status < 0) { fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); @@ -3185,16 +3389,16 @@ static int test_comp_vlen_strings(const char *fname1) /*----------------------------------------------------------------------- * Fixed length String3 array - Create space and type *------------------------------------------------------------------------*/ - sid_str3 = H5Screate_simple(STR_RANK, dims_str3, NULL); - if (sid_str3 < 0) + sid_vlen_str_array = H5Screate_simple(STR_RANK, dims_vlen_str_array, NULL); + if (sid_vlen_str_array < 0) { fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; } - tid_str3 = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid_str3, H5T_VARIABLE); + tid_vlen_str_array_pre = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid_vlen_str_array_pre, H5T_VARIABLE); if (status < 0) { fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); @@ -3203,8 +3407,8 @@ static int test_comp_vlen_strings(const char *fname1) } /* Create the array data type for the string array */ - tid_str3_array = H5Tarray_create2(tid_str3, COMP_RANK, dims_str3); - if (tid_str3_array < 0) + tid_vlen_str_array = H5Tarray_create2(tid_vlen_str_array_pre, COMP_RANK, dims_vlen_str_array); + if (tid_vlen_str_array < 0) { fprintf(stderr, "Error: %s> H5Tarray_create2 failed.\n", fname1); status = FAIL; @@ -3214,16 +3418,16 @@ static int test_comp_vlen_strings(const char *fname1) /*----------------------------------------------------------------------- * Variable length String4 array - Create space and type *------------------------------------------------------------------------*/ - sid_str4 = H5Screate_simple(STR_RANK, dims_str4, NULL); - if (sid_str4 < 0) + sid_fixlen_str_array = H5Screate_simple(STR_RANK, dims_fixlen_str_array, NULL); + if (sid_fixlen_str_array < 0) { fprintf(stderr, "Error: %s> H5Screate_simple failed.\n", fname1); status = FAIL; goto out; } - tid_str4 = H5Tcopy(H5T_C_S1); - status = H5Tset_size(tid_str4, FLSTRARRY4_SIZE); + tid_fixlen_str_array_pre = H5Tcopy(H5T_C_S1); + status = H5Tset_size(tid_fixlen_str_array_pre, FIXLEN_STR_ARRY_SIZE); if (status < 0) { fprintf(stderr, "Error: %s> H5Tset_size failed.\n", fname1); @@ -3231,8 +3435,8 @@ static int test_comp_vlen_strings(const char *fname1) goto out; } /* Create the array data type for the string array */ - tid_str4_array = H5Tarray_create2(tid_str4, COMP_RANK, dims_str4); - if (tid_str4_array < 0) + tid_fixlen_str_array = H5Tarray_create2(tid_fixlen_str_array_pre, COMP_RANK, dims_fixlen_str_array); + if (tid_fixlen_str_array < 0) { fprintf(stderr, "Error: %s> H5Tarray_create2 failed.\n", fname1); status = FAIL; @@ -3249,66 +3453,270 @@ static int test_comp_vlen_strings(const char *fname1) status = FAIL; goto out; } - tid_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp_t)); - H5Tinsert(tid_comp, "VLEN_STR1", HOFFSET(comp_t, str1), tid_str1 ); - H5Tinsert(tid_comp, "VLEN_STR2", HOFFSET(comp_t, str1_again), tid_str1 ); - H5Tinsert(tid_comp, "FIXLEN_STR1", HOFFSET(comp_t, str2), tid_str2 ); - H5Tinsert(tid_comp, "FIXLEN_STR2", HOFFSET(comp_t, str2_again), tid_str2 ); - H5Tinsert(tid_comp, "VLEN_STR_ARRAY1", HOFFSET(comp_t, str3), tid_str3_array); - H5Tinsert(tid_comp, "VLEN_STR_ARRAY2", HOFFSET(comp_t, str3_again), tid_str3_array); - H5Tinsert(tid_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp_t, str4), tid_str4_array); - H5Tinsert(tid_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp_t, str4_again), tid_str4_array); - - /* Write data to compound dataset buffer */ - did_comp = H5Dcreate2(fid1, "Compound_dset", tid_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - status = H5Dwrite(did_comp, tid_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp_buf); + tid1_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp1_t)); + tid2_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp2_t)); + tid3_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp3_t)); + tid4_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp4_t)); + tid5_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp5_t)); + tid6_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp6_t)); + tid7_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp7_t)); + tid8_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp8_t)); + tid9_comp = H5Tcreate (H5T_COMPOUND, sizeof(comp9_t)); + + /* compound 1 */ + H5Tinsert(tid1_comp, "VLEN_STR1", HOFFSET(comp1_t, str_vlen), tid_vlen_str ); + H5Tinsert(tid1_comp, "VLEN_STR2", HOFFSET(comp1_t, str_vlen_repeat), tid_vlen_str ); + H5Tinsert(tid1_comp, "FIXLEN_STR1", HOFFSET(comp1_t, str_fixlen), tid_fixlen_str ); + H5Tinsert(tid1_comp, "FIXLEN_STR2", HOFFSET(comp1_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid1_comp, "VLEN_STR_ARRAY1", HOFFSET(comp1_t, str_array_vlen), tid_vlen_str_array); + H5Tinsert(tid1_comp, "VLEN_STR_ARRAY2", HOFFSET(comp1_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid1_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp1_t, str_array_fixlen), tid_fixlen_str_array); + H5Tinsert(tid1_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp1_t, str_fixlen_array_again), tid_fixlen_str_array); + + /* compound 2 */ + H5Tinsert(tid2_comp, "VLEN_STR1", HOFFSET(comp2_t, str_vlen), tid_vlen_str ); + H5Tinsert(tid2_comp, "VLEN_STR2", HOFFSET(comp2_t, str_vlen_repeat), tid_vlen_str ); + H5Tinsert(tid2_comp, "FIXLEN_STR1", HOFFSET(comp2_t, str_fixlen), tid_fixlen_str ); + H5Tinsert(tid2_comp, "FIXLEN_STR2", HOFFSET(comp2_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid2_comp, "VLEN_STR_ARRAY1", HOFFSET(comp2_t, str_array_vlen), tid_vlen_str_array); + H5Tinsert(tid2_comp, "VLEN_STR_ARRAY2", HOFFSET(comp2_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid2_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp2_t, str_array_fixlen), tid_fixlen_str_array); + H5Tinsert(tid2_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp2_t, str_fixlen_array_again), tid_fixlen_str_array); + + /* compound 3 */ + H5Tinsert(tid3_comp, "VLEN_STR1", HOFFSET(comp3_t, str_vlen), tid_vlen_str ); + H5Tinsert(tid3_comp, "VLEN_STR2", HOFFSET(comp3_t, str_vlen_repeat), tid_vlen_str ); + H5Tinsert(tid3_comp, "FIXLEN_STR1", HOFFSET(comp3_t, str_fixlen), tid_fixlen_str ); + H5Tinsert(tid3_comp, "FIXLEN_STR2", HOFFSET(comp3_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid3_comp, "VLEN_STR_ARRAY1", HOFFSET(comp3_t, str_array_vlen), tid_vlen_str_array); + H5Tinsert(tid3_comp, "VLEN_STR_ARRAY2", HOFFSET(comp3_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid3_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp3_t, str_array_fixlen), tid_fixlen_str_array); + H5Tinsert(tid3_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp3_t, str_fixlen_array_again), tid_fixlen_str_array); + + /* compound 4 */ + H5Tinsert(tid4_comp, "VLEN_STR1", HOFFSET(comp4_t, str_vlen), tid_vlen_str ); + H5Tinsert(tid4_comp, "VLEN_STR2", HOFFSET(comp4_t, str_vlen_repeat), tid_vlen_str ); + H5Tinsert(tid4_comp, "FIXLEN_STR1", HOFFSET(comp4_t, str_fixlen), tid_fixlen_str ); + H5Tinsert(tid4_comp, "FIXLEN_STR2", HOFFSET(comp4_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid4_comp, "VLEN_STR_ARRAY1", HOFFSET(comp4_t, str_array_vlen), tid_vlen_str_array); + H5Tinsert(tid4_comp, "VLEN_STR_ARRAY2", HOFFSET(comp4_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid4_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp4_t, str_array_fixlen), tid_fixlen_str_array); + H5Tinsert(tid4_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp4_t, str_fixlen_array_again), tid_fixlen_str_array); + + /* compound 5 */ + H5Tinsert(tid5_comp, "VLEN_STR1", HOFFSET(comp5_t, str_vlen), tid_vlen_str ); + H5Tinsert(tid5_comp, "VLEN_STR2", HOFFSET(comp5_t, str_vlen_repeat), tid_vlen_str ); + H5Tinsert(tid5_comp, "FIXLEN_STR1", HOFFSET(comp5_t, str_fixlen), tid_fixlen_str ); + H5Tinsert(tid5_comp, "FIXLEN_STR2", HOFFSET(comp5_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid5_comp, "VLEN_STR_ARRAY1", HOFFSET(comp5_t, str_array_vlen), tid_vlen_str_array); + H5Tinsert(tid5_comp, "VLEN_STR_ARRAY2", HOFFSET(comp5_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid5_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp5_t, str_array_fixlen), tid_fixlen_str_array); + H5Tinsert(tid5_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp5_t, str_fixlen_array_again), tid_fixlen_str_array); + + /* compound 6 */ + H5Tinsert(tid6_comp, "VLEN_STR1", HOFFSET(comp6_t, str_vlen), tid_vlen_str ); + H5Tinsert(tid6_comp, "VLEN_STR2", HOFFSET(comp6_t, str_vlen_repeat), tid_vlen_str ); + H5Tinsert(tid6_comp, "FIXLEN_STR1", HOFFSET(comp6_t, str_fixlen), tid_fixlen_str ); + H5Tinsert(tid6_comp, "FIXLEN_STR2", HOFFSET(comp6_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid6_comp, "VLEN_STR_ARRAY1", HOFFSET(comp6_t, str_array_vlen), tid_vlen_str_array); + H5Tinsert(tid6_comp, "VLEN_STR_ARRAY2", HOFFSET(comp6_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid6_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp6_t, str_array_fixlen), tid_fixlen_str_array); + H5Tinsert(tid6_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp6_t, str_fixlen_array_again), tid_fixlen_str_array); + + /* compound 7 */ + H5Tinsert(tid7_comp, "VLEN_STR1", HOFFSET(comp7_t, str_vlen), tid_vlen_str ); + H5Tinsert(tid7_comp, "VLEN_STR2", HOFFSET(comp7_t, str_vlen_repeat), tid_vlen_str ); + H5Tinsert(tid7_comp, "FIXLEN_STR1", HOFFSET(comp7_t, str_fixlen), tid_fixlen_str ); + H5Tinsert(tid7_comp, "FIXLEN_STR2", HOFFSET(comp7_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid7_comp, "VLEN_STR_ARRAY1", HOFFSET(comp7_t, str_array_vlen), tid_vlen_str_array); + H5Tinsert(tid7_comp, "VLEN_STR_ARRAY2", HOFFSET(comp7_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid7_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp7_t, str_array_fixlen), tid_fixlen_str_array); + H5Tinsert(tid7_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp7_t, str_fixlen_array_again), tid_fixlen_str_array); + + /* compound 8 */ + H5Tinsert(tid8_comp, "VLEN_STR1", HOFFSET(comp8_t, str_vlen), tid_vlen_str ); + H5Tinsert(tid8_comp, "VLEN_STR2", HOFFSET(comp8_t, str_vlen_repeat), tid_vlen_str ); + H5Tinsert(tid8_comp, "FIXLEN_STR1", HOFFSET(comp8_t, str_fixlen), tid_fixlen_str ); + H5Tinsert(tid8_comp, "FIXLEN_STR2", HOFFSET(comp8_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid8_comp, "VLEN_STR_ARRAY1", HOFFSET(comp8_t, str_array_vlen), tid_vlen_str_array); + H5Tinsert(tid8_comp, "VLEN_STR_ARRAY2", HOFFSET(comp8_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid8_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp8_t, str_array_fixlen), tid_fixlen_str_array); + H5Tinsert(tid8_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp8_t, str_fixlen_array_again), tid_fixlen_str_array); + + /* compound 9 */ + H5Tinsert(tid9_comp, "VLEN_STR1", HOFFSET(comp9_t, str_vlen), tid_vlen_str ); + H5Tinsert(tid9_comp, "VLEN_STR2", HOFFSET(comp9_t, str_vlen_repeat), tid_vlen_str ); + H5Tinsert(tid9_comp, "FIXLEN_STR1", HOFFSET(comp9_t, str_fixlen), tid_fixlen_str ); + H5Tinsert(tid9_comp, "FIXLEN_STR2", HOFFSET(comp9_t, str_fixlen_repeat), tid_fixlen_str ); + H5Tinsert(tid9_comp, "VLEN_STR_ARRAY1", HOFFSET(comp9_t, str_array_vlen), tid_vlen_str_array); + H5Tinsert(tid9_comp, "VLEN_STR_ARRAY2", HOFFSET(comp9_t, str_vlen_array_again), tid_vlen_str_array); + H5Tinsert(tid9_comp, "FIXLEN_STR_ARRAY1", HOFFSET(comp9_t, str_array_fixlen), tid_fixlen_str_array); + H5Tinsert(tid9_comp, "FIXLEN_STR_ARRAY2", HOFFSET(comp9_t, str_fixlen_array_again), tid_fixlen_str_array); + H5Tinsert(tid9_comp, "INT_DATA1", HOFFSET(comp9_t, int_data1), H5T_STD_I32LE); + H5Tinsert(tid9_comp, "INT_DATA2", HOFFSET(comp9_t, int_data2), H5T_STD_I32BE); + H5Tinsert(tid9_comp, "INT_DATA3", HOFFSET(comp9_t, int_data3), H5T_STD_I32LE); + H5Tinsert(tid9_comp, "OBJREF1", HOFFSET(comp9_t, objref1), H5T_STD_REF_OBJ); + H5Tinsert(tid9_comp, "OBJREF2", HOFFSET(comp9_t, objref2), H5T_STD_REF_OBJ); + H5Tinsert(tid9_comp, "OBJREF3", HOFFSET(comp9_t, objref3), H5T_STD_REF_OBJ); + + + /* Write data to compound 1 dataset buffer */ + did_comp = H5Dcreate2(fid1, "Compound_dset1", tid1_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did_comp, tid1_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp1_buf); if (status < 0) { fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); status = FAIL; goto out; } + H5Dclose(did_comp); + + /* Write data to compound 2 dataset buffer */ + did_comp = H5Dcreate2(fid1, "Compound_dset2", tid2_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did_comp, tid2_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp2_buf); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + status = FAIL; + goto out; + } + H5Dclose(did_comp); + + /* Write data to compound 3 dataset buffer */ + did_comp = H5Dcreate2(fid1, "Compound_dset3", tid3_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did_comp, tid3_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp3_buf); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + status = FAIL; + goto out; + } + H5Dclose(did_comp); + + /* Write data to compound 4 dataset buffer */ + did_comp = H5Dcreate2(fid1, "Compound_dset4", tid4_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did_comp, tid4_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp4_buf); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + status = FAIL; + goto out; + } + H5Dclose(did_comp); + + /* Write data to compound 5 dataset buffer */ + did_comp = H5Dcreate2(fid1, "Compound_dset5", tid5_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did_comp, tid5_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp5_buf); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + status = FAIL; + goto out; + } + H5Dclose(did_comp); + + /* Write data to compound 6 dataset buffer */ + did_comp = H5Dcreate2(fid1, "Compound_dset6", tid6_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did_comp, tid6_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp6_buf); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + status = FAIL; + goto out; + } + H5Dclose(did_comp); + + /* Write data to compound 7 dataset buffer */ + did_comp = H5Dcreate2(fid1, "Compound_dset7", tid7_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did_comp, tid7_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp7_buf); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + status = FAIL; + goto out; + } + H5Dclose(did_comp); + + /* Write data to compound 8 dataset buffer */ + did_comp = H5Dcreate2(fid1, "Compound_dset8", tid8_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + status = H5Dwrite(did_comp, tid8_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp8_buf); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + status = FAIL; + goto out; + } + H5Dclose(did_comp); + + /* Write data to compound 9 dataset buffer */ + did_comp = H5Dcreate2(fid1, "Compound_dset9", tid9_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + /* obj references */ + status=H5Rcreate(&(comp9_buf.objref1),fid1,"/Compound_dset2",H5R_OBJECT,-1); + status=H5Rcreate(&(comp9_buf.objref2),fid1,"/Compound_dset3",H5R_OBJECT,-1); + status=H5Rcreate(&(comp9_buf.objref3),fid1,"/Compound_dset4",H5R_OBJECT,-1); + + status = H5Dwrite(did_comp, tid9_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp9_buf); + if (status < 0) + { + fprintf(stderr, "Error: %s> H5Dwrite failed.\n", fname1); + status = FAIL; + goto out; + } + + + H5Dclose(did_comp); + + did_comp=0; out: /*----------------------------------------------------------------------- * Close *-----------------------------------------------------------------------*/ if(fid1) H5Fclose(fid1); - /* string1 */ - if(tid_str1) - H5Tclose(tid_str1); - if(did_str1) - H5Dclose(did_str1); - if(sid_str1) - H5Sclose(sid_str1); - /* string2 */ - if(tid_str2) - H5Tclose(tid_str2); - if(did_str2) - H5Dclose(did_str2); - if(sid_str2) - H5Sclose(sid_str2); - /* string3 */ - if(tid_str3) - H5Tclose(tid_str3); - if(tid_str3_array) - H5Tclose(tid_str3_array); - if(did_str3) - H5Dclose(did_str3); - if(sid_str3) - H5Sclose(sid_str3); - /* string4 */ - if(tid_str4) - H5Tclose(tid_str4); - if(tid_str4_array) - H5Tclose(tid_str4_array); - if(did_str4) - H5Dclose(did_str4); - if(sid_str4) - H5Sclose(sid_str4); + /* vlen string */ + if(tid_vlen_str) + H5Tclose(tid_vlen_str); + if(sid_vlen_str) + H5Sclose(sid_vlen_str); + /* fixed len string */ + if(tid_fixlen_str) + H5Tclose(tid_fixlen_str); + if(sid_fixlen_str) + H5Sclose(sid_fixlen_str); + /* vlen string array */ + if(tid_vlen_str_array_pre) + H5Tclose(tid_vlen_str_array_pre); + if(tid_vlen_str_array) + H5Tclose(tid_vlen_str_array); + if(sid_vlen_str_array) + H5Sclose(sid_vlen_str_array); + /* fixed len string array */ + if(tid_fixlen_str_array_pre) + H5Tclose(tid_fixlen_str_array_pre); + if(tid_fixlen_str_array) + H5Tclose(tid_fixlen_str_array); + if(sid_fixlen_str_array) + H5Sclose(sid_fixlen_str_array); /* compound */ - if(tid_comp) - H5Tclose(tid_comp); + if(tid1_comp) + H5Tclose(tid1_comp); + if(tid2_comp) + H5Tclose(tid2_comp); + if(tid3_comp) + H5Tclose(tid3_comp); + if(tid4_comp) + H5Tclose(tid4_comp); + if(tid5_comp) + H5Tclose(tid5_comp); + if(tid6_comp) + H5Tclose(tid6_comp); + if(tid7_comp) + H5Tclose(tid7_comp); + if(tid8_comp) + H5Tclose(tid8_comp); + if(tid9_comp) + H5Tclose(tid9_comp); if(did_comp) H5Dclose(did_comp); if(sid_comp) diff --git a/tools/h5diff/ph5diff_main.c b/tools/h5diff/ph5diff_main.c index f6b0dba..bac1086 100644 --- a/tools/h5diff/ph5diff_main.c +++ b/tools/h5diff/ph5diff_main.c @@ -87,31 +87,34 @@ int main(int argc, const char *argv[]) h5diff(fname1, fname2, objname1, objname2, &options); print_info(&options); + } + /* Parallel h5diff */ + else { - MPI_Finalize(); + /* Have the manager process the command-line */ + if(nID == 0) + { + parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options); - return 0; - } + h5diff(fname1, fname2, objname1, objname2, &options); - /* Have the manager process the command-line */ - if(nID == 0) - { - parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &options); + MPI_Barrier(MPI_COMM_WORLD); - h5diff(fname1, fname2, objname1, objname2, &options); + print_info(&options); + print_manager_output(); + } + /* All other tasks become workers and wait for assignments. */ + else { + ph5diff_worker(nID); - MPI_Barrier(MPI_COMM_WORLD); + MPI_Barrier(MPI_COMM_WORLD); + } /* end else */ - print_info(&options); - print_manager_output(); + } /* end else */ - MPI_Finalize(); + MPI_Finalize(); - return 0; - } - /* All other tasks become workers and wait for assignments. */ - else - ph5diff_worker(nID); + return 0; } /*------------------------------------------------------------------------- @@ -141,107 +144,104 @@ ph5diff_worker(int nID) int i; MPI_Status Status; - MPI_Comm_rank(MPI_COMM_WORLD, &nID); outBuffOffset = 0; MPI_Recv(filenames, MAX_FILENAME*2, MPI_CHAR, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &Status); if(Status.MPI_TAG == MPI_TAG_PARALLEL) { - /* disable error reporting */ - H5E_BEGIN_TRY - { - /* Open the files */ - if ((file1_id = H5Fopen (filenames[0], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - { - printf ("h5diff Task [%d]: <%s>: unable to open file\n", nID, filenames[0]); - MPI_Abort(MPI_COMM_WORLD, 0); - } - if ((file2_id = H5Fopen (filenames[1], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + /* disable error reporting */ + H5E_BEGIN_TRY { - printf ("h5diff Task [%d]: <%s>: unable to open file\n", nID, filenames[1]); - MPI_Abort(MPI_COMM_WORLD, 0); + /* Open the files */ + if ((file1_id = H5Fopen (filenames[0], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + { + printf ("h5diff Task [%d]: <%s>: unable to open file\n", nID, filenames[0]); + MPI_Abort(MPI_COMM_WORLD, 0); + } + if ((file2_id = H5Fopen (filenames[1], H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + { + printf ("h5diff Task [%d]: <%s>: unable to open file\n", nID, filenames[1]); + MPI_Abort(MPI_COMM_WORLD, 0); + } + /* enable error reporting */ } - /* enable error reporting */ - } - H5E_END_TRY; + H5E_END_TRY; - while(1) - { - MPI_Probe(0, MPI_ANY_TAG, MPI_COMM_WORLD, &Status); - - if(Status.MPI_TAG == MPI_TAG_ARGS) + while(1) { - /*Recv parameters for diff from manager task */ - MPI_Recv(&args, sizeof(args), MPI_BYTE, 0, MPI_TAG_ARGS, MPI_COMM_WORLD, &Status); - /*Do the diff */ - diffs.nfound = diff(file1_id, args.name1, file2_id, args.name2, &(args.options), args.type); - diffs.not_cmp = args.options.not_cmp; - - /*If print buffer has something in it, request print token.*/ - if(outBuffOffset>0) - { - MPI_Send(NULL, 0, MPI_BYTE, 0, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD); - /*Wait for print token. */ - MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD, &Status); - - /*When get token, send all of our output to the manager task and then return the token */ - for(i=0; i<outBuffOffset; i+=PRINT_DATA_MAX_SIZE) - MPI_Send(outBuff+i, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD); - - - /* An overflow file exists, so we send it's output to the manager too and then delete it */ - if(overflow_file) - { - int tmp; - memset(out_data, 0, PRINT_DATA_MAX_SIZE); - i=0; + MPI_Probe(0, MPI_ANY_TAG, MPI_COMM_WORLD, &Status); - rewind(overflow_file); - while((tmp = getc(overflow_file)) >= 0) + if(Status.MPI_TAG == MPI_TAG_ARGS) { - *(out_data + i++) = (char)tmp; - if(i==PRINT_DATA_MAX_SIZE) + /*Recv parameters for diff from manager task */ + MPI_Recv(&args, sizeof(args), MPI_BYTE, 0, MPI_TAG_ARGS, MPI_COMM_WORLD, &Status); + /*Do the diff */ + diffs.nfound = diff(file1_id, args.name1, file2_id, args.name2, &(args.options), args.type); + diffs.not_cmp = args.options.not_cmp; + + /*If print buffer has something in it, request print token.*/ + if(outBuffOffset>0) { - MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD); - i=0; - memset(out_data, 0, PRINT_DATA_MAX_SIZE); + MPI_Send(NULL, 0, MPI_BYTE, 0, MPI_TAG_TOK_REQUEST, MPI_COMM_WORLD); + /*Wait for print token. */ + MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_PRINT_TOK, MPI_COMM_WORLD, &Status); + + /*When get token, send all of our output to the manager task and then return the token */ + for(i=0; i<outBuffOffset; i+=PRINT_DATA_MAX_SIZE) + MPI_Send(outBuff+i, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD); + + + /* An overflow file exists, so we send it's output to the manager too and then delete it */ + if(overflow_file) + { + int tmp; + + memset(out_data, 0, PRINT_DATA_MAX_SIZE); + i=0; + + rewind(overflow_file); + while((tmp = getc(overflow_file)) >= 0) + { + *(out_data + i++) = (char)tmp; + if(i==PRINT_DATA_MAX_SIZE) + { + MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD); + i=0; + memset(out_data, 0, PRINT_DATA_MAX_SIZE); + } + } + + if(i>0) + MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD); + + fclose(overflow_file); + overflow_file = NULL; + } + + fflush(stdout); + memset(outBuff, 0, OUTBUFF_SIZE); + outBuffOffset = 0; + + MPI_Send(&diffs, sizeof(diffs), MPI_BYTE, 0, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD); } + else + MPI_Send(&diffs, sizeof(diffs), MPI_BYTE, 0, MPI_TAG_DONE, MPI_COMM_WORLD); } - - if(i>0) - MPI_Send(out_data, PRINT_DATA_MAX_SIZE, MPI_BYTE, 0, MPI_TAG_PRINT_DATA, MPI_COMM_WORLD); - - fclose(overflow_file); - overflow_file = NULL; + else if(Status.MPI_TAG == MPI_TAG_END) + { + MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_END, MPI_COMM_WORLD, &Status); + /* printf("exiting..., task: %d\n", nID); + fflush(stdout);*/ + break; + } + else + { + printf("ph5diff_worker: ERROR: invalid tag (%d) received\n", Status.MPI_TAG); + MPI_Abort(MPI_COMM_WORLD, 0); } - fflush(stdout); - memset(outBuff, 0, OUTBUFF_SIZE); - outBuffOffset = 0; - - MPI_Send(&diffs, sizeof(diffs), MPI_BYTE, 0, MPI_TAG_TOK_RETURN, MPI_COMM_WORLD); - } - else - MPI_Send(&diffs, sizeof(diffs), MPI_BYTE, 0, MPI_TAG_DONE, MPI_COMM_WORLD); - } - else if(Status.MPI_TAG == MPI_TAG_END) - { - MPI_Recv(NULL, 0, MPI_BYTE, 0, MPI_TAG_END, MPI_COMM_WORLD, &Status); - /* printf("exiting..., task: %d\n", nID); - fflush(stdout);*/ - break; - } - else - { - printf("ph5diff_worker: ERROR: invalid tag (%d) received\n", Status.MPI_TAG); - MPI_Abort(MPI_COMM_WORLD, 0); } - - } } - - MPI_Barrier(MPI_COMM_WORLD); - MPI_Finalize(); } diff --git a/tools/h5diff/testfiles/h5diff_530.txt b/tools/h5diff/testfiles/h5diff_530.txt index 6f7e08f..bd2b435 100644 --- a/tools/h5diff/testfiles/h5diff_530.txt +++ b/tools/h5diff/testfiles/h5diff_530.txt @@ -2,10 +2,34 @@ file1 file2 --------------------------------------- x x / - x x /Compound_dset + x x /Compound_dset1 + x x /Compound_dset2 + x x /Compound_dset3 + x x /Compound_dset4 + x x /Compound_dset5 + x x /Compound_dset6 + x x /Compound_dset7 + x x /Compound_dset8 + x x /Compound_dset9 group : </> and </> 0 differences found -dataset: </Compound_dset> and </Compound_dset> +dataset: </Compound_dset1> and </Compound_dset1> +0 differences found +dataset: </Compound_dset2> and </Compound_dset2> +0 differences found +dataset: </Compound_dset3> and </Compound_dset3> +0 differences found +dataset: </Compound_dset4> and </Compound_dset4> +0 differences found +dataset: </Compound_dset5> and </Compound_dset5> +0 differences found +dataset: </Compound_dset6> and </Compound_dset6> +0 differences found +dataset: </Compound_dset7> and </Compound_dset7> +0 differences found +dataset: </Compound_dset8> and </Compound_dset8> +0 differences found +dataset: </Compound_dset9> and </Compound_dset9> 0 differences found EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_comp_vl_strs.h5 b/tools/h5diff/testfiles/h5diff_comp_vl_strs.h5 Binary files differindex 348cfee..dac510f 100644 --- a/tools/h5diff/testfiles/h5diff_comp_vl_strs.h5 +++ b/tools/h5diff/testfiles/h5diff_comp_vl_strs.h5 diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index 0696340..98b600a 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -70,6 +70,8 @@ EXCLUDE_FILE1_2=h5diff_exclude1-2.h5 # different structure and obj names EXCLUDE_FILE2_1=h5diff_exclude2-1.h5 EXCLUDE_FILE2_2=h5diff_exclude2-2.h5 +# compound type with multiple vlen string types +COMP_VL_STRS_FILE=h5diff_comp_vl_strs.h5 TESTNAME=h5diff EXIT_SUCCESS=0 @@ -178,6 +180,13 @@ STDOUT_FILTER() { # LA-MPI: *** Copyright 2001-2004, ACL, Los Alamos National Laboratory # 3. h5diff debug output: # Debug output all have prefix "h5diff debug: ". +# 4. AIX system prints messages like these when it is aborting: +# ERROR: 0031-300 Forcing all remote tasks to exit due to exit code 1 in task 0 +# ERROR: 0031-250 task 4: Terminated +# ERROR: 0031-250 task 3: Terminated +# ERROR: 0031-250 task 2: Terminated +# ERROR: 0031-250 task 1: Terminated + STDERR_FILTER() { result_file=$1 tmp_file=/tmp/h5test_tmp_$$ @@ -189,9 +198,10 @@ STDERR_FILTER() { fi # Filter LANL MPI messages # and LLNL srun messages + # and AIX error messages if test -n "$pmode"; then cp $result_file $tmp_file - sed -e '/^LA-MPI:/d' -e '/^srun:/d' \ + sed -e '/^LA-MPI:/d' -e '/^srun:/d' -e '/^ERROR:/d' \ < $tmp_file > $result_file fi # Filter h5diff debug output @@ -779,8 +789,12 @@ TOOLTEST h5diff_482.txt -v --exclude-path "/group1" --exclude-path "/dset1" $EXC TOOLTEST h5diff_483.txt -v --exclude-path "/group1" $EXCLUDE_FILE2_1 $EXCLUDE_FILE2_2 # Exclude from group compare -TOOLTEST h5diff_484.txt -v --exclude-path "/dset3" h5diff_exclude1-1.h5 h5diff_exclude1-2.h5 /group1 +TOOLTEST h5diff_484.txt -v --exclude-path "/dset3" $EXCLUDE_FILE1_1 $EXCLUDE_FILE1_2 /group1 +# ############################################################################## +# # diff various multiple vlen and fixed strings in a compound type dataset +# ############################################################################## +TOOLTEST h5diff_530.txt -v $COMP_VL_STRS_FILE $COMP_VL_STRS_FILE # ############################################################################## # # END diff --git a/tools/h5diff/testph5diff.sh b/tools/h5diff/testph5diff.sh index 0734d21..c619ab5 100755 --- a/tools/h5diff/testph5diff.sh +++ b/tools/h5diff/testph5diff.sh @@ -54,7 +54,8 @@ TOOLTEST() { ############################################################################## ############################################################################## -# testphdf5 test using the MPI-POSIX VFL driver +# Invoke the regular h5diff testing script, with the -p parameter to indicate +# that it should run the parallel version of the tests TOOLTEST -p # no need to print any message since this is just a shell to invoke |