diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2015-07-04 17:13:50 +0300 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2015-07-04 17:13:50 +0300 |
commit | 71cd8e3a743046573744123777061b64881bf372 (patch) | |
tree | 82522befe647f4fff186a5630cad0cad33f8ef53 /tests/tail-2/inotify-hash-abuse2.sh | |
parent | c18578632fd3c9e513e613a86ba2b7c4ebee6c45 (diff) | |
download | coreutils-upstream.tar.gz |
Imported Upstream version 8.24upstream/8.24upstream
Diffstat (limited to 'tests/tail-2/inotify-hash-abuse2.sh')
-rwxr-xr-x | tests/tail-2/inotify-hash-abuse2.sh | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/tests/tail-2/inotify-hash-abuse2.sh b/tests/tail-2/inotify-hash-abuse2.sh index 6018448f..d641c241 100755 --- a/tests/tail-2/inotify-hash-abuse2.sh +++ b/tests/tail-2/inotify-hash-abuse2.sh @@ -2,7 +2,7 @@ # Exercise an abort-inducing flaw in inotify-enabled tail -F. # Like inotify-hash-abuse, but without a hard-coded "9". -# Copyright (C) 2009-2014 Free Software Foundation, Inc. +# Copyright (C) 2009-2015 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,20 +20,27 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ tail -touch f || framework_failure_ +# Terminate any background tail process +cleanup_() { kill $pid 2>/dev/null && wait $pid; } -debug='---disable-inotify -s .001' -debug= -tail $debug -F f & pid=$! -cleanup_() { kill $pid; } +# Speedup the non inotify case +fastpoll='-s.1 --max-unchanged-stats=1' -for i in $(seq 200); do - kill -0 $pid || break; - mv f g - touch f -done +for mode in '' '---disable-inotify'; do + touch f || framework_failure_ + + tail $mode $fastpoll -F f & pid=$! + + for i in $(seq 200); do + kill -0 $pid || break; + mv f g + touch f + done -# Kill the working tail, or fail if it has already aborted -kill $pid || fail=1 + # Ensure tail hasn't aborted + kill -0 $pid || fail=1 + + cleanup_ +done Exit $fail |