]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: fix tail test race causing false failure
authorPádraig Brady <P@draigBrady.com>
Wed, 1 Feb 2017 05:27:41 +0000 (21:27 -0800)
committerPádraig Brady <P@draigBrady.com>
Wed, 8 Feb 2017 22:40:22 +0000 (14:40 -0800)
* 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.

tests/tail-2/retry.sh

index 40d66d60cfd5440dbfc0a93a8df77444aaa59abd..8e58cce78fb24dd1883045d5c1899fbdee92b1a2 100755 (executable)
@@ -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