]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: fix removed-directory test
authorBernhard Voelker <mail@bernhard-voelker.de>
Sat, 23 May 2020 00:46:22 +0000 (02:46 +0200)
committerBernhard Voelker <mail@bernhard-voelker.de>
Sat, 23 May 2020 01:42:24 +0000 (03:42 +0200)
The previous attempt to skip that test on NFS (commit 4181fc518362)
made the test fail; it introduced two problems:
a) In the good case, i.e., when the subshell returns with exit status 0,
the test ran into framework_failure_.
b) As the subshell also runs with 'set -x', the later comparison of
/dev/null with 'err' would fail.

* tests/ls/removed-directory.sh: Revert to the style without subshell,
and add 'test -d .' to verify that 'ls' can read the removed dir.

tests/ls/removed-directory.sh

index 319594907a70fcff3a15a1cc884aa790d9e6686d..00473a3b54c5aadeed0fc0d325c4d4b0de855ae2 100755 (executable)
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ ls
 
+cwd=$(pwd)
 mkdir d || framework_failure_
-(cd d || exit 10
- rmdir ../d || exit 11
- test -d . || exit 12
- ls || exit 13) >out 2>err
-case $? in
-  11) skip_ "can't remove working directory on this platform";;
-  12) skip_ "can't examine removed working directory on this platform";;
-  13) fail=1;;
-  * ) framework_failure_;;
-esac
+cd d || framework_failure_
+rmdir ../d || skip_ "can't remove working directory on this platform"
+
+# On NFS, 'ls' would run into the error "Stale file handle".
+test -d . || skip_ "can't examine removed working directory on this platform"
+
+ls >../out 2>../err || fail=1
+cd "$cwd" || framework_failure_
 
 compare /dev/null out || fail=1
 compare /dev/null err || fail=1