summaryrefslogtreecommitdiff
path: root/tests/tail-2
AgeCommit message (Collapse)Author
2011-11-22tests: use "compare exp out", not "compare out exp"Jim Meyering
Likewise, when an empty file is expected, use "compare /dev/null out", not "compare out /dev/null". I.e., specify the expected/desired contents via the first file name. Prompted by a suggestion from Bruno Haible in http://thread.gmane.org/gmane.comp.gnu.grep.bugs/4020/focus=29154 Run these commands: git grep -l -E 'compare [^ ]+ exp' \ |xargs perl -pi -e 's/(compare) (\S+) (exp\S*)/$1 $3 $2/' git grep -l -E 'compare [^ ]+ /dev/null' \ |xargs perl -pi -e 's/(compare) (\S+) (\/dev\/null)/$1 $3 $2/' * tests/chgrp/no-x: As above. * tests/chmod/no-x: Likewise. * tests/chmod/silent: Likewise. * tests/chmod/thru-dangling: Likewise. * tests/chown/basic: Likewise. * tests/chown/deref: Likewise. * tests/chown/preserve-root: Likewise. * tests/cp/abuse: Likewise. * tests/cp/backup-is-src: Likewise. * tests/cp/cp-a-selinux: Likewise. * tests/cp/cp-mv-enotsup-xattr: Likewise. * tests/cp/fail-perm: Likewise. * tests/cp/into-self: Likewise. * tests/cp/proc-zero-len: Likewise. * tests/cp/src-base-dot: Likewise. * tests/cp/thru-dangling: Likewise. * tests/dd/reblock: Likewise. * tests/dd/unblock-sync: Likewise. * tests/du/2g: Likewise. * tests/du/8gb: Likewise. * tests/du/basic: Likewise. * tests/du/bigtime: Likewise. * tests/du/deref-args: Likewise. * tests/du/exclude: Likewise. * tests/du/files0-from-dir: Likewise. * tests/du/hard-link: Likewise. * tests/du/inacc-dest: Likewise. * tests/du/inacc-dir: Likewise. * tests/du/long-sloop: Likewise. * tests/du/max-depth: Likewise. * tests/du/move-dir-while-traversing: Likewise. * tests/du/no-deref: Likewise. * tests/du/no-x: Likewise. * tests/du/one-file-system: Likewise. * tests/du/slash: Likewise. * tests/du/trailing-slash: Likewise. * tests/install/strip-program: Likewise. * tests/ln/hard-backup: Likewise. * tests/ls/block-size: Likewise. * tests/ls/color-clear-to-eol: Likewise. * tests/ls/color-dtype-dir: Likewise. * tests/ls/color-norm: Likewise. * tests/ls/dangle: Likewise. * tests/ls/dired: Likewise. * tests/ls/file-type: Likewise. * tests/ls/follow-slink: Likewise. * tests/ls/infloop: Likewise. * tests/ls/m-option: Likewise. * tests/ls/no-arg: Likewise. * tests/ls/recursive: Likewise. * tests/ls/rt-1: Likewise. * tests/ls/stat-dtype: Likewise. * tests/ls/stat-failed: Likewise. * tests/ls/stat-free-symlinks: Likewise. * tests/ls/x-option: Likewise. * tests/misc/arch: Likewise. * tests/misc/cat-buf: Likewise. * tests/misc/cat-proc: Likewise. * tests/misc/chcon: Likewise. * tests/misc/csplit: Likewise. * tests/misc/df-P: Likewise. * tests/misc/fmt-long-line: Likewise. * tests/misc/groups-dash: Likewise. * tests/misc/groups-version: Likewise. * tests/misc/head-pos: Likewise. * tests/misc/nl: Likewise. * tests/misc/od-N: Likewise. * tests/misc/od-multiple-t: Likewise. * tests/misc/od-x8: Likewise. * tests/misc/printf: Likewise. * tests/misc/printf-hex: Likewise. * tests/misc/pwd-option: Likewise. * tests/misc/readlink-fp-loop: Likewise. * tests/misc/runcon-no-reorder: Likewise. * tests/misc/seq-long-double: Likewise. * tests/misc/sort-NaN-infloop: Likewise. * tests/misc/sort-benchmark-random: Likewise. * tests/misc/sort-debug-keys: Likewise. * tests/misc/sort-float: Likewise. * tests/misc/sort-merge-fdlimit: Likewise. * tests/misc/sort-unique-segv: Likewise. * tests/misc/stat-hyphen: Likewise. * tests/misc/stat-slash: Likewise. * tests/misc/stdbuf: Likewise. * tests/misc/sum-sysv: Likewise. * tests/misc/tac-2-nonseekable: Likewise. * tests/misc/tac-continue: Likewise. * tests/misc/tr-case-class: Likewise. * tests/misc/truncate-fail-diag: Likewise. * tests/misc/wc-files0: Likewise. * tests/mkdir/selinux: Likewise. * tests/mv/backup-dir: Likewise. * tests/mv/backup-is-src: Likewise. * tests/mv/diag: Likewise. * tests/mv/dir2dir: Likewise. * tests/mv/dup-source: Likewise. * tests/mv/force: Likewise. * tests/mv/hard-verbose: Likewise. * tests/mv/i-link-no: Likewise. * tests/mv/into-self: Likewise. * tests/mv/into-self-2: Likewise. * tests/mv/into-self-3: Likewise. * tests/mv/mv-special-1: Likewise. * tests/mv/part-fail: Likewise. * tests/mv/perm-1: Likewise. * tests/mv/sticky-to-xpart: Likewise. * tests/mv/trailing-slash: Likewise. * tests/rm/rm1: Likewise. * tests/rm/rm2: Likewise. * tests/rm/cycle: Likewise. * tests/rm/dir-no-w: Likewise. * tests/rm/dir-nonrecur: Likewise. * tests/rm/fail-2eperm: Likewise. * tests/rm/fail-eacces: Likewise. * tests/rm/i-never: Likewise. * tests/rm/inaccessible: Likewise. * tests/rm/interactive-always: Likewise. * tests/rm/interactive-once: Likewise. * tests/rm/isatty: Likewise. * tests/rm/one-file-system: Likewise. * tests/rm/rm3: Likewise. * tests/rm/rm5: Likewise. * tests/rm/unread2: Likewise. * tests/rm/v-slash: Likewise. * tests/sample-test: Likewise. * tests/split/b-chunk: Likewise. * tests/split/fail: Likewise. * tests/split/l-chunk: Likewise. * tests/split/lines: Likewise. * tests/split/r-chunk: Likewise. * tests/split/suffix-length: Likewise. * tests/tail-2/big-4gb: Likewise. * tests/tail-2/follow-name: Likewise. * tests/tail-2/follow-stdin: Likewise. * tests/tail-2/pipe-f: Likewise. * tests/tail-2/pipe-f2: Likewise. * tests/tail-2/start-middle: Likewise. * tests/touch/60-seconds: Likewise. * tests/touch/fail-diag: Likewise. * tests/touch/not-owner: Likewise. * tests/touch/relative: Likewise.
2011-10-29tests: don't make tail's pipe-f2 test take the full 10 secondsJim Meyering
* tests/tail-2/pipe-f2: Don't always wait 10 seconds. Before, this test would always wait 10 seconds. Now, it stops early when it detects that tail -f has written output. BTW, the race condition that prompted changing the timeout from 1 second to 10 was that tail -f could be killed by the timeout before producing any output.
2011-10-12tests: avoid a false failure on systems without inotifyPádraig Brady
* tests/tail-2/follow-name: Exclude the inotify warning from the comparison. Reported by Bruno Haible.
2011-10-08tests: avoid tail-2/F-vs-missing failure on NFSJim Meyering
* tests/tail-2/F-vs-missing: This test would fail about 80% of the time on linux/powerpc when run in an NFS-mounted directory. Reported by Bruno Haible in http://thread.gmane.org/gmane.comp.gnu.coreutils.general/1726/focus=1727
2011-08-08tests: complete the renaming framework_failure -> framework_failure_Stefano Lattarini
These changes were mostly mechanical, made by running the following command: git grep -lw framework_failure | grep -v ChangeLog \ | xargs perl -pi -e 's/\b(framework_failure)\b/${1}_/' and then editing init.cfg and `tests/cp/cp-a-selinux' by hand. * tests/init.cfg (framework_failure): Remove, `framework_failure_' from init.sh should be used instead in the tests. Remove now-obsolete "FIXME" comment. (is_local_dir_, require_strace_, require_membership_in_two_groups_, require_sparse_support_, skip_if_mcstransd_is_running_, mkfifo_or_skip_) Use `framework_failure_', not `framework_failure'. * Many test scripts: Likewise.
2011-06-17tests: remove skip_test_ function; use new skip_ insteadJim Meyering
* tests/init.cfg (skip_test_): Remove function. Use skip_ in place of skip_test_ everywhere else. * cfg.mk (sc_prohibit_skip_): Remove rule. * tests/**: Use skip_, not skip_test_, everywhere.
2011-06-11tests: inotify-rotate: avoid false positive under heavy loadJim Meyering
* tests/tail-2/inotify-rotate: Increase timeout from 10s to 40s to avoid load-induced false positive.
2011-04-25tail --follow=name no longer implies --retryJim Meyering
* src/tail.c (tail_forever_inotify): Just as without inotify, tail --follow=name now terminates when the last tailed-by-name file is unlinked or moved aside. This bug was introduced on 2009-06-15 via commit ae494d4b, "tail: use inotify if it is available". Reported by Tim Underwood in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22286 * NEWS (Bug fixes): Mention this. * tests/tail-2/follow-name: Test for this. * tests/Makefile.am (TESTS): Add it.
2011-04-25tests: tail-2/pipe-f2: avoid false-positive failureJim Meyering
Otherwise, this would fail (albeit rarely) on a "make -j24 check" run. * tests/tail-2/pipe-f2: Increase timeout from 1 second to 10, to avoid false positive failure.
2011-03-31tests: inotify-rotate: avoid race condition with overloaded diskJim Meyering
* tests/tail-2/inotify-rotate: Wait 50% longer for grep to succeed. Without this change, this test would fail consistently when using "make -j25 check" with F15 in a virtio- and spinning-rust-backed virtual machine.
2011-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright".
2010-11-17tests: substitute the single-program $VERBOSE/--version usesJim Meyering
Automatically make all of the changes like this: -test "$VERBOSE" = yes && chgrp --version +print_ver_ chgrp git grep -l 'VERBOSE.*--version'|xargs perl -pi -e \ 's/test "\$VERBOSE" = yes && (\w+) --version/print_ver_ $1/'
2010-11-17tests: convert first batch of tests from test-lib.sh to init.shJim Meyering
Initially, I did this, git grep -l srcdir/test-lib.sh|xargs perl -p0i -e '~180-byte script' but that line would have been much longer than the maximum permitted by coreutils' commit hook, and wasn't readable besides, so here's a more readable version: lhs=$(printf '%s\\n' \ 'if test "$VERBOSE" = yes; then' \ ' set -x' \ ' touch --version' \ 'fi' \ '' \ '. $srcdir/test-lib.sh' \ | sed 's/\$/\\\$/g;s/touch/(\\w+)/') rhs=$(printf '%s\\n' \ '. "${srcdir=.}/init.sh"; path_prepend_ ../src' \ 'test "$VERBOSE" = yes && FIXME --version' \ | sed 's/\$/\\\$/g;s/FIXME/\$1/') git grep -l srcdir/test-lib.sh|xargs perl -p0i -e "s,$lhs,$rhs,"
2010-11-17tests: move a comment so automated conversion worksJim Meyering
2010-10-12tail: fix checking of currently unavailable directoriesPádraig Brady
* src/tail.c (tail_forever_inotify): Handle the case where tail --follow=name with inotify, is not able to add a watch on a specified directory. This may happen due to inotify resource limits or if the directory is currently missing or inaccessible. In all these cases, revert to polling which will try to reopen the file later. Note inotify returns ENOSPC when it runs out of resources, and instead we report a particular error message, lest users think one of their file systems is full. (main): Document another caveat with using inotify, where we currently don't recheck directories recreated after the initial watch is setup. * tests/tail-2/F-vs-rename: Fix the endless loop triggered by the above issue. * tests/tail-2/inotify-hash-abuse: Likewise. * tests/tail-2/wait: Don't fail in the resource exhaustion case. * tests/tail-2/F-vs-missing: A new test for this failure mode which was until now just triggered on older buggy linux kernels which returned ENOSPC constantly from inotify_add_watch(). * NEWS: Mention the fix.
2010-07-05tests: make tests requiring a delay to pass, more robustPádraig Brady
* tests/init.cfg: Introduce a retry_delay_() function to repeatedly call a test function that requires a delay. This delay can now be shorter for the common case on fast systems, but will double until a configurable limit it reached before failing on slower systems. * tests/dd/reblock: Use retry_delay_. * tests/misc/cat-buf: Likewise. * tests/misc/stdbuf: Likewise. * tests/tail-2/F-vs-rename: Likewise. * tests/tail-2/flush-initial: Likewise. * tests/tail-2/tail-n0f: Likewise. * tests/tail-2/wait: Likewise. * test/dd/misc: Comment that delay is needed to trigger failure.
2010-06-30tests: fail rather than infloop in tail's inotify-rotate testJim Meyering
* tests/tail-2/inotify-rotate: Switch to new init.sh-based framework. (grep_timeout): New function. Use it in place of open-coded loops that might infloop. This was prompted by my encountering an inexplicable, and so far unreproducible, infloop in the code that was waiting for "b" to appear in "out".
2010-02-16tests: fix an unlikely race in tail-2/inotify-hash-abuse2Pádraig Brady
* tests/tail-2/inotify-hash-abuse2: Explicitly kill the process by using cleanup_() rather than using a timeout which may trigger a failure on very slow systems (< 20 iterations of the loop per second).
2010-02-02tests: fix various timeout racesPádraig Brady
Prompted by the continuous integration build failure at: http://hydra.nixos.org/build/277485 * tests/misc/timeout: Set all expected timeouts to 1s and all unexpected timeouts to 10s. In this way, tests normally proceed quickly but may delay up to 10s before reporting failures. * tests/ls/infloop: Likewise. * tests/tail-2/pid: Likewise. * tests/tail-2/pipe-f: Likewise. * tests/tail-2/wait: Likewise. * tests/dd/skip-seek-past-dev: Likewise.
2010-01-13tests: avoid spurious failures on older shellsPádraig Brady
* tests/tail-2/inotify-hash-abuse: Use kill rather than wait to determine if the tail process is still running. * tests/tail-2/inotify-hash-abuse2: Ditto.
2010-01-01maint: update all FSF copyright year lists to include 2010Jim Meyering
Use this command: git ls-files | grep -v COPYING \ | xargs env UPDATE_COPYRIGHT_USE_INTERVALS=1 \ build-aux/update-copyright
2009-12-30tail: test for a bug in inotify-enabled tail -FJim Meyering
tail -F a b would stop tracking additions to b after "mv a b". * tests/tail-2/F-vs-rename: New file. * tests/Makefile.am (TESTS): Add it.
2009-12-29tail: add another test to exercise abort-inducing flaw in tail -FJim Meyering
* tests/tail-2/inotify-hash-abuse2: New test, based on a reproducer by Rob Wortman. * tests/Makefile.am (TESTS): Add it.
2009-12-29tail: add a test to exercise abort-inducing flaw in tail -FJim Meyering
* tests/tail-2/inotify-hash-abuse: New file, derived from a report by Rob Wortman. * tests/Makefile.am (TESTS): Add it. Improved by: Pádraig Brady.
2009-12-12tests: tail-without-inotify: avoid spurious test failureJim Meyering
* tests/tail-2/wait: Account for the possibility that the kernel lacks inotify support. Reported by Chris Clayton.
2009-12-06tests: don't run tail-2/inotify-race by defaultPádraig Brady
* tests/tail-2/inotify-race: Note the caveats of the test. I.E. the intermittent skips and the gdb hang reported by Alan Curry. Add extra info to the log on why the test is skipped as it may be due to multiple reasons. Mark the test as very expensive so that it's not normally run.
2009-11-16tail -F can fail to track a file after it's been rotatedJim Meyering
Tailing forever and by-name (--follow=name, -F), tail would sometimes fail to follow a file that had been removed via rename. If you can't apply this patch and have tail 7.6 or newer, you can work around the bug via the undocumented --disable-inotify option. * src/tail.c (tail_forever_inotify): When tailing by name (-F), do not un-watch a file upon receipt of the IN_MOVE_SELF event. Reported by Arjan Opmeer in http://bugs.debian.org/548439. * NEWS (Bug fixes): Mention it. Also see http://marc.info/?l=coreutils-bug&m=125829031916515 * tests/Makefile.am (TESTS): Add tail-2/inotify-rotate. * tests/tail-2/inotify-rotate: New test.
2009-11-03tests: inotify-race: don't let malfunctioning gdb hang the testJim Meyering
* tests/tail-2/inotify-race: Apply timeout to each gdb invocation.
2009-10-30tests: factor 350 fail=0 initializations into test-lib.shJim Meyering
Run this command to remove the factored-out "fail=0" lines. perl -ni -e '/^fail=0$/ or print' $(g grep -l '^fail=0$') * tests/test-lib.sh: Initialize fail=0 here, not in 300+ scripts. * tests/...: nearly all bourne shell scripts Suggested by Eric Blake.
2009-10-30tests: remove the less-regular fail=0 assignments manuallyJim Meyering
* tests/tail-2/assert-2: * tests/tail-2/assert: * tests/cp/file-perm-race: * tests/misc/df: * tests/misc/truncate-dir-fail:
2009-10-22tests: add a test for the `tail -f' race condition bugGiuseppe Scrivano
If new data becomes available between the initial read and when tail registers the inotify watch descriptors, ensure that it is read before a new event happens on the file. * tests/Makefile.am (TESTS): Add tail-2/inotify-race. * tests/tail-2/inotify-race: New file.
2009-10-10tests: adjust tail-2/pid to work around FreeBSD 6.1 failureJim Meyering
* tests/tail-2/pid: Run tail -f --pid=... on an actual file, not on /dev/null, to avoid this failure on FreeBSD 6.1: tail: /dev/null: cannot change nonblocking mode: Inappropriate ioctl for device
2009-10-02tail: avoid a race where we could miss new data with --pidPádraig Brady
* src/tail.c (tail_forever, tail_forever_inotify): Close a race in tail_forever_inotify where new data written after the file check by a now dead process, but before the pid check, is not output. We use the POSIX guarantee that read() and write() are serialized wrt each other even in separate processes, to assume full file consistency after exit() and so poll for new data _after_ the writer has exited. This also allows us to not redundantly _wait_ for new data if the process is dead. * tests/tail-2/pid: Remove the now partially invalid sub second sleep check as we now don't unconditionally wait, and replace it with a check for the redundant sleep. Also clarify some of the existing comments. * NEWS: Mention the fix.
2009-09-30tests: tail-2/pid: use a 3-second timeout, not 1Jim Meyering
* tests/tail-2/pid: When using the timeout program to ensuring that tail -s.1 --pid=$PID_T_MAX does not wait forever, use a timeout longer than 1 second. A 1-second timeout could be too short on a very busy system, and result in a timeout, and hence false-positive failure. 2009-09-30 Jim Meyering <meyering@redhat.com>
2009-09-08tests: tail-2/assert: reduce risk of race conditionPádraig Brady
* tests/tail2/assert: This reverts commit be853120, 25-08-2009, "tests: tail-2/assert: avoid risk of race condition" kill -0 doesn't send a signal and so will only confirm that the background process was forked, which we know already because we have its pid.
2009-09-07tail: ignore -f for piped-stdin, as POSIX requiresJim Meyering
* src/tail.c (main): Tailing a pipe "forever" is not useful, and POSIX specifies that tail ignore the -f when there is no file argument and stdin is a FIFO or pipe. So we do that. In addition, GNU tail excludes "-" arguments from the list of files to tail forever, when the associated file descriptor is connected to a FIFO or pipe. Before this change, ":|tail -f" would hang. Reported by Ren Yang and Ulrich Drepper. * tests/tail-2/pipe-f: Test for this. * tests/tail-2/pipe-f2: Ensure tail doesn't exit early for a fifo. * tests/Makefile.am (TESTS): Add these tests. * NEWS (POSIX conformance): Mention it.
2009-09-07tests: tail-2/flush-initial should not rely on stdbufPádraig Brady
* tests/tail-2/flush-initial: stdbuf is not built on all systems. In any case it's redundant since stdout will automatically be buffered since we're redirecting to file. So just call tail without using stdbuf.
2009-09-07tests: tail-2/infloop-1: avoid rare test failure on a busy systemJim Meyering
* tests/tail-2/infloop-1: Sleep 3 seconds, not 1, but in increments of 0.1 second. Before, this test would fail ~1 time in 20 via "make -j9 check" on a quad-core system. Correct comment.
2009-09-07tail -f: handle "-"/stdin once againJim Meyering
* src/tail.c (main) [HAVE_INOTIFY]: When stdin (i.e., "-", or no args, but not /dev/stdin) is specified on the command line, don't use inotify. Reported by Bill Brelsford in <http://bugs.debian.org/545422>. * tests/tail-2/follow-stdin: New file. Test for this. * tests/Makefile.am (TESTS): Add the test. * NEWS (Bug fixes): Mention it. This bug was introduced in coreutils-7.5 via commit ae494d4b, 2009-06-02, "tail: use inotify if it is available".
2009-09-06tests: tail-2/flush-initial: correct race avoidance codeJim Meyering
* tests/tail-2/flush-initial: Wait for the file to be nonempty, not for the process. Based on a suggestion from Pádraig Brady.
2009-09-06tail: flush initial output before possibly blockingJim Meyering
* src/tail.c (main): Flush any output from tail_file, before calling tail_forever_inotify, which can block. * tests/tail-2/flush-initial: New file. Test for the bug. * tests/Makefile.am (TESTS): Add tail-2/flush-initial. * NEWS (Bug fixes): Mention it. This bug was introduced in coreutils-7.5 via commit ae494d4b, 2009-06-02, "tail: use inotify if it is available".
2009-09-05tests: test old tail -f method even on systems with inotifyPádraig Brady
* src/tail.c (main): Add an undocumented ---disable-inotify option to allow disabling inotify. * tests/tail-2/pid: Run test in both normal and "disable_inotify" modes. * tests/tail-2/tail-n0f: Likewise. * tests/tail-2/wait: Likewise. * tests/tail-2/append-only: Likewise.
2009-09-04tests: fix a tail-2/pid failure on GNU/kFreeBSDPetr Salinger
* tests/tail-2/wait: Increase the file name recheck frequency to fix a failure on systems without inotify and a file timestamp precision of 1 second (like GNU/kFreeBSD).
2009-09-04tests: fix a failure when running tail-2/wait as rootPádraig Brady
* tests/tail-2/wait: Silently skip a portion of the test when running as root, rather than failing the whole test. This regression was introduced with commit 84b5844d, 2009-09-03, "tests: simplify and fix a race in 2 tail --follow tests".
2009-09-03tests: simplify and fix a race in 2 tail --follow testsPádraig Brady
* tests/tail-2/pid: Use the timeout command to determine process longevity, rather than querying /proc/$pid/status. The latter was racy in any case when inotify is used, as then tail wakes up periodically even for unchanging files therefore causing the check for "S (sleeping)" state to fail intermittently. * tests/tail-2/wait: Likewise.
2009-08-26tests: tail-2/assert: avoid risk of race conditionJim Meyering
* tests/tail-2/assert: Avoid spurious failure due to race condition. Rather than sleeping for 1 second and crossing fingers, wait explicitly for backgrounded tail process to start. Otherwise, this test would fail under heavy load.
2009-08-16tests: tail-2/append-only: don't discard stderrJim Meyering
* tests/tail-2/append-only: Don't discard a diagnostic that may help explain why this test fails for some. Details in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/17621/focus=17641
2009-08-12tests: improve one of the tail --pid testsPádraig Brady
* tests/tail-2/pid: Speed up the test by specifying a timeout of 100ms rather than the default 1s. Also skip the test instead of failing in the unlikely case were the pid required to be missing pid is present.
2009-07-30tail: properly parse fractional seconds when monitoring a pidPádraig Brady
* src/tail.c (tail_forever_inotify): The fractional part of the delay was 1000 times too large. * tests/tail-2/pid: Add a test to ensure the timeout happens for this case.
2009-07-30tests: test for just-fixed tail --pid bugJim Meyering
* tests/tail-2/pid: Ensure tail exits successfully when PID dies.