summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2010-10-04tests: refactor the stat-birthtime test to use retry_delay_Pádraig Brady
* tests/misc/stat-birthtime: This recently added test fits the pattern of requiring a delay to pass, so get it to use retry_delay_()
2010-10-01tests: output --version of program under testEric Blake
This touches all new tests added since commit b062bbd9, when init.cfg was added. Older tests still exist that could use conversion, but we can address those later. * tests/sample-test: Restore hint for --version output. * tests/misc/stat-birthtime: Include --version if verbose. * tests/misc/tr-case-class: Likewise. * tests/misc/stat-mount: Likewise. * tests/misc/sort-unique: Likewise. * tests/misc/sort-benchmark-random: Likewise. Suggested by Jim Meyering.
2010-10-01stat: print timestamps to full resolutionEric Blake
* src/stat.c (epoch_time): New function. (print_stat): Use it for %[WXYZ]. * NEWS: Document this. * tests/touch/60-seconds: Adjust test to match. * tests/misc/stat-birthtime: Likewise.
2010-10-01stat: support printing birthtimeEric Blake
* src/stat.c (print_stat): New %w and %W formats. (do_stat): Include %w in default format. (usage): Document new specifiers. * doc/coreutils.texi (stat invocation): Likewise. * NEWS: Likewise.
2010-10-01maint: update sample test templateEric Blake
* tests/sample-test: Recommend modern idiom.
2010-09-29tr: fix various issues with case conversionPádraig Brady
This valid translation spec aborted: LC_ALL=en_US.iso-8859-1 tr '[:upper:]- ' '[:lower:]_' This invalid translation spec aborted: LC_ALL=en_US.iso-8859-1 tr '[:upper:] ' '[:lower:]' This was caused by commit 6efd1046, 05-01-2008, "Avoid tr case-conversion failure in some locales" This misaligned conversion spec was allowed: LC_ALL=C tr 'A-Y[:lower:]' 'a-z[:upper:]' This was caused by commit af5d0c36, 21-10-2007, "tr: do not reject an unmatched [:lower:] or [:upper:] in SET1" This misaligned spec was allowed by extending the class: LC_ALL=C tr '[:upper:] ' '[:lower:]' * src/tr.c (validate_case_classes): A new function to check alignment of case conversion classes. Also it adjusts the length of the sets so that locales with different numbers of upper and lower case characters, don't cause issues. (string2_extend): Disallow extending the case conversion class as in the above example. That is locale dependent and most likely not what the user wants. (validate): Do the simple test for "restricted" char classes earlier, so we don't redundantly do more expensive validation. (main): Remove the case class validation, and simplify. * tests/misc/tr-case-class: A new test to test the various alignment and locale issues, associated with case conversion. * tests/misc/tr: Move case conversion tests to new tr-case-class. * tests/Makefile.am: Reference the new test. * NEWS: Mention the fixes.
2010-09-20tests: fix a printf portability issuePádraig Brady
* tests/misc/sort-debug-keys: Don't depend on printf supporting \xhh format, which isn't supported by dash for example. Also change from double quoted strings to single quoted, when we don't need any variable interpolation.
2010-09-20tests: fix an erroneous stat failure with bind mountsPádraig Brady
* tests/misc/stat-mount: Don't try to correlate the mount points output by df and stat, as they're similar, but sometimes different in the presence of bind mounts. * doc/coretuils.texi (stat invocation): Clarify the bind mount difference between stat and df.
2010-09-18tests: sync tests/init.sh from gnulibJim Meyering
* tests/init.sh: Update from gnulib.
2010-09-17maint: update to latest gnulibEric Blake
* gnulib: Update to latest. * src/copy.c (copy_reg): Use fdutimens instead of gl_futimens. * src/touch.c (touch): Adjust parameter order. * tests/init.sh: Resync from upstream.
2010-09-07tests: work around a failure with dash 0.5.4Pádraig Brady
* tests/misc/env: Check that the shell can support the operation, before filtering through `env`. Note dash 0.5.5 is unaffected by this issue.
2010-09-07tests: make various timeouts more robustPádraig Brady
* tests/init.cfg (retry_delay_): Describe the backoff method used. * tests/ls/readdir-mountpoint-inode: Add a timeout to the stat call to eliminate the chance of hangups. * tests/mv/i-3: Change the timeout required to pass from 1 second to a range of .1s - 3.1s. * tests/rm/dangling-symlink: Likewise.
2010-09-07tests: exclude some tests when running on NFSPádraig Brady
All tests currently pass on NFS on Linux kernel 2.6.22 at least, but some fail on 2.6.9, so we exclude those here. * tests/init.cfg (is_local_dir_): A new function returning if the specified directory is on a local file system. (require_local_dir_): A new function to skip tests if the current directory is not on a local file system. * tests/cp/existing-perm-race: Skip if non local. * tests/cp/file-perm-race: Likewise. * tests/cp/parent-perm: Likewise. * tests/cp/parent-perm-race: Likewise. * tests/cp/preserve-2: Likewise. * tests/mv/part-symlink: Likewise. * tests/du/basic: Use refactored function. * tests/install/basic-1: Likewise. * tests/mkdir/p-3: Likewise. * tests/dd/skip-seek-past-dev: Likewise. * tests/du/slink: Likewise. Remove redundant test for NFS file system. * tests/misc/join: s/local/locale/.
2010-08-28tac: avoid double freeJim Meyering
* src/tac.c (main): Reading a line longer than 16KiB would cause tac to realloc its primary buffer. Then, just before exit, tac would mistakenly free the original (now free'd) buffer. This bug was introduced by commit be6c13e7, "maint: always free a buffer, to avoid even semblance of a leak". * NEWS (Bug fixes): Mention it. * tests/misc/tac (double-free): New test, to exercise this. Reported by Salvo Tomaselli in <http://bugs.debian.org/594666>.
2010-08-27stat: add %m to output the mount point for a fileAaron Burgemeister
* src/find-mount-point.c: A new file refactoring find_mount_point() out from df.c * src/find-mount-point.h: Likewise. * src/df.c: Use the new find-mount-point module. * src/stat.c (print_stat): Handle the new %m format. (find_bind_mount): A new function to return the bind mount for a file if any. (out_mount_mount): Print the bind mount for a file, or else the standard mount point given by the find-mount-point module. (usage): Document the %m format directive. * src/Makefile.am: Reference the refactored find-mount-point.c * po/POTFILES.in: Add find_mount_point.c to the translation list * doc/coreutils.texi (stat invocation): Document %m, and how it may differ from the mount point that df outputs. * test/misc/stat-mount: A new test to correlate mount points output from df and stat. * tests/Makefile.am: Reference the new test. * NEWS: Mention the new feature * THANKS: Add the author Signed-off-by: Pádraig Brady <P@draigBrady.com>
2010-08-13* tests/misc/sort (use-nl): Fix comment to match the test case.Paul Eggert
2010-08-09ls: fix a test failure that should have been skippedDan Hipschman
* tests/ls/readdir-mountpoint-inode: Check to see if skip_test_ is called in a helper function via $() instead of mistakenly failing. * THANKS: Update.
2010-08-06sort: support all combinations of -d, -f, -i, -R, and -VPaul Eggert
* NEWS: Document this. * src/sort.c (getmonth): Omit LEN arg, as MONTH is now null-terminated. (compare_random): Don't null-terminate keys, as caller now does that. (compare_version): Remove. (debug_key): Null-terminate string for getmonth. (keycompare): Support combining -R with any of -d, -f, -i, -V. Also, support combining -V with any of -d, -i. (check_ordering_compatibility): Allow newly-supported combinations. * tests/misc/sort (02q, 02r, 02s): New tests, for new combinations. (incompat2): Now test -nR, since -fR are now compatible.
2010-08-05sort: tune and refactor --debug code, and fix minor underlining bugPaul Eggert
Formerly, the 'compare' function and some of its subroutines had a debugging flag, which caused them to output underlines. This change refactors the code so that debugging output is more-separated from the actual sorting. In the process, the change fixes a minor error in the debugging output. The change shortens the source code and executable size a tad, and improves CPU performance by 2.4% on my platform with a simple benchmark (C locale, line sorting, no debug). * src/sort.c (long_double, strtold): Move back to prelude, since they're now used by multiple functions again. (unit_order): Move to file scope, since it's now used by two functions. (find_unit_order, human_numcompare, numcompare, general_numcompare): Remove endptr parameter. All callers changed. (human_numcompare): Args are now const pointers. (getmonth): Endptr is now non-const. (key_numeric): Move up, since it's needed earlier. (debug_key): Take a line and a key as argument, instead of having the caller figure out where the field is. (debug_line): New function. (keycompare, compare): Omit debug parameter; debug output now done elsewhere. All callers changed. (write_line): Renamed from write_bytes; all callers changed. Use debug_line (not 'compare') to output debug info. Use a slightly faster check for whether output file is stdout. (check): Don't do debugging output; it's not that useful here, and it confuses the code. (main): Check for incompatibility between -c and --debug. Use standard diagnostic for incompatible options. * tests/misc/sort-debug-keys: Fix test case: "--Mi-1" is not a number, so its first character should not be underlined when debugging a numeric sort.
2010-08-03init.sh: work around trap limitation of some shellsPaul Eggert
* tests/init.sh (setup_): Move exit trap outside of shell function. This patch is imported from gnulib.
2010-08-03sort: fix bug in --debug when \0 is followed by \tPaul Eggert
* src/sort.c (debug_width): New function, which does not stop counting tabs at \0, and also invokes mbsnwidth. Stamp out strnlen! (count_tabs): Remove. (debug_key): Use debug_width instead of mbsnwidth and count_tabs. * tests/misc/sort-debug-keys: Check that \0 and \t intermix.
2010-08-02sort: revert recent -h changes and use a more-conservative approachPaul Eggert
* NEWS: Document changes to sort -h, which are now minor with respect to the pre-July-30th version. * doc/coreutils.texi (sort invocation): Likewise. The documentation now describes how -h comparison is done rather than being vague with border cases. * src/sort.c (long_double, strtold): Move back to general_numcompare. (LD, compute_human): Remove. (find_unit_order): Remove THOU_SEP parameter, since thousands separators are now allowed by all callers. Revert to previous behavior of sorting by suffix, and returning the order rather than 2 * order + binary, since we no longer care whether binary powers are being used. However, treat all zeros the same, instead of sorting 0M before 0G; this is more consistent with the desired behavior of sorting -1G before -1M. * tests/misc/sort (h1, h3, h6): Adjust to match mostly-reverted behavior. However, check that all zeros sort together. * tests/misc/sort-debug-keys: Omit a "_", since the trailing "i" in "1234Gi" is no longer part of the key.
2010-07-30sort: -h now handles comparisons such as 6000K vs 5M and 5MiB vs 5MBPaul Eggert
* NEWS: Document changes to sort -h. * doc/coreutils.texi (sort invocation): Likewise. * src/sort.c (long_double, strtold): Move to prelude, since they're now used by multiple functions. (LD): New macro. (struct keyfield.iec_present): Remove this member. All uses removed. (check_mixed_SI_IEC): Remove. This code was busted in the presence of multiple threads, as it had a race condition. (find_unit_order): Remove arg KEY; add arg THOU_SEP; arg ENDPTR is now char ** rather than char const **. Return an integer that distinguishes decimal from binary powers. Parse the number consistently with the intersection of strtold and strnumcmp. Set *ENDPTR unconditionally. (compute_human): New static function. (human_numcompare): Remove arg KEY. Remove 'const' from other args. Use strnumcmp if possible, but fall back on floating point if not. (numcompare, general_numcompare): Arg EA is now char ** rather than char const **. (numcompare): Adjust to new find_unit_order signature and behavior. (keycompare): Adjus to new human_numcompare signature. * tests/misc/sort (h1, h3, h4, h6): Adjust to new behavior. * tests/misc/sort-debug-keys: Likewise.
2010-07-26sort: fix bug with EOF at buffer refillPaul Eggert
* src/sort.c (fillbuf): Don't append eol unless the line is nonempty. This fixes a bug that was partly but not completely fixed by the aadc67dfdb47f28bb8d1fa5e0fe0f52e2a8c51bf commit (dated July 15). * tests/misc/sort (realloc-buf-2): New test, which catches this bug on 64-bit hosts.
2010-07-24du: tune, and fix some -L bugs with dangling or cyclic symlinksPaul R. Eggert
* src/du.c (process_file): Avoid recalculation of hashes and of file-exclusion for directories. Do not descend into the same directory more than once, unless -l is given; this is faster. Calculate stat buffer lazily, since it need not be computed at all for excluded files. Count space if FTS_ERR, since stat buffer is always valid then. No need for 'print' local variable. (main): Use FTS_NOSTAT. Use FTS_TIGHT_CYCLE_CHECK only when not hashing everything, since process_file finds cycles on its own when hashing everything. * tests/du/deref: Add test cases for -L bugs.
2010-07-23tests/misc/sort-merge-fdlimit: don't assume -R opens /dev/urandomPaul R. Eggert
* tests/misc/sort-merge-fdlimit: This test was written assuming that -R typically opens /dev/urandom, but that's no longer the case. Redo test to specify a random source; this resurrects the point of checking for file descriptor exhaustion. Also try plain -R, since that implementation may change in the future too.
2010-07-15sort: add a test case for the sort -u bugPaul R. Eggert
* tests/Makefile.am (TESTS): Add misc/sort-unique. * tests/misc/sort-unique: New file.
2010-07-13sort: parallelize internal sortChen Guo
This patch is by Gene Auyeung, Chris Dickens, Chen Guo, and Mike Nichols, based off of a patch by Paul Eggert, Glen Lenker, et. al., with a basic heap implementation based off of the GDSL heap, originally by Nicolas Darnis. The number of sorts done in parallel is limited to the number of available processors by default, or can be further restricted with the --parallel option. On a dual-die, 8 core Intel Xeon, results show sorting with 8 threads is almost 4 times faster than using a single thread. Timings when sorting a 96MB file: THREADS TIME (s) 1 5.10 2 2.87 4 1.75 8 1.31 Single threaded sorting has also been improved, especially for cheaper comparison operations: COMMAND BEFORE (s) AFTER (s) sort 8.822 8.716 sort -g 10.336 10.222 sort -n 3.077 2.961 LANG=C sort 2.169 2.066 * bootstrap.conf: Add heap, pthread. * coreutils.texi (sort): Describe the new --parallel option. * gl/lib/heap.c: New file. Very basic heap implementation. * gl/lib/heap.h: New file. * gl/modules/heap: New file. * src/Makefile.am: Add LIB_PTHREAD. * src/sort.c: Include heap.h, nproc.h, pthread.h. (MAX_MERGE): New macro. (SUBTHREAD_LINES_HEURISTIC, PARALLEL_OPTION): New constants. (MERGE_END, MERGE_ROOT): New constants. (struct merge_node): New struct. (struct merge_node_queue): New struct. (sortlines temp): Remove declaration. (usage, long_options, main): New option, --parallel. (specify_nthreads): New function. (mergelines): New signature, to emphasize the fact that the HI area must be part of the destination. All callers changed. (sequential_sort): New function, renamed from sortlines. Merge in the functionality of sortlines_temp. (compare_nodes): New function. (lock_node, unlock_node): New functions. (queue_destroy): New function. (queue_init): New function. (queue_insert): New function. (queue_pop): New function. (write_unique): New function. (mergelines_node): New function. (check_insert): New function. (update_parent): New function. (merge_loop): New function. (sortlines): Rewrite to support and use parallelism, with a new signature. All callers changed. (struct thread_args): New struct. (sortlines_thread): New function. (sortlines_temp): Remove. (sort): New argument NTHREADS. All uses changed. Output moved to mergelines_node. (main): disable threading if we are sorting at random. * tests/Makefile.am (TESTS): Add misc/sort-benchmark-random. * tests/misc/sort-benchmark-random: New file. Signed-off-by: Pádraig Brady <P@draigBrady.com>
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-07-03du: don't miscount duplicate directories or link-count-1 filesPaul Eggert
* NEWS: Mention this. * src/du.c (hash_all): New static var. (process_file): Use it. (main): Set it. * tests/du/hard-link: Add a couple of test cases to help make sure this bug stays squashed. * tests/du/files0-from: Adjust existing tests to reflect change in semantics with duplicate arguments.
2010-07-01cp: add an option to only copy the file attributesPádraig Brady
* src/copy.c (copy_attr): A new function which merges copy_attr_by_fd and copy_attr_by_name. Also display all errors when --attributes-only * src/copy.c (copy_reg): Skip copying the file contents if specified. Refactor the SELinux error handling code a little and display all SELinux errors when only copying attributes. * src/copy.h (struct cp_options): Add a data_copy_required boolean * src/cp.c (main): Default to copying data but don't if specified * src/install.c: Default to copying data * src/mv.c: Likewise tests/cp/reflink-perm: Add a test to check that --attributes-only does not copy data * tests/cp/acl: Likewise. Also refactor to remove redundant acl manipulation * doc/coreutils.texi (cp invocation): Describe the new option * NEWS: Mention the new feature
2010-07-01ls: use the POSIX date style when the locale does not specify onePádraig Brady
Previously we defaulted to "long-iso" format in locales without specific format translations, like the en_* locales for example. This reverts part of commit 6837183d, 08-11-2005, "ls ... acts like --time-style='posix-long-iso' if the locale settings are messed up" * src/ls.c (decode_switches): Only use the ISO format when specified. * NEWS: Mention the change in behavior. Reported by Daniel Qarras at http://bugzilla.redhat.com/525134
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-06-30tests: move most helper functions from test-lib.sh to new init.cfgJim Meyering
From there, they will be used by both test-lib.sh (as we phase it out) and the newer init.sh, to which all tests will migrate. * tests/test-lib.sh: Move most functions from here, ... * tests/init.cfg: ...to here. New file. * tests/Makefile.am (EXTRA_DIST): Add init.cfg.
2010-06-30tests: sync tests/init.sh from gnulibJim Meyering
* tests/init.sh: Update from gnulib.
2010-05-31tests: remove unnecessary single quotes in perl hash use: ->{'SYM'}Jim Meyering
Run this command: git grep -l "limits->{'" \ | xargs perl -pi -e "s/limits->{'(.*?)'}/limits->{\$1}/g" * cfg.mk (sc_prohibit_perl_hash_quotes): New rule to match. * tests/misc/join: Remove quotes. * tests/misc/sort: Likewise. * tests/misc/sort-merge: Likewise. * tests/misc/test: Likewise. * tests/misc/unexpand: Likewise. * tests/misc/uniq: Likewise.
2010-05-29truncate: improve handling of non regular filesPádraig Brady
Previously we copied `dd` and suppressed error messages when truncating neither regular files or shared mem objects. This was valid for `dd`, as truncation is ancillary to copying it may also do, but for `truncate` we should display all errors. Also we used the st_size from non regular files which is undefined, so we display an error when the user tries this. * src/truncate (do_truncate): Error when referencing the size of non regular files or non shared memory objects. Display all errors returned by ftruncate(). (main): Error when referencing the size of non regular files or non shared memory objects. Don't suppress error messages for any file types that can't be opened for writing. * tests/misc/truncate-dir-fail: Check that referencing the size of a directory is not supported. * tests/misc/truncate-fifo: Ensure the test doesn't hang by using the `timeout` command. Don't test the return from running ftruncate on the fifo as it's system dependent as to whether this fails or not. NEWS: Mention the change in behavior. Reported by Jim Meyering.
2010-05-28truncate: support sizes relative to an existing filePádraig Brady
* doc/coreutils.texi (truncate invocation): Mention that --reference bases the --size rather than just setting it. * src/truncate.c (usage): Likewise. Also remove the clause describing --size and --reference as being mutually exclusive. (do_truncate): Add an extra parameter to hold the size of a referenced file, and use it if positive. (main): Pass the size of a referenced file to do_truncate(). * tests/misc/truncate-parameters: Adjust for the new combinations. * NEWS: Mention the change Suggested by Richard W.M. Jones
2010-05-26tests: update help-version to work with parted, tooJim Meyering
* tests/misc/help-version: Add init code for GNU Parted.
2010-05-25maint: remove unneeded double quotes on RHS of shell assignmentsJim Meyering
Run this command: git grep -l 'LC_[A-Z]*="' \ | xargs perl -pi -e 's/(LC_[A-Z]*)="(.*?)"/$1=$2/' * src/Makefile.am: Write LC_ALL=$$locale, not LC_ALL="$$locale". * src/date.c (main): Similar, in a comment. * tests/misc/sort-month: Write LC_ALL=$LOC, not LC_ALL="$LOC".
2010-05-24maint: remove a redundant sort parameter from a testPádraig Brady
* tests/misc/sort-month: Remove the -b option which is redundant and ignored.
2010-05-24sort: adjust the leading blanks --debug warningPádraig Brady
* src/sort.c (key_warnings): Always warn about significant leading blanks when character offsets are specified, unless they key is possibly a line offset, i.e. of the form -k1.x,1.y. Also suppress this warning if the user could be sorting right aligned indexes.
2010-05-23maint: make copyright comment consistent with all othersJim Meyering
* tests/misc/mktemp: Change punctuation to make copyright paragraph consistent with all of the others.
2010-05-21tests: fix cp-a-selinux to skip cleanly upon mkfs failureJim Meyering
* tests/cp/cp-a-selinux: Initialize skip, to avoid a syntax error in subsequent "test". Remove redirect-to-/dev/null, now that output is always to a log file.
2010-05-19du: recognize -d N as equivalent to --max-depth=NJon Ringuette
* NEWS (New features): Mention it. * src/du.c (DEBUG_OPT): Remove. Use long-named ---debug instead. Commented out. (MAX_DEPTH_OPTION): Remove. Use 'd' instead. (main): Insert literal "d:"; remove DEBUG_OPT. * doc/coreutils.texi (du invocation): Add -d to indices. * tests/du/max-depth: Exercise -d, too.
2010-05-19tests: exercise du's --max-depth optionJim Meyering
* tests/Makefile.am (TESTS): Add du/max-depth. * tests/du/max-depth: New file.
2010-05-18tests: fix sort-debug-keys when fr_FR.utf8 not availablePádraig Brady
* tests/misc/sort-debug-keys: Correctly check for the absence of the French UTF8 locale.
2010-05-17tests: update init.sh from gnulibJim Meyering
* tests/init.sh: Update from gnulib.
2010-05-16sort: --debug: output data independent warnings and infoPádraig Brady
* src/sort.c (usage): Mention --debug can output warnings to stderr. Also split the translatable string to aid translation. (default_key_compare): A new function refactored from main(), and now also called from the new key_warnings() function. (key_to_opts): A new function refactored from incompatible_options(), and now also called from the new key_warnings() function. (key_numeric): A new function refactored to test if key is numeric. (key_warnings): A new function to output warnings to stderr, about questionable use of various options. Currently it warns about zero length keys and ineffective global options. (incompatible_options): Refactor out key_to_opts() (main): Use key_init() to initialize gkey. Refactor out default_key_compare(). Call key_warnings() in debug mode. * doc/coreutils.texi (sort invocation): Mention that warnings are output by --debug. * tests/misc/sort-debug-warn: A new test for debug warnings. * tests/Makefile.am: Reference the new test. * NEWS: Mention the new feature
2010-05-12tests: fix sort-debug-keys when fr_FR.utf8 not availablePádraig Brady
* tests/misc/sort-debug-keys: Don't verify (or even run) the fr_FR tests when that locale is not available on the system.