summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2011-07-17timeout: add regression test (Bug#9098)Paul Eggert
* tests/misc/timeout: Check that 'timeout' is not confused when starting off with a child.
2011-07-16timeout: treat seconds counts like 'sleep' doesPaul Eggert
Treat fractions as a request to round up to the next representable value, and treat out-of-range values as maximal ones. This is consistent with how "sleep" works. And this way, "timeout 999999999999999999d FOO" and "timeout 4.5 foo" are more likely to do what the user wants. * src/timeout.c: Include c-strtod.h and xstrtod.h, not xstrtol.h. (apply_time_suffix): Change it to the way sleep.c's time_suffix does things. Maybe this function (identical in both programs, other than its name) should be moved to a library? (parse_duration): Return a maximal value on overflow. Return unsigned int, not unsigned long. Allow fractions, which round up to the next integer value. * tests/misc/timeout-parameters: Adjust tests to match new behavior. Add a very large number.
2011-07-08timeout: support cascaded timeoutsPádraig Brady
* src/timeout.c (cleanup): Send signals directly to the child in case it has started its own process group (like a cascaded timeout command would for example). * test/misc/timeout-group: Add a test case. * NEWS: Mention the fix.
2011-07-08timeout: add --foreground to support interactive commandsPádraig Brady
Or more accurately, commands not started from the shell prompt, that are interactive, or need to receive Ctrl-C etc. from the terminal. * doc/coreutils.texi (timeout invocation): Document --foreground. * src/timeout.c (main): Set the foreground flag and don't create a separate group. (cleanup): Only send a signal directly to the monitored command when the foreground flag is set. (usage): Describe --foreground. * tests/misc/timeout-group: Add a new test. * tests/Makefile.am: Reference new test. NEWS: Mention the new option. Reported by Shay Shimony Analysis by Alan Curry Fix suggested by Paul Eggert
2011-07-07tests: exercise md5sum's new --strict optionJim Meyering
* tests/misc/md5sum: Exercise new --strict option.
2011-06-22tests: stat-free-color: do not count stat calls before mainBernhard Voelker
* tests/ls/stat-free-color: The system may perform additional stat calls upon loading (seen on OpenSuSE-11.4). Count only the number of stat calls compared to --help. This also reduces back to "1" the number of expected calls, effectively reverting part of 2011-06-01 commit, ccf2d9a4.
2011-06-21tests: cp/sparse-fiemap: use "head -n99" in place of "head -99"Bernhard Voelker
* tests/cp/sparse-fiemap: Use "head -n99" in place of "head -99". The latter is officially obsolete.
2011-06-20tests: init.sh: use "sed 1q" in place of "head -1"Jim Meyering
* tests/init.sh (warn_): Use "sed 1q" in place of "head -1". The latter is officially obsolete but more portable than "head -n1". Reported by Bernhard Voelker.
2011-06-20tests: improve init.sh by removing w2_Bernhard Voelker
* tests/init.sh (w2_): Remove, moving contents into... (warn_): ...here. Call self from subshell when IFS must be changed.
2011-06-19tests: avoid extra forks in the testsuiteStefano Lattarini
* tests/shell-or-perl: Prefer the `read' builtin over `grep' to look at the shebang line of test scripts. Since `read' is a special builtin, it might abort the whole program upon failures, so add extra sanity checks, verifying that the test script exists and is readable, before trying to read from it.
2011-06-19tests: make test runner a script, not a shell functionStefano Lattarini
This change implements a more correct and idiomatic use of the features of the Automake-provided 'parallel-tests' harness. Moreover, this change is required in order for the testsuite to continue to work with the new testsuite harness that is planned to be introduced in Automake 1.12 (which, as of the writing date, is still under development and in alpha state). * tests/shell-or-perl: New auxiliary script. * tests/Makefile.am (EXTRA_DIST): Distribute it. * tests/check.mk (TESTS_ENVIRONMENT): Remove definition of the `shell_or_perl_' shell function, whose code has been moved in the new script above (with a few improvements and extensions). Do not use it to run the test scripts. (LOG_COMPILER): New, properly invoking `shell-or-perl'.
2011-06-19maint: typo: insert omitted word in test commentJames Youngman
* tests/misc/sort-spinlock-abuse: Fix typo: s/"very expensive" are/"very expensive" tests are/
2011-06-18tests: sort-debug-keys: fix a bug with translated diagnosticsJim Meyering
Ensure that English diagnostics are emitted even when using French sorting rules. * tests/misc/sort-debug-keys: Unset LC_ALL and set LC_COLLATE, LC_CTYPE and LC_NUMERIC to the fr_FR.UTF-8 locale, while setting LC_MESSAGES=C. Reported by Stefano Lattarini.
2011-06-17tests: avoid sort-spinlock-abuse false positive under heavy loadJim Meyering
* tests/misc/sort-spinlock-abuse: Classify as "very expensive" to avoid unwarranted failure once and for all.
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-17tests: make init.sh's warn_ emit to both the tty and the log fileJim Meyering
* tests/init.sh (warn_): When $stderr_fileno_ != 2, emit the diagnostic to both the tty and the log file.
2011-06-17tests: use printf, not echo in init.sh's warn_ functionJim Meyering
* tests/init.sh (warn_): Use printf, not echo. The latter would misbehave when given strings containing a backslash or starting with e.g., -n. James Youngman suggested setting IFS.
2011-06-14tests: accommodate HP-UX and ksh-derived shellsJim Meyering
Running "make check" normally prints a diagnostic to the outermost stderr (usually a tty) to explain why a test is skipped. It did this by redirecting FD 9 to stderr (via "exec 9>&2") before invoking the shell script. Shell scripts write skip-explanation to FD 9 via init.sh's skip_ function. However, with ksh and HP-UX's /bin/sh, the effects of "exec 9>&2" are canceled upon fork-and-exec, so we would get a "Bad file number" diagnostic and no skip explanation on those systems. * tests/check.mk (TESTS_ENVIRONMENT): Redirect more portably, via "$(SHELL) 9>&2", rather than the prior "exec 9>&2; $(SHELL) ..." Actually, we use "shell_or_perl_ 9>&2", to make this effective also for the perl-based tests. * tests/init.sh (stderr_fileno_): Update the advice in comments. See http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22488 for lots of discussion. Stefano Lattarini suggested the solution of putting "9>&2" after the command. Reported by Bruno Haible.
2011-06-13init.sh: sync from gnulibJim Meyering
* tests/init.sh: Sync recent changes from gnulib.
2011-06-13maint: revert previous commitJim Meyering
Revert "init.sh: accommodate shells for which 1>&$stderr_fileno_ fails" This reverts commit 6fb9aeedd1b858a61d5cbf7f15782adf29ff733a. That change did not solve the problem. For details, see http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8846#74
2011-06-13init.sh: accommodate shells for which 1>&$stderr_fileno_ failsJim Meyering
* tests/init.sh (warn_): Use eval to work around a bug in some shells, like those of Solaris 10 and HP-UX 11.11. Improved by Stefano Lattarini.
2011-06-13tests: avoid sort-spinlock-abuse false positive under heavy loadJim Meyering
* tests/misc/sort-spinlock-abuse: This test would frequently fail when run on a system under heavy load. Increase duration and limit.
2011-06-13tests: avoid a false failure on HPUX systemsPádraig Brady
* tests/dd/nocache: Relax the test, as the system may return various errors from posix_fadvise(). HPUX 11.31 returns ENOTTY for example. Reported by Bruno Haible
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-06-01tests: stat-free-color: accommodate stat of /selinux on rawhideJim Meyering
* tests/ls/stat-free-color: This test recently began to fail on rawhide because dynamic library start-up code now stats "/selinux", making the total number of calls 2 rather than the prior 1. Create two more dangling symlinks, so that any erroneous stat- or lstat-calling code will get at least those three.
2011-05-28tests: move tests/misc/split-* into tests/split/...Jim Meyering
* tests/split/suffix-length: Rename from tests/misc/split-a. * tests/split/b-chunk: Rename from misc/split-bchunk. * tests/split/fail: Rename from tests/misc/split-fail. * tests/split/lines: Rename from tests/misc/split-l. * tests/split/l-chunk: Rename from tests/misc/split-lchunk. * tests/split/r-chunk: Rename from tests/misc/split-rchunk. * tests/Makefile.am (TESTS): Reflect renaming.
2011-05-27chown,chgrp: output the correct ownership in -v messagesPádraig Brady
* src/chown_core.c (describe_change): Accept the ownership of the original file and output that when not changing. This is significant when --from is specified as then the original and specified ownership may be different. (user_group_str): A new helper function refactored from describe_change(). (change_file_owner): Pass the original user and group strings to describe_change(). * test/chown/basic: Add a test case. * NEWS: Mention the fix.
2011-05-26split: diagnose when --filter is used with a chunk numberPádraig Brady
* src/split.c (main): Exit with a diagnostic if --filter is specified along with a specific chunk number. * test/split/filter: Ensure this combination fails.
2011-05-26split: exit when we can no longer write to a --filterPádraig Brady
* src/split.c (bytes_split): Stop reading when we can no longer write to a child process. (lines_rr): Likewise. (lines_bytes_split): No change is made here since input is bounded by the original file size. * test/split/filter: Add test cases.
2011-05-26split: return success even if a --filter exitsPádraig Brady
src/split.c (main): Don't unblock SIGPIPE before cleanup, as then any pending signals will be sent and cause the main split process to exit with a non zero status (141). * test/split/filter: Add a test for this case.
2011-05-25split: fix an edge case where -n l/... creates an extra filePádraig Brady
* src/split.c (lines_bytes_chunk): Handle the edge case where the file is truncated as we read. * tests/misc/split-lchunk: Cleanup; no functional change.
2011-05-25chmod: output the original mode in verbose modeBernhard Voelker
* src/chmod.c (describe_change): Pass in the original mode, and output this in the messages. * tests/chmod/c-option: Adjust as per the new message. * THANKS.in: Remove the now auto-generated name. * NEWS: Mention the change in behavior. Signed-off-by: Pádraig Brady <P@draigBrady.com>
2011-05-25tests: ls/stat-free-color: fix unwarranted failure on a 32-bit systemJim Meyering
* tests/ls/stat-free-color: Also check for stat64 and lstat64 syscalls. This fixes a test failure reported by Stefano Lattarini.
2011-05-24split: fix cases where -n l/... creates extraneous filesPádraig Brady
* src/split.c (lines_chunk_split): Ensure that data is only written to stdout when k specified. Also ensure that extra files are not created when there is more data available than reported in the file size. * tests/misc/split-lchunk: Verify that split -n l/k/n doesn't generate any files, and that -n l/n always generates n files. * NEWS: Mention the fix.
2011-05-22tests: fix typo in tac-continueJim Meyering
* tests/misc/tac-continue: Fix typo in usually-skipped test: s/mkfifo_or_skip/mkfifo_or_skip_/ (i.e., append "_"). This test is usually skipped, because I'm probably the only one to set the FULL_PARTITION_TMPDIR envvar, and recently the one I'd been using ceased to exist, so this test was skipped even for me. Good argument for making this a root-only test and creating a full partition just for this test case.
2011-05-18printf: fix an out-of-bounds memory accessPádraig Brady
* src/printf.c (STRTOX): Don't access memory after a string containing a single quote character. * tests/misc/printf: Add tests for various combinations of single quote characters combined with a numeric format. * THANKS.in: Add bug reporter. * NEWS: Mention the fix. Reported-by: Paul Marinescu <paul.marinescu@imperial.ac.uk>
2011-05-14tests: refactor more tests to use mkfifo_or_skip_Pádraig Brady
* tests/cp/existing-perm-race: s/mkfifo/mkfifo_or_skip_/ * tests/cp/file-perm-race: Likewise. * tests/cp/parent-perm-race: Likewise. * tests/cp/special-f: Likewise. * tests/dd/reblock: Likewise. * tests/ls/file-type: Likewise. * tests/misc/cat-buf: Likewise. * tests/misc/mknod: Likewise. * tests/misc/printf-surprise: Likewise. * tests/misc/selinux: Likewise. * tests/misc/sort-spinlock-abuse: Likewise. * tests/misc/stdbuf: Likewise. * tests/misc/tac-continue: Likewise. * tests/init.cfg: Improve the error message when skipping.
2011-05-14shuf: use memory more efficiently when returning a subsetPádraig Brady
* gl/lib/randperm.c (randperm_new): When the number of items to return H, is much smaller than the total number of items N, use a hash to represent the sparse permutations of the set N. This is currently enabled for N > 128K and N/H > 32. * tests/misc/shuf: Ensure shuf can quickly return 2 numbers from a large range. * gl/modules/randperm: Depend on hash. * NEWS: Mention the change.
2011-05-13maint: avoid syntax-check failure due to long lineJim Meyering
* tests/du/bigtime (future_time): Split long line.
2011-05-13maint: add new syntax-check rule to prohibit use of skip_Jim Meyering
* cfg.mk (sc_prohibit_skip_): New rule. * tests/init.cfg (skip_test_): Add a comment.
2011-05-13tests: use skip_test_, not skip_Jim Meyering
skip_test_ emits its diagnostic both to FD 9 (tty), and to FD 2 (usually the log file), whereas init.sh's skip_ emits only to FD 9. Without that, the log is slightly less useful. * tests/cp/fiemap-2: Use skip_test_, not skip_. * tests/cp/fiemap-perf: Likewise. * tests/du/bigtime: Likewise. * tests/du/files0-from-dir: Likewise. * tests/du/move-dir-while-traversing: Likewise. * tests/init.sh: Likewise. * tests/misc/sort-stale-thread-mem: Likewise. * tests/misc/stat-nanoseconds: Likewise. * tests/mv/i-3: Likewise. * tests/mv/sticky-to-xpart: Likewise. * tests/split/filter: Likewise. Prompted by a report from Pádraig Brady.
2011-05-13ls: allow stat-free use of --colorJim Meyering
Even on a system with d_type support, the default use of --color makes ls stat every file in order to be able to honor settings like EXEC, STICKY, ORPHAN, SETUID, etc., because those settings require information that is not provided by dirent.d_type. However, if for a potentially large performance gain, you are willing to disable those settings, you can now make ls --color give type-related coloring and perform no stat calls at all (other than the unavoidable call-per- command-line argument). Before this change, even with all of those attributes disabled, ls --color would still stat every directory. Now, we're down to the minimum of one stat call per command-line arg. * src/ls.c (gobble_file): With --color, don't stat a non-command-line-specified directory when no directory-coloring attribute is enabled. * tests/init.cfg (require_dirent_d_type_): New function. * tests/d_type-check: New script, mostly from Pádraig Brady. * tests/Makefile.am (EXTRA_DIST): Add it. * tests/ls/stat-free-color: New test. * tests/Makefile.am (TESTS): Add it. * doc/coreutils.texi (General output formatting): Describe how to use dircolors to make ls --color refrain from calling stat on a d_type-enabled file system. Prompted by a query from Josef Bacik.
2011-05-07tests: don't fail the split --filter=CMD test if xz is not availableJim Meyering
* tests/split/filter: Skip if xz is not installed.
2011-05-06tests: test split's new --filter=CMD optionJim Meyering
* tests/Makefile.am (TESTS): Add split/filter. * tests/split/filter: New file.
2011-05-06sort: fix a contradictory --debug warningPádraig Brady
* src/sort.c (key_warn): `sort -k2,1n --debug` would output warnings about being both "zero width" and "spanning multiple fields". Suppress the latter one. * tests/misc/sort-debug-warn: Add a couple of test cases.
2011-04-29tests: distribute new file, CuSkip.pmJim Meyering
Without this, most perl-based tests would fail in "make distcheck". * tests/Makefile.am (EXTRA_DIST): Add CuSkip.pm
2011-04-28tests: remove useless test: misc/pwd-unreadable-parentJim Meyering
* tests/Makefile.am (TESTS): Remove misc/pwd-unreadable-parent. This test was misleading and useless (was always skipped). Inspired by a report from Bruno Haible: http://debbugs.gnu.org/8570 * tests/misc/pwd-unreadable-parent: Remove file.
2011-04-28tests: write skip explanation from perl scripts also to outer stderrJim Meyering
* tests/CuSkip.pm (skip): New file/module/function, to help the perl test scripts "skip" a test consistently, emitting a diagnostic both into the log file and into the outermost stderr stream that is more likely to be seen by a human. * tests/check.mk (TESTS_ENVIRONMENT): Add -MCuSkip. * tests/misc/date-next-dow: Use CuSkip::skip in place of warn+exit-77. * tests/misc/tty-eof: Likewise. * tests/misc/uniq: Likewise. * tests/rm/fail-eperm: Likewise. * tests/misc/md5sum-newline: Likewise. Also, s/program_name/ME/. * tests/misc/ls-misc (setuid_setup, main): Likewise. * tests/misc/pwd-long: Likewise, and add -I"$abs_srcdir" -MCuSkip to the $PERL invocation command. Inspired by a request from Bruno Haible regarding misc/tty-eof: http://debbugs.gnu.org/8570
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.