diff options
Diffstat (limited to 'tests/dir-iterator/testscript')
-rw-r--r-- | tests/dir-iterator/testscript | 100 |
1 files changed, 71 insertions, 29 deletions
diff --git a/tests/dir-iterator/testscript b/tests/dir-iterator/testscript index b1444ad..720622f 100644 --- a/tests/dir-iterator/testscript +++ b/tests/dir-iterator/testscript @@ -14,42 +14,84 @@ $* a >"reg b" mkdir -p a/b; $* a >"dir b" -# Note that on Windows only directory symlinks are currently supported (see -# mksymlink() for details). -# -: dangling-link +: symlink : -if ($cxx.target.class != 'windows') +: If we are not cross-testing let's test dangling and non-dangling symlynks. +: On Windows that involves mklink command usability test. If we fail to create +: a 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) { - +mkdir a - +touch --no-cleanup a/b - +ln -s a/b a/l - +rm a/b + +if ($cxx.target.class != 'windows') + lns = ln -s wd/t wd/l &wd/l + else + echo 'yes' >=t + if cmd /C 'mklink l t' >- 2>- &?l && cat l >'yes' + lns = cmd /C 'mklink wd\l t' &wd/l >- + end - +touch a/c + jnc = cmd /C 'mklink /J wd\l wd\t' &wd/l >- + end - $* ../a >! 2>! != 0 : keep - $* -i ../a >'reg c' : skip -} -else -{ - +mkdir a - +mkdir --no-cleanup a/b - +ln -s a/b a/bl - +rmdir a/b + : symlink + : + if! $empty($lns) + { + : file + : + { + +mkdir wd + +touch --no-cleanup wd/t + +touch wd/f + +$lns + +$* wd >>~%EOO% + %(reg f|reg t|sym reg l)%{3} + EOO + +rm wd/t - +touch a/c + $* ../wd >- 2>! != 0 : keep + $* -i ../wd >'reg f': skip + } - +mkdir a/d - +ln -s a/d a/dl + : dir + : + { + +mkdir wd + +mkdir --no-cleanup wd/t + +mkdir wd/d + +$lns - # On Wine dangling symlinks are not visible (see mksymlink() for details). - # - #$* ../a >! 2>! != 0 : keep + # Note that this test may fail on Windows (see symlinks known issues in + # libbutl/filesystem.mxx). + # + +if ($cxx.target.class != 'windows') + $* wd >>~%EOO% + %(dir d|dir t|sym dir l)%{3} + EOO + end - : skip + +rmdir wd/t + + $* ../wd >- 2>! != 0 : keep + $* -i ../wd >'dir d': skip + } + } + + : junction : - $* -i ../a >>~%EOO% - %(reg c|dir d|sym dir dl)%{3} - EOO + if! $empty($jnc) + { + +mkdir wd + +mkdir --no-cleanup wd/t + +mkdir wd/d + +$jnc + +$* wd >>~%EOO% + %(dir d|dir t|sym dir l)%{3} + EOO + +rmdir wd/t + + $* ../wd >- 2>! != 0 : keep + $* -i ../wd >'dir d': skip + } } |