[PATCH 2 of 2] test-hardlink: do not test .hg/cache/checklink

Jun Wu quark at fb.com
Mon May 15 16:38:37 EDT 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1494880158 25200
#      Mon May 15 13:29:18 2017 -0700
# Node ID 0e53ae9a7e47e6596e79fa40fe6e6dc3e37db343
# Parent  caf620c5d0a0aa05e0bc36d3a97edc0e0a9b2b9c
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 0e53ae9a7e47
test-hardlink: do not test .hg/cache/checklink

Linux and BSD have different behavior on "os.link(src, dst)" where "src" is
a symlink. That causes test difference.

According to POSIX [1]:

  If path1 names a symbolic link, it is implementation-defined whether
  link() follows the symbolic link, or creates a new link to the symbolic
  link itself.

So both behaviors are correct. This patch removes the trouble maker
"checklink" to make the test pass on both platforms.

[1]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html

diff --git a/tests/test-hardlinks.t b/tests/test-hardlinks.t
--- a/tests/test-hardlinks.t
+++ b/tests/test-hardlinks.t
@@ -215,4 +215,10 @@ Create hardlinked copy r4 of r3 (on Linu
   $ linkcp r3 r4
 
+'checklink' is produced by hardlinking a symlink, which is undefined whether
+the symlink should be followed or not. It does behave differently on Linux and
+BSD. Just remove it so the test pass on both platforms.
+
+  $ rm -f r4/.hg/cache/checklink
+
 r4 has hardlinks in the working dir (not just inside .hg):
 
@@ -221,5 +227,4 @@ r4 has hardlinks in the working dir (not
   2 r4/.hg/branch
   2 r4/.hg/cache/checkisexec (execbit !)
-  3 r4/.hg/cache/checklink (?)
   ? r4/.hg/cache/checklink-target (glob) (symlink !)
   2 r4/.hg/cache/checknoexec (execbit !)


More information about the Mercurial-devel mailing list