summaryrefslogtreecommitdiff
path: root/tests/tail-2/F-vs-rename
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tail-2/F-vs-rename')
-rwxr-xr-xtests/tail-2/F-vs-rename35
1 files changed, 16 insertions, 19 deletions
diff --git a/tests/tail-2/F-vs-rename b/tests/tail-2/F-vs-rename
index 74db80137..98b36e745 100755
--- a/tests/tail-2/F-vs-rename
+++ b/tests/tail-2/F-vs-rename
@@ -18,39 +18,36 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-if test "$VERBOSE" = yes; then
- set -x
- tail --version
-fi
-
-. $srcdir/test-lib.sh
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+test "$VERBOSE" = yes && tail --version
touch a b || framework_failure
-debug='---disable-inotify -s .01'
+debug='---disable-inotify'
debug=
-tail $debug -F a b > out 2>&1 & pid=$!
+tail $debug -F -s.1 a b > out 2>&1 & pid=$!
+
+check_tail_output()
+{
+ local delay="$1"
+ grep "$tail_re" out > /dev/null ||
+ { sleep $delay; return 1; }
+}
-# Wait until tail has started...
+# Wait up to 6.3s for tail to start
echo x > a
-until grep '^x$' out >/dev/null 2>&1; do :; done
+tail_re='^x$' retry_delay_ check_tail_output .1 7 || fail=1
mv a b || fail=1
-# Wait for the diagnostic:
+# Wait 6.3s for this diagnostic:
# tail: `a' has become inaccessible: No such file or directory
-until grep inaccessible out >/dev/null 2>&1; do :; done
+tail_re='inaccessible' retry_delay_ check_tail_output .1 7 || fail=1
echo x > a
# Wait up to 6.3s for this to appear in the output:
# "tail: `...' has appeared; following end of new file"
-tail_f_vs_rename_1()
-{
- local delay="$1"
- grep 'has appeared;' out > /dev/null ||
- { sleep $delay; return 1; }
-}
-retry_delay_ tail_f_vs_rename_1 .1 7 ||
+tail_re='has appeared' retry_delay_ check_tail_output .1 7 ||
{ echo "$0: a: unexpected delay?"; cat out; fail=1; }
echo y >> b