summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2017-01-31 21:27:41 -0800
committerPádraig Brady <P@draigBrady.com>2017-02-08 14:40:22 -0800
commitc95c0a0fd4b8dc72a66484f3f361a3afb9acdc94 (patch)
treea14b7f0a4aaa68eb400c0c6727268c5ddf252f45
parenta520942efadbd0f86759f9bcb428ec0a83ed56e4 (diff)
downloadcoreutils-c95c0a0fd4b8dc72a66484f3f361a3afb9acdc94.tar.xz
tests: fix tail test race causing false failure
* tests/tail-2/retry.sh: The replacement of the "missing" directory is not atomic, and therefore tail(1) can take a different path, especially if there is a delay between the rmdir(2) and creat(2). This is noticeable for example with `make coverage` because in that case the coverage files written by rmdir(1) on exit, induce a significant delay thus triggering the issue.
-rwxr-xr-xtests/tail-2/retry.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/tail-2/retry.sh b/tests/tail-2/retry.sh
index 40d66d60c..8e58cce78 100755
--- a/tests/tail-2/retry.sh
+++ b/tests/tail-2/retry.sh
@@ -172,8 +172,9 @@ retry_delay_ wait4lines_ .1 6 4 || { cat out; fail=1; }
cleanup_
[ "$(countlines_)" = 4 ] || { fail=1; cat out; }
grep -F 'cannot follow' out || { fail=1; cat out; }
-grep -F 'has become accessible' out || { fail=1; cat out; }
-grep -F 'giving up' out && { fail=1; cat out; }
+# The first is the common case, "has appeared" arises with slow rmdir.
+grep -E 'become accessible|has appeared' out || { fail=1; cat out; }
+grep -F 'giving up' out && { fail=1; cat out; }
grep -F 'foo' out || { fail=1; cat out; }
rm -fd untailable out || framework_failure_
fi