coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] tests: fix removed-directory test


From: Pádraig Brady
Subject: Re: [PATCH] tests: fix removed-directory test
Date: Sat, 23 May 2020 17:08:48 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:76.0) Gecko/20100101 Thunderbird/76.0

On 23/05/2020 02:45, Bernhard Voelker wrote:
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 | 19 +++++++++----------
  1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/tests/ls/removed-directory.sh b/tests/ls/removed-directory.sh
index 319594907..00473a3b5 100755
--- a/tests/ls/removed-directory.sh
+++ b/tests/ls/removed-directory.sh
@@ -21,17 +21,16 @@
  . "${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


Thanks Bernhard. That looks good.
It might be worth putting a require_local_dir_ at the top of the test also?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]