summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2011-08-19rm, du, chmod, chown, chgrp: use much less memory for large directoriesJim Meyering
For details, see the gnulib commit, http://git.sv.gnu.org/cgit/gnulib.git/commit/?id=47cb657e * tests/rm/4-million-entry-dir: New test. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it. * gnulib: Update to latest to get the required fts fixes.
2011-08-08tests: avoid lack-of-support du test failure on HP-UX 11.31Jim Meyering
* tests/du/inaccessible-cwd: Skip this test on systems like HP-UX 11.31 that lack both the *at functions and the /proc/self/fd-based support we might have used to emulate them. Reported by Bruno Haible in http://debbugs.gnu.org/8846
2011-08-08join: with --check-order print offending file name, line number and dataJim Meyering
* src/join (g_names): New global (was main's "names"). (main): Update all uses of "names". (line_no[2]): New globals. (get_line): Increment after reading each line. (check_order): Print the standard "file name:line_no: " prefix as well as the offending line when reporting disorder. Here is a sample old/new comparison: -join: file 1 is not in sorted order +join: in:4: is not sorted: contents-of-line-4 * tests/misc/join: Change the two affected tests to expect the new diagnostic. Add new tests for more coverage: mismatch in file 2, two diagnostics, zero-length out-of-order line. * NEWS (Improvements): Mention it. Suggested by David Gast in http://debbugs.gnu.org/9236
2011-08-08maint: add copyright notice to init.cfgJim Meyering
* tests/init.cfg: Add copyright. Suggested by Stefano Lattarini.
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-08-04tests: remove obsolete 'error_' shell functionStefano Lattarini
* tests/init.cfg (framework_failure, getlimits_): Use 'fatal_' instead of 'error_'. (error_): Delete, it's not used anymore (and one is anyway advised to use 'fatal_' instead). Update heading comments. * tests/shell-or-perl (error_): Renamed ... (fatal_): ... to this, for consistency. Also, add a useful comment.
2011-07-27maint: copy: refactor hard link creationPádraig Brady
* src/copy.c (create_hard_link): A new function refactored from existing code. (copy_internal): Call the new function from all 3 locations that create hard links. * tests/cp/same-file: Amend to match the adjusted diagnostic.
2011-07-27tests: cp/preserve-link: test all relevant pathsPádraig Brady
* tests/cp/preserve-link: Add test cases for when a missing link in the destination tree is encountered first and second. Also add cases for old and new separate files in the destination tree, both to make the clobbering behavior explicit, and to test any changes in this area in future.
2011-07-26maint: use consistent style in C and test scriptsJim Meyering
* src/copy.c (copy_internal): Adjust formatting style to conform with guidelines in HACKING: put braces around two one-line "else" blocks. * tests/cp/existing-perm-dir: Use $(...), not `...`, and stat rather than ls+cut to get the mode string. mode=$(stat --p=%A dst/dir)
2011-07-25cp: don't mishandle existing dir dest permissions (Bug#9170)Paul Eggert
* src/copy.c (copy_internal): If we don't create the directory, then we cannot have omitted permissions. Problem and trivial fix reported by Eric Lammerts. * tests/Makefile.am (TESTS): Add cp/existing-perm-dir. * tests/cp/existing-perm-dir: New file.
2011-07-25cp -up: preserve all hard linksJim Meyering
* src/copy.c (copy_internal): With --update (-u), this function would return early once it found that the destination is not older than the source, *without* recording the source-dev/ino--to--dest_name mapping. That mapping is required in order to preserve src hard links in the destination tree, so when using cp with --update and --preserve=links (perhaps via -p or -a), cp could fail to preserve one hard link per inode when at least one of the hard-linked names already exists in the destination tree. Reported by Odd Harry Mannsverk in http://debbugs.gnu.org/8419. * tests/cp/preserve-link: New file. Exercise the flaw/fix. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it.
2011-07-25timeout: support sub-second timeoutsPádraig Brady
* src/timeout.c (settimeout): A new function to convert from a floating point duration and call alarm() or timer_settime() if that's available. (parse_duration): Return a double rather than unsigned int. (usage): Mention floating point is supported. (main): Pass the double to settimeout() rather than calling alarm() directly with the parsed int. (cleanup): Likewise. * doc/coreutils.texi (timeout invocation): Say floating point timeouts now supported, and mention the caveat with resolution. * bootstrap.conf: Include the timer-time gnulib module. * tests/misc/timeout-parameters: Add a test with nanoseconds. * NEWS: Mention the improvement.
2011-07-20unexpand: fix misalignment when spaces span a tabstopPádraig Brady
The following dropped the space from the first field printf "1234567 \t1\n" | unexpand -a Note POSIX says that spaces should not precede tabs. Also a single trailing space should not be converted if the next field starts with non blank characters. So we enforce those rules too, with this change. * src/unexpand.c (unexpand): Implement as per POSIX rules. * tests/misc/unexpand: Add tests, and adjust existing tests as per POSIX rules. * NEWS: Mention the fix. Reported by Hallvard B Furuseth
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.