diff options
-rw-r--r-- | tools/h5diff/CMakeLists.txt | 6 | ||||
-rw-r--r-- | tools/h5diff/h5diffgentest.c | 66 | ||||
-rw-r--r-- | tools/h5diff/testfiles/h5diff_17.txt | 2 | ||||
-rw-r--r-- | tools/h5diff/testfiles/h5diff_171.txt | 2 | ||||
-rw-r--r-- | tools/h5diff/testfiles/h5diff_172.txt | 2 | ||||
-rw-r--r-- | tools/h5diff/testfiles/h5diff_530.txt | 24 | ||||
-rw-r--r-- | tools/h5diff/testfiles/h5diff_90.txt | 6 | ||||
-rw-r--r-- | tools/h5diff/testfiles/h5diff_basic1.h5 | bin | 11432 -> 11976 bytes | |||
-rw-r--r-- | tools/h5diff/testfiles/h5diff_comp_vl_strs.h5 | bin | 18536 -> 37952 bytes | |||
-rwxr-xr-x | tools/h5diff/testh5diff.sh | 6 | ||||
-rw-r--r-- | tools/lib/h5diff.c | 66 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 56 | ||||
-rw-r--r-- | tools/lib/h5tools.h | 1 | ||||
-rw-r--r-- | windows/tools/h5diff/testh5diff.bat | 12 |
14 files changed, 192 insertions, 57 deletions
diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt index 0969a23..bb267eb 100644 --- a/tools/h5diff/CMakeLists.txt +++ b/tools/h5diff/CMakeLists.txt @@ -735,10 +735,10 @@ ADD_H5_TEST (h5diff_16_3 1 -v -p 0.02 ${FILE1} ${FILE1} g1/dset9 g1/dset10) ADD_H5_TEST (h5diff_17 1 -v ${FILE1} ${FILE2}) # 1.7 test 32-bit INFINITY -ADD_H5_TEST (h5diff_171 0 -v ${FILE1} ${FILE1} /g1/fp19) +ADD_H5_TEST (h5diff_171 0 -v ${FILE1} ${FILE1} /g1/fp19 /g1/fp19_COPY) # 1.7 test 64-bit INFINITY -ADD_H5_TEST (h5diff_172 0 -v ${FILE1} ${FILE1} /g1/fp20) +ADD_H5_TEST (h5diff_172 0 -v ${FILE1} ${FILE1} /g1/fp20 /g1/fp20_COPY) # 1.8 quiet mode ADD_H5_TEST (h5diff_18 1 -q ${FILE1} ${FILE2}) @@ -1199,7 +1199,7 @@ ADD_H5_TEST (h5diff_484 0 -v --exclude-path "/dset3" ${EXCLUDE_FILE1_1} ${EXCLUD # ############################################################################## # # diff various multiple vlen and fixed strings in a compound type dataset # ############################################################################## -ADD_H5_TEST (h5diff_530 0 -v ${COMP_VL_STRS_FILE} ${COMP_VL_STRS_FILE}) +ADD_H5_TEST (h5diff_530 0 -v ${COMP_VL_STRS_FILE} ${COMP_VL_STRS_FILE} /group /group_copy) ENDIF (BUILD_TESTING) diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c index 3363b39..3ef01a0 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -129,7 +129,7 @@ static int test_group_recurse(const char *fname1, const char *fname2); static int test_group_recurse2(void); static int test_exclude_obj1(const char *fname1, const char *fname2); static int test_exclude_obj2(const char *fname1, const char *fname2); -static int test_comp_vlen_strings(const char *fname1); +static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new); static int test_attributes_verbose_level(const char *fname1, const char *fname2); /* called by test_attributes() and test_datasets() */ @@ -194,7 +194,8 @@ int main(void) test_exclude_obj2(EXCLUDE_FILE2_1, EXCLUDE_FILE2_2); /* diff various multiple vlen and fixlen string types in a compound dataset */ - test_comp_vlen_strings(COMP_VL_STRS_FILE ); + test_comp_vlen_strings(COMP_VL_STRS_FILE, "group", 1); + test_comp_vlen_strings(COMP_VL_STRS_FILE, "group_copy", 0); return 0; } @@ -430,7 +431,9 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3) data20[3] = data20[4] = data20[5] = -log(0); write_dset(gid1,1,dims1,"fp19",H5T_NATIVE_FLOAT,data19); + write_dset(gid1,1,dims1,"fp19_COPY",H5T_NATIVE_FLOAT,data19); write_dset(gid1,1,dims1,"fp20",H5T_NATIVE_DOUBLE,data20); + write_dset(gid1,1,dims1,"fp20_COPY",H5T_NATIVE_DOUBLE,data20); } /*------------------------------------------------------------------------- @@ -3309,11 +3312,12 @@ out: #define FIXLEN_STR_ARRY_SIZE 30 #define COMP_RANK 1 #define COMP_DIM 1 -static int test_comp_vlen_strings(const char *fname1) +static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new) { int i; hid_t fid1; /* file id */ + hid_t gid; /* compound1 datatype */ typedef struct comp1_t @@ -3604,10 +3608,34 @@ static int test_comp_vlen_strings(const char *fname1) /*----------------------------------------------------------------------- * Create file(s) *------------------------------------------------------------------------*/ - fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid1 < 0) + if (is_file_new == 1) { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid1 < 0) + { + fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1); + status = FAIL; + goto out; + } + } + else + { + fid1 = H5Fopen (fname1, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid1 < 0) + { + fprintf(stderr, "Error: %s> H5Fopen failed.\n", fname1); + status = FAIL; + goto out; + } + } + + /*----------------------------------------------------------------------- + * Create group + *------------------------------------------------------------------------*/ + gid = H5Gcreate2(fid1, grp_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + if (gid < 0) + { + fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1); status = FAIL; goto out; } @@ -3827,7 +3855,7 @@ static int test_comp_vlen_strings(const char *fname1) /* Write data to compound 1 dataset buffer */ - did_comp = H5Dcreate2(fid1, "Compound_dset1", tid1_comp, sid_comp, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + did_comp = H5Dcreate2(gid, "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) { @@ -3838,7 +3866,7 @@ static int test_comp_vlen_strings(const char *fname1) 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); + did_comp = H5Dcreate2(gid, "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) { @@ -3849,7 +3877,7 @@ static int test_comp_vlen_strings(const char *fname1) 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); + did_comp = H5Dcreate2(gid, "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) { @@ -3860,7 +3888,7 @@ static int test_comp_vlen_strings(const char *fname1) 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); + did_comp = H5Dcreate2(gid, "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) { @@ -3871,7 +3899,7 @@ static int test_comp_vlen_strings(const char *fname1) 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); + did_comp = H5Dcreate2(gid, "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) { @@ -3882,7 +3910,7 @@ static int test_comp_vlen_strings(const char *fname1) 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); + did_comp = H5Dcreate2(gid, "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) { @@ -3893,7 +3921,7 @@ static int test_comp_vlen_strings(const char *fname1) 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); + did_comp = H5Dcreate2(gid, "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) { @@ -3904,7 +3932,7 @@ static int test_comp_vlen_strings(const char *fname1) 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); + did_comp = H5Dcreate2(gid, "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) { @@ -3915,12 +3943,12 @@ static int test_comp_vlen_strings(const char *fname1) 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); + did_comp = H5Dcreate2(gid, "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=H5Rcreate(&(comp9_buf.objref1),gid,"Compound_dset2",H5R_OBJECT,-1); + status=H5Rcreate(&(comp9_buf.objref2),gid,"Compound_dset3",H5R_OBJECT,-1); + status=H5Rcreate(&(comp9_buf.objref3),gid,"Compound_dset4",H5R_OBJECT,-1); status = H5Dwrite(did_comp, tid9_comp, H5S_ALL, H5S_ALL, H5P_DEFAULT, &comp9_buf); if (status < 0) @@ -3940,6 +3968,8 @@ out: *-----------------------------------------------------------------------*/ if(fid1) H5Fclose(fid1); + if(gid) + H5Gclose(gid); /* vlen string */ if(tid_vlen_str) H5Tclose(tid_vlen_str); diff --git a/tools/h5diff/testfiles/h5diff_17.txt b/tools/h5diff/testfiles/h5diff_17.txt index 5cb604d..5e48dae 100644 --- a/tools/h5diff/testfiles/h5diff_17.txt +++ b/tools/h5diff/testfiles/h5diff_17.txt @@ -23,8 +23,10 @@ file1 file2 x /g1/fp17 x /g1/fp18 x /g1/fp19 + x /g1/fp19_COPY x /g1/fp2 x /g1/fp20 + x /g1/fp20_COPY x /g1/ld x /g2 x /g2/dset1 diff --git a/tools/h5diff/testfiles/h5diff_171.txt b/tools/h5diff/testfiles/h5diff_171.txt index 5314a79..aabe16a 100644 --- a/tools/h5diff/testfiles/h5diff_171.txt +++ b/tools/h5diff/testfiles/h5diff_171.txt @@ -1,3 +1,3 @@ -dataset: </g1/fp19> and </g1/fp19> +dataset: </g1/fp19> and </g1/fp19_COPY> 0 differences found EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_172.txt b/tools/h5diff/testfiles/h5diff_172.txt index 0269194..852f7b5 100644 --- a/tools/h5diff/testfiles/h5diff_172.txt +++ b/tools/h5diff/testfiles/h5diff_172.txt @@ -1,3 +1,3 @@ -dataset: </g1/fp20> and </g1/fp20> +dataset: </g1/fp20> and </g1/fp20_COPY> 0 differences found EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_530.txt b/tools/h5diff/testfiles/h5diff_530.txt index bd2b435..73d736e 100644 --- a/tools/h5diff/testfiles/h5diff_530.txt +++ b/tools/h5diff/testfiles/h5diff_530.txt @@ -1,7 +1,7 @@ -file1 file2 +group1 group2 --------------------------------------- - x x / + x x x x /Compound_dset1 x x /Compound_dset2 x x /Compound_dset3 @@ -12,24 +12,24 @@ file1 file2 x x /Compound_dset8 x x /Compound_dset9 -group : </> and </> +group : </group> and </group_copy> 0 differences found -dataset: </Compound_dset1> and </Compound_dset1> +dataset: </group/Compound_dset1> and </group_copy/Compound_dset1> 0 differences found -dataset: </Compound_dset2> and </Compound_dset2> +dataset: </group/Compound_dset2> and </group_copy/Compound_dset2> 0 differences found -dataset: </Compound_dset3> and </Compound_dset3> +dataset: </group/Compound_dset3> and </group_copy/Compound_dset3> 0 differences found -dataset: </Compound_dset4> and </Compound_dset4> +dataset: </group/Compound_dset4> and </group_copy/Compound_dset4> 0 differences found -dataset: </Compound_dset5> and </Compound_dset5> +dataset: </group/Compound_dset5> and </group_copy/Compound_dset5> 0 differences found -dataset: </Compound_dset6> and </Compound_dset6> +dataset: </group/Compound_dset6> and </group_copy/Compound_dset6> 0 differences found -dataset: </Compound_dset7> and </Compound_dset7> +dataset: </group/Compound_dset7> and </group_copy/Compound_dset7> 0 differences found -dataset: </Compound_dset8> and </Compound_dset8> +dataset: </group/Compound_dset8> and </group_copy/Compound_dset8> 0 differences found -dataset: </Compound_dset9> and </Compound_dset9> +dataset: </group/Compound_dset9> and </group_copy/Compound_dset9> 0 differences found EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_90.txt b/tools/h5diff/testfiles/h5diff_90.txt index fb23843..9965ab0 100644 --- a/tools/h5diff/testfiles/h5diff_90.txt +++ b/tools/h5diff/testfiles/h5diff_90.txt @@ -30,7 +30,6 @@ dataset: </g1/dset4> and </g1/dset4> group : </g2> and </g2> 0 differences found dataset: </g2/dset1> and </g2/dset1> -Not comparable: </g2/dset1> or </g2/dset1> is an empty dataset 0 differences found dataset: </g2/dset2> and </g2/dset2> 0 differences found @@ -47,10 +46,5 @@ dataset: </g2/dset7> and </g2/dset7> dataset: </g2/dset8> and </g2/dset8> 0 differences found dataset: </g2/dset9> and </g2/dset9> -Not comparable: </g2/dset9> or </g2/dset9> is an empty dataset 0 differences found --------------------------------- -Some objects are not comparable --------------------------------- -Use -c for a list of objects. EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_basic1.h5 b/tools/h5diff/testfiles/h5diff_basic1.h5 Binary files differindex 4f3cf9a..d97017e 100644 --- a/tools/h5diff/testfiles/h5diff_basic1.h5 +++ b/tools/h5diff/testfiles/h5diff_basic1.h5 diff --git a/tools/h5diff/testfiles/h5diff_comp_vl_strs.h5 b/tools/h5diff/testfiles/h5diff_comp_vl_strs.h5 Binary files differindex dac510f..4ad6f19 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 cb213dc..5087350 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -365,10 +365,10 @@ TOOLTEST h5diff_16_3.txt -v -p 0.02 $FILE1 $FILE1 g1/dset9 g1/dset10 TOOLTEST h5diff_17.txt -v $FILE1 $FILE2 # 1.7 test 32-bit INFINITY -TOOLTEST h5diff_171.txt -v $FILE1 $FILE1 /g1/fp19 +TOOLTEST h5diff_171.txt -v $FILE1 $FILE1 /g1/fp19 /g1/fp19_COPY # 1.7 test 64-bit INFINITY -TOOLTEST h5diff_172.txt -v $FILE1 $FILE1 /g1/fp20 +TOOLTEST h5diff_172.txt -v $FILE1 $FILE1 /g1/fp20 /g1/fp20_COPY # 1.8 quiet mode TOOLTEST h5diff_18.txt -q $FILE1 $FILE2 @@ -832,7 +832,7 @@ TOOLTEST h5diff_484.txt -v --exclude-path "/dset3" $EXCLUDE_FILE1_1 $EXCLUDE_FIL # ############################################################################## # # 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 +TOOLTEST h5diff_530.txt -v $COMP_VL_STRS_FILE $COMP_VL_STRS_FILE /group /group_copy # ############################################################################## # # END diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index a4d8469..4f82906 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -932,6 +932,19 @@ hsize_t h5diff(const char *fname1, /* if both obj1 and obj2 are group */ if (obj1type == H5TRAV_TYPE_GROUP && obj2type == H5TRAV_TYPE_GROUP) { + + /* + * Use h5tools_is_obj_same() to improve performance by skipping + * comparing details of same objects. If verbose options is used, + * need to traverse thorugh the list of objects in the group and + * print out object information. Details of same objects will be + * skipped at diff() function. + */ + if(!(options->m_verbose || options->m_report)) { + if (h5tools_is_obj_same(file1_id,obj1fullname,file2_id,obj2fullname)!=0) + goto out; + } + /* * traverse group1 */ @@ -1773,6 +1786,7 @@ hsize_t diff(hid_t file1_id, int ret; int is_dangle_link1 = 0; int is_dangle_link2 = 0; + int is_hard_link = 0; hsize_t nfound = 0; @@ -1834,6 +1848,58 @@ hsize_t diff(hid_t file1_id, /* found dangling link */ if (is_dangle_link1 || is_dangle_link2) goto out2; + + /* + * Use h5tools_is_obj_same() to improve performance by skipping + * comparing details of same objects, + * + * check if two paths point to the same object for hard links or + * the option of follow link is used. h5tools_is_obj_same() is not + * needed for other cases. + */ + is_hard_link = (type==H5TRAV_TYPE_DATASET || + type==H5TRAV_TYPE_NAMED_DATATYPE || + type==H5TRAV_TYPE_GROUP); + if (options->follow_links || is_hard_link) + { + if (h5tools_is_obj_same(file1_id, path1, file2_id, path2)!=0) + { + /* print information is only verbose option is used */ + if(options->m_verbose || options->m_report) + { + switch(type) + { + case H5TRAV_TYPE_DATASET: + do_print_objname("dataset", path1, path2, options); + break; + case H5TRAV_TYPE_NAMED_DATATYPE: + do_print_objname("datatype", path1, path2, options); + break; + case H5TRAV_TYPE_GROUP: + do_print_objname("group", path1, path2, options); + break; + case H5TRAV_TYPE_LINK: + do_print_objname("link", path1, path2, options); + break; + case H5TRAV_TYPE_UDLINK: + if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) + do_print_objname("external link", path1, path2, options); + else + do_print_objname ("user defined link", path1, path2, options); + break; + default: + parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n", + path1, path2, get_type(type) ); + options->not_cmp = 1; + break; + } /* switch(type)*/ + + print_found(nfound); + } /* if(options->m_verbose || options->m_report) */ + + goto out2; + } /* h5tools_is_obj_same */ + } switch(type) { diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index bf85bc2..3e72bdd 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -626,11 +626,11 @@ h5tools_ncols(const char *s) * * Purpose: Recursive check for any variable length data in given type. * - * Return: + * Return: * TRUE : type conatains any variable length data * FALSE : type doesn't contain any variable length data * Negative value: error occur - * + * * Programmer: Jonathan Kim March 18, 2011 *------------------------------------------------------------------------- */ @@ -658,7 +658,7 @@ done: * * Purpose: Recursive check for variable length string of a datatype. * - * Return: + * Return: * TRUE : type conatains any variable length string * FALSE : type doesn't contain any variable length string * Negative value: error occur @@ -848,7 +848,7 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, } /* Calculate new prefix */ - h5tools_str_region_prefix(&prefix, info, elmtno, ptdata, ctx->ndims, + h5tools_str_region_prefix(&prefix, info, elmtno, ptdata, ctx->ndims, ctx->p_max_idx, ctx); /* Write new prefix to output */ @@ -2419,7 +2419,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, hid_t dset /* Terminate the output */ if (ctx.cur_column) { fputs(OPT(info->line_suf, ""), stdout); - putc('\n', stdout); + putc('\n', stdout); fputs(OPT(info->line_sep, ""), stdout); } @@ -2527,7 +2527,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, vl_data = TRUE; if (H5Tdetect_class(p_type, H5T_VLEN) == TRUE) vl_data = TRUE; - + /* * Determine the strip mine size and allocate a buffer. The strip mine is * a hyperslab whose size is manageable. @@ -2545,7 +2545,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, } } - if(!sm_nbytes) + if(!sm_nbytes) goto done; assert(sm_nbytes == (hsize_t)((size_t)sm_nbytes)); /*check for overflow*/ @@ -4323,3 +4323,45 @@ hbool_t h5tools_is_zero(const void *_mem, size_t size) return TRUE; } +/*------------------------------------------------------------------------- + * Function: h5tools_is_obj_same + * + * Purpose: Check if two given object IDs or link names point to the same object. + * + * Parameters: + * hid_t loc_id1: location of the first object + * char *name1: link name of the first object. + * Use "." or NULL if loc_id1 is the object to be compared. + * hid_t loc_id2: location of the second object + * char *name1: link name of the first object. + * Use "." or NULL if loc_id2 is the object to be compared. + * + * Return: TRUE if it is the same object; FALSE otherwise. + * + * Programmer: Peter Cao + * 4/27/2011 + * + *------------------------------------------------------------------------- + */ +hbool_t h5tools_is_obj_same(hid_t loc_id1, const char *name1, + hid_t loc_id2, const char *name2) +{ + H5O_info_t oinfo1, oinfo2; + hbool_t ret_val = 0; + + if ( name1 && strcmp(name1, ".")) + H5Oget_info_by_name(loc_id1, name1, &oinfo1, H5P_DEFAULT); + else + H5Oget_info(loc_id1, &oinfo1); + + if ( name2 && strcmp(name2, ".")) + H5Oget_info_by_name(loc_id2, name2, &oinfo2, H5P_DEFAULT); + else + H5Oget_info(loc_id2, &oinfo2); + + if (oinfo1.fileno == oinfo2.fileno && oinfo1.addr==oinfo2.addr) + ret_val = 1; + + return ret_val; +} + diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index d08edf7..89e07fa 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -555,6 +555,7 @@ H5TOOLS_DLL hid_t h5tools_get_big_endian_type(hid_t type); H5TOOLS_DLL htri_t h5tools_detect_vlen(hid_t tid); H5TOOLS_DLL htri_t h5tools_detect_vlen_str(hid_t tid); +H5TOOLS_DLL hbool_t h5tools_is_obj_same(hid_t loc_id1, const char *name1, hid_t loc_id2, const char *name2); H5TOOLS_DLL void h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container, h5tools_context_t *ctx/*in,out*/, unsigned flags, diff --git a/windows/tools/h5diff/testh5diff.bat b/windows/tools/h5diff/testh5diff.bat index 9b73b60..4c19c3f 100644 --- a/windows/tools/h5diff/testh5diff.bat +++ b/windows/tools/h5diff/testh5diff.bat @@ -297,12 +297,12 @@ rem ############################################################################ call :tooltest h5diff_17.txt -v %file1% %file2%
rem 1.71 test 32-bit INFINITY
- call :testing %h5diff% -v %srcfile1% %srcfile1% /g1/fp19
- call :tooltest h5diff_171.txt -v %file1% %file1% /g1/fp19
+ call :testing %h5diff% -v %srcfile1% %srcfile1% /g1/fp19 /g1/fp19_COPY
+ call :tooltest h5diff_171.txt -v %file1% %file1% /g1/fp19 /g1/fp19_COPY
rem 1.72 test 64-bit INFINITY
- call :testing %h5diff% -v %srcfile1% %srcfile1% /g1/fp20
- call :tooltest h5diff_172.txt -v %file1% %file1% /g1/fp20
+ call :testing %h5diff% -v %srcfile1% %srcfile1% /g1/fp20 /g1/fp20_COPY
+ call :tooltest h5diff_172.txt -v %file1% %file1% /g1/fp20 /g1/fp20_COPY
rem 1.8 quiet mode
call :testing %h5diff% -q %srcfile1% %srcfile2%
@@ -916,8 +916,8 @@ rem ############################################################################ rem ##############################################################################
rem # diff various multiple vlen and fixed strings in a compound type dataset
rem ##############################################################################
- call :testing %h5diff% -v %src_comp_vl_strs% %src_comp_vl_strs%
- call :tooltest h5diff_530.txt -v %comp_vl_strs% %comp_vl_strs%
+ call :testing %h5diff% -v %src_comp_vl_strs% %src_comp_vl_strs% /group /group_copy
+ call :tooltest h5diff_530.txt -v %comp_vl_strs% %comp_vl_strs% /group /group_copy
rem #######################################################################
|