From dcccba655fe848564e961b3f285ce3a82d3ac73a Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 7 Mar 2020 14:07:28 +0300 Subject: Add more support for symlinks on Windows See mksymlink() for details of the symlinks support on Windows. --- tests/mventry/testscript | 51 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 5 deletions(-) (limited to 'tests/mventry/testscript') diff --git a/tests/mventry/testscript b/tests/mventry/testscript index ecd617a..c6cbf45 100644 --- a/tests/mventry/testscript +++ b/tests/mventry/testscript @@ -92,8 +92,8 @@ : : If we are not cross-testing let's test renaming symlynks from and over. On : Windows that involves mklink command usability test. If we fail to create a -: trial link (say because we are running non-administrative console), then the -: test group will be silently skipped. +: trial link (say because we are not in the Developer Mode and are running +: non-elevated console), then the test group will be silently skipped. : if ($test.target == $build.host) { @@ -104,8 +104,12 @@ if ($test.target == $build.host) if cmd /C 'mklink b a' >- 2>- &?b && cat b >'yes' lns = cmd /C 'mklink b a' >- end + + jnc = cmd /C 'mklink /J b a' >- end + : symlink + : if! $empty($lns) { : file @@ -126,11 +130,11 @@ if ($test.target == $build.host) : to : - : Make sure that if destination is a symlink it is get overwritten and it's - : target stays intact. + : Make sure that if destination is a symlink it is get overwritten and + : it's target stays intact. : echo 'foo' >=a; - $lns; + $lns &b; echo 'bar' >=c &!c; $* c b; cat a >'foo'; @@ -182,6 +186,43 @@ if ($test.target == $build.host) $* b c 2>- == 1 } } + + : junction + : + if! $empty($jnc) + { + : from + : + : Make sure that if source is a junction it refers the same target after + : rename. + : + mkdir -p a; + $jnc &!b; + $* b c &c; + touch a/b; + test -f c/b; + test -d b == 1 + + : to + : + : Make sure that if destination is a junction it is get overwritten and + : it's target stays intact. + : + mkdir -p a; + $jnc; + echo 'foo' >=c &!c; + $* c b &b; + cat b >'foo'; + test -d a; + test -f c == 1 + + : over-existing-dir + : + mkdir a; + $jnc &b; + mkdir c; + $* b c 2>- == 1 + } } : different-fs -- cgit v1.1