summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2011-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright".
2011-01-01build: update gnulib for version-etc copyright year updateJim Meyering
* tests/sample-test: Update copyright to 2011, to appease syntax-check.
2010-12-31maint: update to latest gnulib, for testsuite improvementEric Blake
* gnulib: Update to latest for init.sh fix. * bootstrap: Resync from gnulib. * tests/init.sh: Likewise.
2010-12-30split: fix the suffix length calculationPádraig Brady
* src/split.c (set_suffix_length): Only auto-calculate the suffix length when the number of files is specified. * tests/misc/split-a: Add a case to trigger the bug, and exercise the suffix length auto-calculation. * NEWS: Mention the fix. Reported by Dmitry V. Levin and Sergey Vlasov at https://bugzilla.altlinux.org/show_bug.cgi?id=24841
2010-12-28coreutils: keep lines within 80-column limitsPaul Eggert
* cfg.mk (LINE_LEN_MAX, FILTER_LONG_LINES): New macros. (sc_long_lines): New rule. * HACKING: Use shorter URLs to the same material. * doc/Makefile.am, doc/coreutils.texi, m4/boottime.m4: * man/help2man, man/stdbuf.x, src/Makefile.am, src/cat.c, src/copy.c: * src/cp.c, src/dd.c, src/df.c, src/du.c, src/groups.c, src/install.c: * src/ls.c, src/md5sum.c, src/mv.c, src/od.c, src/pinky.c, src/ptx.c: * src/readlink.c, src/remove.c, src/rmdir.c, src/setuidgid.c: * src/sort.c, src/tail.c, src/touch.c, tests/Coreutils.pm: * tests/cp/existing-perm-race, tests/cp/perm, tests/cp/preserve-gid: * tests/du/2g, tests/du/long-from-unreadable, tests/init.sh: * tests/install/basic-1, tests/ls/nameless-uid: * tests/ls/readdir-mountpoint-inode, tests/misc/chroot-credentials: * tests/misc/cut, tests/misc/date, tests/misc/join, tests/misc/md5sum: * tests/misc/sha1sum, tests/misc/sha224sum, tests/misc/sort: * tests/misc/sort-continue, tests/misc/sort-files0-from: * tests/misc/sort-rand, tests/misc/stdbuf, tests/misc/tr: * tests/misc/uniq, tests/mv/atomic, tests/mv/part-fail: * tests/mv/part-symlink, tests/mv/sticky-to-xpart, tests/pr/pr-tests: * tests/rm/fail-2eperm, tests/rm/interactive-always: Reformat to fit within 80 columns. * doc/Makefile.am (BAD_POSIX_PERL): New macro. * doc/coreutils.texi: Reword slightly, to make menus and index lines shorter. * src/md5sum.c: Redo --help output so that it fits within 79 columns, since that's a bit more portable and all the other --help strings fit in 79 columns.
2010-12-22maint: correct test-related commentsJim Meyering
* tests/mv/i-3: Adjust comment to match just-changed code. Spotted by Pádraig Brady. * tests/init.cfg (retry_delay_): Correct spelling of function name in usage example.
2010-12-22tests: mv/i-3: avoid false-positive failure on a slow/busy systemJim Meyering
* tests/mv/i-3: Quadruple the timeout duration. Without this, I saw an expired timeout on a heavily-loaded system.
2010-12-21tests: avoid new false-positive failure on at least FreeBSD 8.1Jim Meyering
* tests/mv/trailing-slash: Accommodate different diagnostic on FreeBSD 8.1.
2010-12-18tests: sync init.sh from gnulibPaul Eggert
* tests/init.sh (setup_): Initialize fail=0 before invoking mktempd_. Ensure that IFS is defined initially. (mktempd_): Remove fail=0 initialization; no longer needed.
2010-12-19cp: ensure backups are created when -T specifiedPádraig Brady
* src/cp.c (do_copy): When -T is specified, initialize the NEW_DST and SB variables, which are checked when running: cp -T --force --backup file file * tests/cp/backup-1: Add the -T case
2010-12-19sort: use at most 8 threads by defaultPádraig Brady
* src/sort.c (main): If --parallel isn't specified, restrict the number of threads to 8 by default. If the --parallel option is specified, then allow any number of threads to be set, independent of the number of processors on the system. * doc/coreutils.texi (sort invocation): Document the changes to determining the number of threads to use. Mention the memory overhead when using multiple threads. * tests/misc/sort-spinlock-abuse: Allow single core systems that support pthreads. * tests/misc/sort-stale-thread-mem: Likewise. * tests/misc/sort-unique-segv: Likewise. * NEWS: Mention the change in behaviour.
2010-12-18tests: avoid spurious du/bigtime failureJim Meyering
* tests/du/bigtime: Map nonzero block count to 0. Reported by Assaf Gordon. * THANKS: Update.
2010-12-17tests: set fail=0 by defaultPaul Eggert
* tests/init.sh (setup_): Set fail=0. This was the intent as per <http://lists.gnu.org/archive/html/bug-coreutils/2010-12/msg00058.html> but the assignment in mktempd_ is ineffective, since mktempd_ is used inside `` and its assignments are in a subshell.
2010-12-16sort: fix hang with sort --compressPaul Eggert
* NEWS: Document this. * src/sort.c (UNCOMPRESSED, UNREAPED, REAPED): New constants. (struct tempnode): New member 'state', to hold these constants. The pid member is now undefined if state == UNCOMPRESSED. (struct sortfile): Replace member 'pid' with member 'temp'. (uintptr): Remove. (proctab_hasher, proctab_comparator, register_proc, delete_proc): Proctab entries are now struct tempnode *, not pid_t, to handle the case where multiple tempnode objects correspond to the same pid. This avoids a race condition that can cause a hang. (register_proc): Arg is now struct tempnode *, not pid_t. All callers changed. (delete_proc): Set tempnode state to REAPED. (create_temp_file): No need to set pid member here; it's now done when the pid is known. (maybe_create_temp, create_temp): Remove PPID arg. Return struct tempnode *, not char *. All callers changed. (maybe_create_temp): Set node state to UNCOMPRESSED or UNREAPED. No need to set node->pid to 0. (open_temp): Replace NAME and PID args with a single TEMP arg. All callers changed. Wait only for unreaped children. (zaptemp): Wait for decompressor to finish before removing its temporary-file input. This avoids .nfsXXXX hassles with NFS and fixes a race (leading to a hang) regardless of NFS. (open_input_files): Adjust to new way of dealing with temp files and their subprocesses. * tests/Makefile.am (TESTS): Add misc/sort-compress-hang. * tests/misc/sort-compress-hang: New file.
2010-12-16sort: don't dump core when merging from input twicePaul Eggert
* NEWS: Document this. * src/sort.c (avoid_trashing_input): The previous fix to this function didn't fix all the problems with this code. Replace it with something simpler: just copy the input file. This doesn't change the number of files, so return void instead of the updated file count. Caller changed. * tests/misc/sort-merge-fdlimit: Test for the bug.
2010-12-14tests: default to /tmp as the temporary directoryPaul Eggert
* tests/check.mk (TESTS_ENVIRONMENT): Default TMPDIR to /tmp, rather than to the working directory; this is more common in practice, which makes the tests more real-worldish; and it is often faster. Also, it avoids some problems with NFS cleanups. * tests/misc/sort-compress: Remove unnecessary code setting TMPDIR. * tests/misc/sort-compress-proc: Likewise. Do the final sleep only if TMPDIR is relative, which should be rarely given the change to TESTS_ENVIRONMENT.
2010-12-13sort: fix some --compress reaper bugsPaul Eggert
* src/sort.c (uintptr): New type. (enum procstate, struct procnode, update_proc): Remove. (proctab_hasher, proctab_comparator, register_proc, wait_proc): (reap_some): The proctab is now simply a hash of process-IDs rather than of pointers to objects with reference counts and states; this is smaller and faster and easier to understand. (nprocs): Now pid_t, not size_t, since one cannot have more than PID_MAX children. (reap): If the argument is -1, wait; if 0 (a new value), do not. Delete pid from proctab as needed. Ignore children that are not in proctab, as they are from the program that exec'ed us and are irrelevant to our success or failure. (delete_proc, reap_all): New functions. (open_temp): Register the child. (sort): Clean up all children afterwards; without this patch, 'sort' sometimes missed failures in children due to race conditions. * tests/Makefile.am (TESTS): Add misc/sort-compress-proc. * tests/misc/sort-compress-proc: New file, to test for the bugs fixed above.
2010-12-13tests: typo fixPaul Eggert
* tests/misc/sort-stale-thread-mem: Fix typo in comment.
2010-12-13tests: tweak basic-1 to use warn_ rather than literal "exit 77"Jim Meyering
* tests/install/basic-1 (just_built_dd): Use warn_, rather than cat and exit 77.
2010-12-13tests: mark new test as very expensiveJim Meyering
* tests/misc/sort-stale-thread-mem: Don't initialize fail=0 here; that is done in init.sh. This avoids a syntax-check failure. Invoke "Exit $fail" at end, too. Mark as a very expensive test.
2010-12-12tests: test for access to stale thread memoryPaul Eggert
* tests/misc/sort-stale-thread-mem: New tests. * tests/Makefile.am (TESTS): Add it.
2010-12-11tests: avoid FP failure when run under valgrindJim Meyering
* tests/misc/printenv: Filter out LD_PRELOAD, as the comment said, not LD_LIBRARY.
2010-12-11sort: use mutexes, not spinlocks (avoid busy loop on blocked output)Chen Guo
Running a command like this on a multi-core system sort < big-file | less would peg all processors at near 100% utilization. * src/sort.c: (struct merge_node) Change member lock to mutex. All uses changed. * tests/Makefile.am (XFAIL_TESTS): Remove definition, now that this test passes once again. I.e., the sort-spinlock-abuse test no longer fails. * NEWS (Bug reports): Mention this. Reported by DJ Lucas in http://debbugs.gnu.org/7489.
2010-12-08split: fix a case where --elide-empty causes invalid chunkingPádraig Brady
When -n l/N is used and long lines are present that both span partitions and multiple buffers, one would get inconsistent chunk sizes. * src/split.c (main): Add a new undocumented ---io-blksize option to support full testing with varied buffer sizes. (cwrite): Refactor most handling of --elide-empty to here. (bytes_split): Remove handling of --elide-empty. (lines_chunk_split): Likewise. The specific issue here was the first handling of elide_empty_files interfered with the replenishing of the input buffer. * test/misc/split-lchunk: Add -e and the new ---io-blksize combinations to the test.
2010-12-05tests: remove useless definition of $SORT in sort-compressJim Meyering
* tests/misc/sort-compress (SORT): Remove unused definition.
2010-12-04tests: make it harder to lose a race in spinlock-abuseJim Meyering
* tests/misc/sort-spinlock-abuse: On a busy system, with only 12 pauses of length 0.1 seconds, the buggy (busy-spinlock blocked) sort would fail to accumulate 1 second of CPU time, and hence would mistakenly pass. Increase from 12 to 50.
2010-12-03tests: cleanup rm -rf fails under NFSPaul Eggert
This problem was observed on RHEL 5.5 x86-64 when running as a client of a NetApp FAS2050. * tests/cp/cp-mv-backup: Don't leave a file descriptor open to a file in a directory that will be cleaned up with "rm -rf". Under NFS, when the rm unlinks that file, it is instead renamed to .nfsXXXX and then rm cannot remove the parent directory, and the test fails. * tests/cp/same-file: Likewise.
2010-12-01tests: add test for parallel sort -u segfault bugJim Meyering
* tests/misc/sort-unique-segv: New file. * tests/Makefile.am (TESTS): Add it.
2010-11-27tests: don't let the OMP_NUM_THREADS envvar affect sort testsJim Meyering
* tests/envvar-check (vars): Add OMP_NUM_THREADS.
2010-11-27tests: test for parallel sort spinlock abuseJim Meyering
* tests/misc/sort-spinlock-abuse: New file. * tests/Makefile.am (TESTS): Add it. (XFAIL_TESTS): Mark this as an expected-to-fail (for now) test.
2010-11-22cp: give a better diagnostic for nonexistent dest/Paul Eggert
This patch was written by Jim Meyering and myself. * src/copy.c (copy_reg): Turn EISDIR to ENOTDIR to improve the quality of diagnostics for commands like "cp a nosuch/". Reported by Марк Коренберг and Alan Curry in the thread starting at: http://lists.gnu.org/archive/html/bug-coreutils/2010-11/msg00178.html * THANKS: Update. * tests/mv/trailing-slash: Add a test.
2010-11-22split: add --number to generate a particular number of filesChen Guo
* src/split.c (usage, long_options, main): New options --number, --unbuffered, --elide-empty-files. (set_suffix_length): New function to auto increase suffix length to handle a specified number of files. (create): New function. Refactored from cwrite() and ofile_open(). (bytes_split): Add max_files argument to support byte chunking. (lines_chunk_split): New function. Split file into chunks of lines. (bytes_chunk_extract): New function. Extract a chunk of file. (of_info): New struct. Used by functions lines_rr and ofile_open to keep track of file descriptors associated with output files. (ofile_open): New function. Shuffle file descriptors when there are more output files than available file descriptors. (lines_rr): New function to distribute lines round-robin to files. (chunk_parse): New function. Parses K/N syntax. * tests/misc/split-bchunk: New test for byte chunking. * tests/misc/split-lchunk: New test for line delimited chunking. * tests/misc/split-rchunk: New test for round-robin chunking. * tests/Makefile.am: Reference new tests. * tests/misc/split-fail: Add failure scenarios for new options. * tests/misc/split-l: Fix a typo. s/ln/split/. * doc/coreutils.texi (split invocation): Document --number. * NEWS: Mention the new feature. * .mailmap: Map new email address for shortlog. Signed-off-by: Pádraig Brady <P@draigBrady.com>
2010-11-18od: fix bugs in displaying floating-point valuesPaul Eggert
* NEWS: Describe patch. * bootstrap.conf (gnulib_modules): Add ftoastr. * src/od.c: Include ftoastr.h, not float.h. (FLT_DIG, DBL_DIG): Remove. No need to verify LDBL_DIG. (FMT_BYTES_ALLOCATED): No need to worry about floating point now, since this format is no longer used for floating point. (PRINT_FIELDS): New macro, with most of the guts of the old PRINT_TYPE. (PRINT_TYPE): Rewrite to use PRINT_FIELDS. (PRINT_FLOATTYPE): New macro. This uses the new functions from ftoastr. (print_float, print_double, print_long_double): Reimplement using PRINT_FLOATTYPE. (decode_one_format): Calculate field widths based on ftoastr-supplied macros. * tests/Makefile.am (TESTS): Add misc/od-float. * tests/misc/od-float: New file.
2010-11-17tests: convert tests/misc/selinux manuallyJim Meyering
2010-11-17tests: convert the multi-prog $VERBOSE/--version usesJim Meyering
E.g., -test "$VERBOSE" = yes && { env -- pwd --version; readlink --version; } +print_ver_ pwd readlink -test "$VERBOSE" = yes && { stdbuf --version; mv --version; } +print_ver_ stdbuf mv Use this command: git grep -l 'VERBOSE.*--version'|xargs perl -ni \ -e '/^test "\$VERBOSE" = yes && { .*--version/ or print,next;' \ -e 's/env -- //g;' \ -e 's/test "\$VERBOSE" = yes && { /print_ver_ /;' \ -e ' s/(\w+) --version;/$1/g; s/ *}$//; print'
2010-11-17tests: convert "... env -- prog --version" usesJim Meyering
E.g., -test "$VERBOSE" = yes && env -- pwd --version +print_ver_ pwd git grep -l 'VERBOSE.*--version'|xargs perl -pi -e \ 's/test "\$VERBOSE" = yes && env -- (\w+) --version/print_ver_ $1/'
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: factor out VERBOSE-only --version-printing codeJim Meyering
* tests/init.cfg (print_ver_): New function.
2010-11-17tests: remove test-lib.sh; now all tests use gnulib's init.shJim Meyering
* tests/test-lib.sh: Remove file. No longer used. * tests/Makefile.am (EXTRA_DIST): Remove it here, too. * tests/sample-test: Correct a comment.
2010-11-17tests: convert remaining uses of test-lib.sh to init.shJim Meyering
RHS='. "\${srcdir=.}/init.sh"; path_prepend_ ../src' git grep -l test-lib.sh \ | xargs perl -pi -e 's,^\. \$srcdir/test-lib\.sh$,'"$RHS",
2010-11-17tests: convert 'if test "$VERBOSE" = yes; then' to test ... &&Jim Meyering
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-11-16split: fail immediately if impossible to create a large filePádraig Brady
* src/split.c (main): Error if -[bC] value > OFF_T_MAX * tests/misc/split-fail: Adjust for the new lower limits
2010-11-11csplit: do not rely on undefined behavior in printf formatsPaul Eggert
* doc/coreutils.texi (csplit invocation): Say that %d and %i are aliases for %u. * src/csplit.c (FLAG_THOUSANDS, FLAG_ALTERNATIVE): New constants. (get_format_flags): Now take char const * and int * and return size_t. It now stores info about the flags instead of merely scanning them. Also, it handles '0' correctly. Drop support for the undocumented '+' and ' ' flags since the value is unsigned. Add support for the (undocumented) "'" flag. All uses changed. (get_format_width, get_format_prec): Remove. (check_format_conv_type): Renamed from get_format_conv_type, with a different signature. It now converts the format to one that is compatible with unsigned int, and checks flags. All uses changed. (max_out): Have snprintf compute the number of bytes needed rather than attempting to do it ourselves (which doesn't work portably with outlandish formats such as %4294967296d). (check_format_conv_type, main): Check for overflow in size calculations. Don't assume size_t fits in unsigned int. * tests/misc/csplit: Check for proper handling of flags, with %0#6.3x. Coreutils 8.6 mishandles this somewhat-weird example.
2010-11-11csplit: fix a memory leak per input bufferPádraig Brady
* src/csplit.c (free_buffer): Also free the line offsets buffers (remove_line): Also free the containing structure * tests/misc/csplit-heap: A new test to trigger with leaks of this magnitude. * tests/Makefile.am: Reference the new test * NEWS: Mention the fix Reported by David Hofstee
2010-11-10tests: fix comments and --version invocation in new testJim Meyering
* tests/misc/csplit-1000: Fix comments and --version invocation.
2010-11-10csplit: avoid buffer overrun when writing more than 999 filesJim Meyering
Without this fix, seq 1000 | csplit - /./ '{*}' would write the NUL-terminated file name, xx1000, into a buffer of size 6. * src/csplit.c (main): Use properly sized file name buffer. * NEWS (Bug fixes): Mention it. * tests/misc/csplit-1000: New test to trigger the bug. * tests/Makefile.am (TESTS): Add misc/csplit-1000.
2010-11-09tests: avoid portability problem with dash vs. symlinked ttysPádraig Brady
* tests/mv/i-3: Adjust so that the symlink is resolved before redirecting to the background command, as otherwise the stdin descriptor passed to the command will fail the isatty() or ttyname() test.
2010-11-08tests: avoid portability problem with dash vs. local v=$splittable_valPádraig Brady
* tests/init.cfg (retry_delay_): Adjust awk script to print a single floating point value, rather than many.