Re: [PATCH] test: make SYMLINKS prerequisite more robust

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes:

>> We
>> are testing "git" with the test suite, so even if with some magic
>> that is still unknown to compat/mingw.h it knows how to read what
>> "ln -s x y" left in "y", until compat/mingw.h::readlink() learns the
>> same trick, asking Perl to decide SYMLINKS prerequisite would not
>> help our test scripts at all.
>
> We could always see if they return the same answer :) But not worth
> pursuing in this case.

Actually we probably should test if "git" can create a symbolic
link, because that is what matters more than what "ln -s" can or
cannot do.  We also are interested in the "symbolic link" does
behave as a symbolic link, i.e. writing into it should modify the
contents of the target of the link.

In any case, here is what I have in mind.  There is only a symbolic
link 'y' without 'x' (because this happens in a new and empty
directory for evaluating the lazy prerequisite), redirecting output
from the command, which should be 'x', into 'y' will vivify file 'x'
with contents also 'x', and reading 'y' should yield 'x' because it
points at 'x'.

diff --git c/t/test-lib.sh w/t/test-lib.sh
index 6db377f68b..3fb5957bd2 100644
--- c/t/test-lib.sh
+++ w/t/test-lib.sh
@@ -1773,7 +1773,9 @@ test_lazy_prereq PIPE '
 
 test_lazy_prereq SYMLINKS '
 	# test whether the filesystem supports symbolic links
-	ln -s x y && test -h y
+	ln -s x y && test -h y && test-tool readlink y >y &&
+	test "$(cat y)" = x &&
+	test "$(cat x)" = x
 '
 
 test_lazy_prereq SYMLINKS_WINDOWS '



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux