From 0a46593a382259ac39df2e317609d21c32160317 Mon Sep 17 00:00:00 2001 From: Jonathan Kim Date: Fri, 9 Mar 2012 15:34:37 -0500 Subject: [svn-r22038] Purpose: Fix for HDFFV-7835 h5diff: incorrect result for comparing the two same type symlinks as dangling links. Description: When two symbolic dangling links are compared with --follow-symlinks option, the result should be same. It works for comparing two files, but didn't work for comparing two objects. Test cases were added and tagged with jira#. Tested: jam (linux32-LE), koala (linux64-LE), ostrich (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE), Windows (32-LE cmake), Cmake (jam) --- MANIFEST | 4 +++ release_docs/RELEASE.txt | 15 +++++++---- tools/h5diff/CMakeLists.txt | 23 +++++++++++++++- tools/h5diff/testfiles/h5diff_465.txt | 3 +-- tools/h5diff/testfiles/h5diff_466.txt | 5 ++++ tools/h5diff/testfiles/h5diff_467.txt | 3 +++ tools/h5diff/testfiles/h5diff_468.txt | 5 ++++ tools/h5diff/testfiles/h5diff_469.txt | 3 +++ tools/h5diff/testh5diff.sh | 13 +++++++++ tools/lib/h5diff.c | 51 +++++++++++++++++++++-------------- 10 files changed, 97 insertions(+), 28 deletions(-) create mode 100644 tools/h5diff/testfiles/h5diff_466.txt create mode 100644 tools/h5diff/testfiles/h5diff_467.txt create mode 100644 tools/h5diff/testfiles/h5diff_468.txt create mode 100644 tools/h5diff/testfiles/h5diff_469.txt diff --git a/MANIFEST b/MANIFEST index 0cccbad..c5ba0af 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1849,6 +1849,10 @@ ./tools/h5diff/testfiles/h5diff_458.txt ./tools/h5diff/testfiles/h5diff_459.txt ./tools/h5diff/testfiles/h5diff_465.txt +./tools/h5diff/testfiles/h5diff_466.txt +./tools/h5diff/testfiles/h5diff_467.txt +./tools/h5diff/testfiles/h5diff_468.txt +./tools/h5diff/testfiles/h5diff_469.txt ./tools/h5diff/testfiles/h5diff_480.txt ./tools/h5diff/testfiles/h5diff_481.txt ./tools/h5diff/testfiles/h5diff_482.txt diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index baf9f50..2d7b48c 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -241,12 +241,13 @@ New Features Tools: ------ - - h5repack: Improved performance for hanlding big chunked dataset - (size > 128MB). It would perform much better prior to the - improvement, especially for cases that chunk dimentions - looks like "1024x5x1" (compare to "1x5x1024"). When bigger numbers + - h5repack: Improved performance for big chunked datasets (size > 128MB) + when used with layout (-l) or compression (-f) option. + It would perform much better prior to the improvement, + especially for cases that chunk dimentions looks like + "1024x5x1" (compare to "1x5x1024"). When bigger numbers are toward front and smaller number is toward back in chunk - dimentions. + dimentions. HDFFV-7862 (JKM - 2012/03/01) - h5dump: Added new option --no-compact-subset. This option will not interpret the '[' character as starting the compact form of subsetting. This is useful when the "h5dump error: unable to @@ -649,6 +650,10 @@ Bug Fixes since HDF5-1.8.0 release Tools ----- + - h5diff: When two symbolic dangling links are compared with + --follow-symlinks option, the result should be same. It worked for + comparing two files, but didn't work for comparing two objects. + HDFFV-7835 (JKM 2012/03/09) - h5dump: Refactored code to remove duplicated functions. Split XML functions from DDL functions. Corrected indentation and formatting errors. Also fixed subsetting counting overflow (HDFFV-5874). Verified diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt index d810a2c..f178f19 100644 --- a/tools/h5diff/CMakeLists.txt +++ b/tools/h5diff/CMakeLists.txt @@ -130,6 +130,10 @@ IF (BUILD_TESTING) h5diff_458.txt h5diff_459.txt h5diff_465.txt + h5diff_466.txt + h5diff_467.txt + h5diff_468.txt + h5diff_469.txt h5diff_480.txt h5diff_481.txt h5diff_482.txt @@ -657,6 +661,14 @@ IF (BUILD_TESTING) h5diff_459.out.err h5diff_465.out h5diff_465.out.err + h5diff_466.out + h5diff_466.out.err + h5diff_467.out + h5diff_467.out.err + h5diff_468.out + h5diff_468.out.err + h5diff_469.out + h5diff_469.out.err h5diff_480.out h5diff_480.out.err h5diff_481.out @@ -1266,7 +1278,16 @@ ADD_H5_TEST (h5diff_459 2 --follow-symlinks -v --no-dangling-links ${FILE15} $ # dangling link --follow-symlinks (obj vs obj) # (HDFFV-7836) -ADD_H5_TEST (h5diff_465 1 --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1) +ADD_H5_TEST (h5diff_465 0 --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1) +# (HDFFV-7835) +# soft dangling vs. soft dangling +ADD_H5_TEST (h5diff_466 0 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1) +# soft link vs. soft dangling +ADD_H5_TEST (h5diff_467 1 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link2) +# ext dangling vs. ext dangling +ADD_H5_TEST (h5diff_468 0 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link4) +# ext link vs. ext dangling +ADD_H5_TEST (h5diff_469 1 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link2) # ############################################################################## # # test for group diff recursivly diff --git a/tools/h5diff/testfiles/h5diff_465.txt b/tools/h5diff/testfiles/h5diff_465.txt index 827e88e..eca5994 100644 --- a/tools/h5diff/testfiles/h5diff_465.txt +++ b/tools/h5diff/testfiles/h5diff_465.txt @@ -1,2 +1 @@ -1 differences found -EXIT CODE: 1 +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_466.txt b/tools/h5diff/testfiles/h5diff_466.txt new file mode 100644 index 0000000..3e00ca3 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_466.txt @@ -0,0 +1,5 @@ +obj1 is a dangling link. +obj2 is a dangling link. +dangling link: and +0 differences found +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_467.txt b/tools/h5diff/testfiles/h5diff_467.txt new file mode 100644 index 0000000..f5195c0 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_467.txt @@ -0,0 +1,3 @@ +obj2 is a dangling link. +1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testfiles/h5diff_468.txt b/tools/h5diff/testfiles/h5diff_468.txt new file mode 100644 index 0000000..75b16c6 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_468.txt @@ -0,0 +1,5 @@ +obj1 is a dangling link. +obj2 is a dangling link. +dangling link: and +0 differences found +EXIT CODE: 0 diff --git a/tools/h5diff/testfiles/h5diff_469.txt b/tools/h5diff/testfiles/h5diff_469.txt new file mode 100644 index 0000000..594fd80 --- /dev/null +++ b/tools/h5diff/testfiles/h5diff_469.txt @@ -0,0 +1,3 @@ +obj2 is a dangling link. +1 differences found +EXIT CODE: 1 diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index aa0f502..2e2feb9 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -201,6 +201,10 @@ $SRC_H5DIFF_TESTFILES/h5diff_457.txt $SRC_H5DIFF_TESTFILES/h5diff_458.txt $SRC_H5DIFF_TESTFILES/h5diff_459.txt $SRC_H5DIFF_TESTFILES/h5diff_465.txt +$SRC_H5DIFF_TESTFILES/h5diff_466.txt +$SRC_H5DIFF_TESTFILES/h5diff_467.txt +$SRC_H5DIFF_TESTFILES/h5diff_468.txt +$SRC_H5DIFF_TESTFILES/h5diff_469.txt $SRC_H5DIFF_TESTFILES/h5diff_480.txt $SRC_H5DIFF_TESTFILES/h5diff_481.txt $SRC_H5DIFF_TESTFILES/h5diff_482.txt @@ -943,6 +947,15 @@ TOOLTEST h5diff_459.txt --follow-symlinks -v --no-dangling-links h5diff_extlin # dangling link --follow-symlinks (obj vs obj) # (HDFFV-7836) TOOLTEST h5diff_465.txt --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1 +# (HDFFV-7835) +# soft dangling vs. soft dangling +TOOLTEST h5diff_466.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1 +# soft link vs. soft dangling +TOOLTEST h5diff_467.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link2 +# ext dangling vs. ext dangling +TOOLTEST h5diff_468.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link4 +# ext link vs. ext dangling +TOOLTEST h5diff_469.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link2 # ############################################################################## # # test for group diff recursivly diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index bc8acd5..c6353eb 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -644,8 +644,8 @@ hsize_t h5diff(const char *fname1, char filenames[2][MAX_FILENAME]; hsize_t nfound = 0; int i; - //int i1, i2; - int l_ret; + int l_ret1 = -1; + int l_ret2 = -1; const char * obj1fullname = NULL; const char * obj2fullname = NULL; /* init to group type */ @@ -862,6 +862,10 @@ hsize_t h5diff(const char *fname1, } + /* get any symbolic links info */ + l_ret1 = H5tools_get_symlink_info(file1_id, obj1fullname, &trg_linfo1, TRUE); + l_ret2 = H5tools_get_symlink_info(file2_id, obj2fullname, &trg_linfo2, TRUE); + /*--------------------------------------------- * check for following symlinks */ @@ -874,13 +878,12 @@ hsize_t h5diff(const char *fname1, /*------------------------------- * check symbolic link (object1) */ - l_ret = H5tools_get_symlink_info(file1_id, obj1fullname, &trg_linfo1, TRUE); /* dangling link */ - if (l_ret == 0) + if (l_ret1 == 0) { if (options->no_dangle_links) { - /* gangling link is error */ + /* treat dangling link is error */ if(options->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", obj1fullname); options->err_stat = 1; @@ -890,30 +893,33 @@ hsize_t h5diff(const char *fname1, { if(options->m_verbose) parallel_print("obj1 <%s> is a dangling link.\n", obj1fullname); - nfound++; - print_found(nfound); - goto out; + if (l_ret1 != 0 || l_ret2 != 0) + { + nfound++; + print_found(nfound); + goto out; + } } } - else if(l_ret < 0) /* fail */ + else if(l_ret1 < 0) /* fail */ { parallel_print ("Object <%s> could not be found in <%s>\n", obj1fullname, fname1); options->err_stat = 1; goto out; } - else if(l_ret != 2) /* symbolic link */ + else if(l_ret1 != 2) /* symbolic link */ obj1type = trg_linfo1.trg_type; /*------------------------------- * check symbolic link (object2) */ - l_ret = H5tools_get_symlink_info(file2_id, obj2fullname, &trg_linfo2, TRUE); + /* dangling link */ - if (l_ret == 0) + if (l_ret2 == 0) { if (options->no_dangle_links) { - /* gangling link is error */ + /* treat dangling link is error */ if(options->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", obj2fullname); options->err_stat = 1; @@ -923,18 +929,21 @@ hsize_t h5diff(const char *fname1, { if(options->m_verbose) parallel_print("obj2 <%s> is a dangling link.\n", obj2fullname); - nfound++; - print_found(nfound); - goto out; + if (l_ret1 != 0 || l_ret2 != 0) + { + nfound++; + print_found(nfound); + goto out; + } } } - else if(l_ret < 0) /* fail */ + else if(l_ret2 < 0) /* fail */ { parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2); options->err_stat = 1; goto out; } - else if(l_ret != 2) /* symbolic link */ + else if(l_ret2 != 2) /* symbolic link */ obj2type = trg_linfo2.trg_type; } /* end of if follow symlinks */ @@ -947,8 +956,10 @@ hsize_t h5diff(const char *fname1, if(!(options->m_verbose || options->m_report)) { - if (h5tools_is_obj_same(file1_id,obj1fullname,file2_id,obj2fullname)!=0) - goto out; + /* if no danglink links */ + if ( l_ret1 > 0 && l_ret2 > 0 ) + if (h5tools_is_obj_same(file1_id,obj1fullname,file2_id,obj2fullname)!=0) + goto out; } -- cgit v0.12