summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJonathan Kim <jkm@hdfgroup.org>2012-04-26 15:56:16 (GMT)
committerJonathan Kim <jkm@hdfgroup.org>2012-04-26 15:56:16 (GMT)
commit1b35c60118c2f48ee9022a667aa9ed31c191af80 (patch)
treed9667613622d0d004b95c7f3929c52c8b4648236 /tools
parent8c138d7844935a882c70f1db20c691c9a04b38af (diff)
downloadhdf5-1b35c60118c2f48ee9022a667aa9ed31c191af80.zip
hdf5-1b35c60118c2f48ee9022a667aa9ed31c191af80.tar.gz
hdf5-1b35c60118c2f48ee9022a667aa9ed31c191af80.tar.bz2
[svn-r22319] Purpose:
Fix for HDFFV-7998-h5diff: incorrect behavior and output for comparing symbolic dangling links without following-symlinks option Description: Fix not to check and display dangling link status without --follow-symlinks option. Berfor the fix, when comparing symbolic link to symbolic link without follow-symlinks option, h5diff followed to check if those links are dangling or not. It caused to display output incorrectly (dangling link instead of symbolic link). The fix also improved performance when comparing lots of symbolic links without the --follow-symlinks option. 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)
Diffstat (limited to 'tools')
-rw-r--r--tools/h5diff/CMakeLists.txt27
-rw-r--r--tools/h5diff/h5diffgentest.c20
-rw-r--r--tools/h5diff/testfiles/h5diff_450.txt3
-rw-r--r--tools/h5diff/testfiles/h5diff_451.txt2
-rw-r--r--tools/h5diff/testfiles/h5diff_471.txt38
-rw-r--r--tools/h5diff/testfiles/h5diff_472.txt3
-rw-r--r--tools/h5diff/testfiles/h5diff_473.txt3
-rw-r--r--tools/h5diff/testfiles/h5diff_474.txt3
-rw-r--r--tools/h5diff/testfiles/h5diff_475.txt3
-rw-r--r--tools/h5diff/testfiles/h5diff_danglelinks1.h5bin5012 -> 4970 bytes
-rw-r--r--tools/h5diff/testfiles/h5diff_danglelinks2.h5bin5012 -> 4970 bytes
-rwxr-xr-xtools/h5diff/testh5diff.sh16
-rw-r--r--tools/lib/h5diff.c8
13 files changed, 120 insertions, 6 deletions
diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt
index da2aaf9..4ac4477 100644
--- a/tools/h5diff/CMakeLists.txt
+++ b/tools/h5diff/CMakeLists.txt
@@ -136,6 +136,11 @@ IF (BUILD_TESTING)
h5diff_467.txt
h5diff_468.txt
h5diff_469.txt
+ h5diff_471.txt
+ h5diff_472.txt
+ h5diff_473.txt
+ h5diff_474.txt
+ h5diff_475.txt
h5diff_480.txt
h5diff_481.txt
h5diff_482.txt
@@ -683,6 +688,16 @@ IF (BUILD_TESTING)
h5diff_468.out.err
h5diff_469.out
h5diff_469.out.err
+ h5diff_471.out
+ h5diff_471.out.err
+ h5diff_472.out
+ h5diff_472.out.err
+ h5diff_473.out
+ h5diff_473.out.err
+ h5diff_474.out
+ h5diff_474.out.err
+ h5diff_475.out
+ h5diff_475.out.err
h5diff_480.out
h5diff_480.out.err
h5diff_481.out
@@ -1309,6 +1324,18 @@ ADD_H5_TEST (h5diff_468 0 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_dan
# ext link vs. ext dangling
ADD_H5_TEST (h5diff_469 1 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link2)
+#---------------------------------------------------
+# dangling links without follow symlink
+# (HDFFV-7998)
+# test - soft dangle links (same and different paths),
+# - external dangle links (same and different paths)
+ADD_H5_TEST (h5diff_471 1 -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5)
+ADD_H5_TEST (h5diff_472 0 -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1)
+ADD_H5_TEST (h5diff_473 1 -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link4)
+ADD_H5_TEST (h5diff_474 0 -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link4)
+ADD_H5_TEST (h5diff_475 1 -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link1)
+
+
# ##############################################################################
# # test for group diff recursivly
# ##############################################################################
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index 0b8b4cf..c370f79 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -2181,6 +2181,14 @@ static int test_dangle_links(const char *fname1, const char *fname2)
goto out;
}
+ status = H5Lcreate_soft("no_obj1", fid1, "soft_link4", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
/* file 2 */
status = H5Lcreate_soft("no_obj", fid2, "soft_link1", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0)
@@ -2206,6 +2214,14 @@ static int test_dangle_links(const char *fname1, const char *fname2)
goto out;
}
+ status = H5Lcreate_soft("no_obj2", fid2, "soft_link4", H5P_DEFAULT, H5P_DEFAULT);
+ if (status < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Lcreate_soft failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
/*-----------------------------------------------------------------------
* External Links
*------------------------------------------------------------------------*/
@@ -2234,7 +2250,7 @@ static int test_dangle_links(const char *fname1, const char *fname2)
goto out;
}
- status = H5Lcreate_external("no_file1.h5", "no_obj", fid1, "ext_link4", H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Lcreate_external("no_file.h5", "no_obj", fid1, "ext_link4", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0)
{
fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname1);
@@ -2267,7 +2283,7 @@ static int test_dangle_links(const char *fname1, const char *fname2)
goto out;
}
- status = H5Lcreate_external("no_file2.h5", "no_obj", fid2, "ext_link4", H5P_DEFAULT, H5P_DEFAULT);
+ status = H5Lcreate_external("no_file.h5", "no_obj", fid2, "ext_link4", H5P_DEFAULT, H5P_DEFAULT);
if (status < 0)
{
fprintf(stderr, "Error: %s> H5Lcreate_external failed.\n", fname2);
diff --git a/tools/h5diff/testfiles/h5diff_450.txt b/tools/h5diff/testfiles/h5diff_450.txt
index bf4f6e9..a63d78f 100644
--- a/tools/h5diff/testfiles/h5diff_450.txt
+++ b/tools/h5diff/testfiles/h5diff_450.txt
@@ -11,6 +11,7 @@ file1 file2
x x /soft_link1
x x /soft_link2
x x /soft_link3
+ x x /soft_link4
group : </> and </>
0 differences found
@@ -32,4 +33,6 @@ obj2 </soft_link2> is a dangling link.
1 differences found
obj1 </soft_link3> is a dangling link.
1 differences found
+dangling link: </soft_link4> and </soft_link4>
+0 differences found
EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_451.txt b/tools/h5diff/testfiles/h5diff_451.txt
index 0d30023..fd0691f 100644
--- a/tools/h5diff/testfiles/h5diff_451.txt
+++ b/tools/h5diff/testfiles/h5diff_451.txt
@@ -11,6 +11,7 @@ file1 file2
x x /soft_link1
x x /soft_link2
x x /soft_link3
+ x x /soft_link4
group : </> and </>
0 differences found
@@ -25,4 +26,5 @@ Warning: </ext_link4> is a dangling link.
Warning: </soft_link1> is a dangling link.
Warning: </soft_link2> is a dangling link.
Warning: </soft_link3> is a dangling link.
+Warning: </soft_link4> is a dangling link.
EXIT CODE: 2
diff --git a/tools/h5diff/testfiles/h5diff_471.txt b/tools/h5diff/testfiles/h5diff_471.txt
new file mode 100644
index 0000000..124cdd7
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_471.txt
@@ -0,0 +1,38 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset1
+ x x /dset2
+ x x /ext_link1
+ x x /ext_link2
+ x x /ext_link3
+ x x /ext_link4
+ x x /soft_link1
+ x x /soft_link2
+ x x /soft_link3
+ x x /soft_link4
+
+group : </> and </>
+0 differences found
+dataset: </dset1> and </dset1>
+0 differences found
+dataset: </dset2> and </dset2>
+0 differences found
+external link: </ext_link1> and </ext_link1>
+1 differences found
+external link: </ext_link2> and </ext_link2>
+1 differences found
+external link: </ext_link3> and </ext_link3>
+1 differences found
+external link: </ext_link4> and </ext_link4>
+0 differences found
+link : </soft_link1> and </soft_link1>
+0 differences found
+link : </soft_link2> and </soft_link2>
+1 differences found
+link : </soft_link3> and </soft_link3>
+1 differences found
+link : </soft_link4> and </soft_link4>
+1 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_472.txt b/tools/h5diff/testfiles/h5diff_472.txt
new file mode 100644
index 0000000..57a8af4
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_472.txt
@@ -0,0 +1,3 @@
+link : </soft_link1> and </soft_link1>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_473.txt b/tools/h5diff/testfiles/h5diff_473.txt
new file mode 100644
index 0000000..4c1855d
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_473.txt
@@ -0,0 +1,3 @@
+link : </soft_link4> and </soft_link4>
+1 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_474.txt b/tools/h5diff/testfiles/h5diff_474.txt
new file mode 100644
index 0000000..7807551
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_474.txt
@@ -0,0 +1,3 @@
+external link: </ext_link4> and </ext_link4>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_475.txt b/tools/h5diff/testfiles/h5diff_475.txt
new file mode 100644
index 0000000..be6110e
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_475.txt
@@ -0,0 +1,3 @@
+external link: </ext_link1> and </ext_link1>
+1 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_danglelinks1.h5 b/tools/h5diff/testfiles/h5diff_danglelinks1.h5
index 8cbaac1..b8be9bc 100644
--- a/tools/h5diff/testfiles/h5diff_danglelinks1.h5
+++ b/tools/h5diff/testfiles/h5diff_danglelinks1.h5
Binary files differ
diff --git a/tools/h5diff/testfiles/h5diff_danglelinks2.h5 b/tools/h5diff/testfiles/h5diff_danglelinks2.h5
index f634210..3c3907c 100644
--- a/tools/h5diff/testfiles/h5diff_danglelinks2.h5
+++ b/tools/h5diff/testfiles/h5diff_danglelinks2.h5
Binary files differ
diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh
index dfea6f7..b4863d1 100755
--- a/tools/h5diff/testh5diff.sh
+++ b/tools/h5diff/testh5diff.sh
@@ -209,6 +209,11 @@ $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_471.txt
+$SRC_H5DIFF_TESTFILES/h5diff_472.txt
+$SRC_H5DIFF_TESTFILES/h5diff_473.txt
+$SRC_H5DIFF_TESTFILES/h5diff_474.txt
+$SRC_H5DIFF_TESTFILES/h5diff_475.txt
$SRC_H5DIFF_TESTFILES/h5diff_480.txt
$SRC_H5DIFF_TESTFILES/h5diff_481.txt
$SRC_H5DIFF_TESTFILES/h5diff_482.txt
@@ -970,6 +975,17 @@ TOOLTEST h5diff_468.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_dangl
# ext link vs. ext dangling
TOOLTEST h5diff_469.txt -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link2
+#----------------------------------------
+# dangling links without follow symlink
+# (HDFFV-7998)
+# test - soft dangle links (same and different paths),
+# - external dangle links (same and different paths)
+TOOLTEST h5diff_471.txt -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5
+TOOLTEST h5diff_472.txt -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1
+TOOLTEST h5diff_473.txt -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link4
+TOOLTEST h5diff_474.txt -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link4
+TOOLTEST h5diff_475.txt -v h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link1
+
# ##############################################################################
# # test for group diff recursivly
# ##############################################################################
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 306f914..bcd63f1 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -868,8 +868,8 @@ 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);
+ l_ret1 = H5tools_get_symlink_info(file1_id, obj1fullname, &trg_linfo1, options->follow_links);
+ l_ret2 = H5tools_get_symlink_info(file2_id, obj2fullname, &trg_linfo2, options->follow_links);
/*---------------------------------------------
* check for following symlinks
@@ -1697,7 +1697,7 @@ hsize_t diff(hid_t file1_id,
*/
/* target object1 - get type and name */
- ret = H5tools_get_symlink_info(file1_id, path1, &linkinfo1, TRUE);
+ ret = H5tools_get_symlink_info(file1_id, path1, &linkinfo1, options->follow_links);
/* dangling link */
if (ret == 0)
{
@@ -1715,7 +1715,7 @@ hsize_t diff(hid_t file1_id,
goto out;
/* target object2 - get type and name */
- ret = H5tools_get_symlink_info(file2_id, path2, &linkinfo2, TRUE);
+ ret = H5tools_get_symlink_info(file2_id, path2, &linkinfo2, options->follow_links );
/* dangling link */
if (ret == 0)
{