summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
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.
2010-05-12sort: add a --debug option to highlight key extentsPádraig Brady
* src/sort (usage): Add description for --debug. (write_bytes): Pass a line structure so it can subsequently be passed to compare to highlight the keys when in debug mode. Also transform TAB and NUL characters written to stdout so that the highlighting in debug mode aligns correctly. (human_numcompare): Pass an "endptr" so we can record the extent of the number matched. (general_numcompare): Likewise. (find_unit_order): Likewise. (getmonth): Likewise. (numcompare): Likewise. Note we reuse find_unit_order() for this, which is a good enough approximation, and means we don't need to change the strnumcmp() interface. (check_mixed_SI_IEC): Return whether iec_present, so that can be used to set the "endptr" in find_unit_order. Also make the key parameter optional, which will be the case from numcompare(). (count_tabs): A new function to determine how much to adjust the mbswidth() values by (TABs don't have a width). (mark_key): A new function to output the key highlighting to stdout. (debug_key): A new function to determine the offset and width of the key highlighting. (key_compare): Pass the show_debug parameter so the key highlighting is only displayed when explicitly called. For each key type, set the length (lena) and whether leading blanks are auto skipped (skipb) which are then used by debug_key() to highlight the portion of the key used in the comparison. (compare): Pass the show_debug parameter so the key highlighting is only displayed when explicitly called. Call debug_key() to highlight the last resort comparison. (check): Output highlighting for disorder line to stdout. (main): Process the --debug option and make it mutually exlusive with the -o option as I don't see it useful there, even potentially harmful if someone left a --debug in by mistake when updating a file. Also restricting debug output to stdout, simplifies the logic for dealing with temporary files. * doc/coreutils.texi (sort invocation): Describe the --debug option, and reference it from the --key description. * tests/misc/sort-debug-keys: A new test for highlighting keys. * tests/Makefile.am: Reference the new test. * NEWS: Mention the new feature.
2010-05-11build: update gnulib submodule to latestJim Meyering
* tests/init.sh: Update from gnulib, to fix typo.
2010-05-10tests: begin using init.shJim Meyering
* tests/init.sh: New file. * tests/Makefile.am (EXTRA_DIST): Add it here.
2010-05-09tests: update help-versionJim Meyering
* tests/misc/help-version: Use init.sh, rather than test-lib.sh. Add idutils' setup.
2010-04-29sort: use long doubles for general numeric modePádraig Brady
* src/sort.c (general_numcompare): Use long doubles unconditionally, and strtold when available, to convert numbers with greater range and precision. Performance was seen to be on par with standard doubles. * doc/coreutils.texi (sort invocation): Amend the -g description to mention long double rather than double, and strtold rather than strtod. * src/getlimits.c (main): Output floating point limits for use in tests. * tests/misc/sort-float: A new test to ensure sort is using long doubles when possible, and that locale specific floats are handled. * tests/Makefile.am: Reference the new test. * tests/test-lib.sh (getlimits_): Normalize indenting. * NEWS: Mention the new behaviour. Reported by Nelson Beebe.
2010-04-24tests: clean up also upon SIGQUITJim Meyering
* tests/test-lib.sh: Also trap on SIGQUIT. Spotted by Dmitry V. Levin.
2010-04-23tests: fix exit status of signal handlers in shell scriptsDmitry V. Levin
The value of `$?' on entrance to signal handlers in shell scripts cannot be relied upon, so set the exit code explicitly. * cfg.mk (sc_always_defined_macros, sc_system_h_headers): Set the exit code in signal handler explicitly to 128 + SIG<SIGNAL>. * src/Makefile.am (sc_tight_scope): Likewise. * tests/test-lib.sh: Likewise.
2010-04-20sort: fix parsing of end field in obsolescent key formatsPádraig Brady
This regression was introduced in commit 224a69b5, 2009-02-24, "sort: Fix two bugs with determining the end of field". The specific regression being that we include 1 field too many when an end field is specified using obsolescent key syntax (+POS -POS). * src/sort.c (struct keyfield): Clarify the description of the eword member, as suggested by Alan Curry. (main): When processing obsolescent format key specifications, normalize eword to a zero based count when no specific end char is given for an end field. This matches what's done when keys are specified with -k. * tests/misc/sort: Add a few more tests for the obsolescent key formats, with test 07i being the particular failure addressed by this change. * THANKS: Add Alan Curry who precisely identified the issue. * NEWS: Mention the fix. Reported by Santiago Rodríguez
2010-04-16cp: preserve "capabilities" when also preserving file ownershipPádraig Brady
* src/copy.c (copy_reg): Copy xattrs _after_ setting file ownership so that capabilities are not cleared when setting ownership. * tests/cp/capability: A new root test. * tests/Makefile.am (root_tests): Reference the new test. * NEWS: Mention the fix.
2010-04-16tests: avoid spurious failure of ls/color-norm testPádraig Brady
* tests/ls/color-norm: Use the "time" output by `ls -l` to check normal style. Previously we used the size from `ls -s`, but the size of "empty" files can vary depending on whether SELinux is enabled for example.
2010-04-14tests: avoid spurious failure of root-only ls/capability testJim Meyering
* tests/ls/capability: Adjust this test not to expect the no-op escape sequence that was removed from all other tests by 2010-01-30 commit 5d43617e, "ls --color: don't emit a final no-op escape sequence".
2010-04-13cp: treat selinux warnings consistentlyPádraig Brady
* src/copy.c (copy_reg): Suppress SELinux ENOTSUP warnings consistently between the destination being present or not. Previously we did not suppress ENOTSUP messages when the destination was present. (copy_internal): Use the same ENOTSUP supression method as copy_reg() even though the issue was not seen in this case. * tests/cp/cp-a-selinux: Add a test case for the issue and group the other test cases in the file more coherently. * tests/cp/cp-mv-enotsup-xattr: Do the same check for xattr warnings, even though they did not have the issue.
2010-04-07tests: add a PATH-sanity-check to help-versionJim Meyering
* tests/misc/help-version: Sync from gzip's version. * tests/check.mk (TESTS_ENVIRONMENT): Export VERSION, as required for new help-version test.
2010-03-29tests: avoid spurious sc_prohibit_test_minus_ao syntax-check failuresJim Meyering
* tests/misc/ls-time: Change comments and diagnostics. * tests/misc/xattr: Likewise.
2010-03-26tests: fix typos in envvar-check scriptJim Meyering
* tests/envvar-check: Fix variable name typos. Probably harmless, since no selected shell would fail to unset.
2010-03-26nice,chroot: use more standard option parsingPádraig Brady
Related to the 2010-03-25 commit, 88d4b346, "timeout: use more standard option parsing". * src/nice.c (main): Don't use parse_long_options() which is a helper for commands that don't have any long options specific to them. * src/chroot.c (main): Likewise. * tests/misc/nice-fail: Remove a case that now passes due to us accepting multiple instances of the --help and --version options. * tests/misc/chroot-fail: Likewise.
2010-03-26timeout: use more standard option parsingKim Hansen
* src/timeout.c (main): Don't use parse_long_options() which is a helper for commands that don't have any long options specific to them. * tests/misc/timeout-parameters: Remove a case that now passes due to us accepting multiple instances of the --help and --version options. * THANKS: Add the author. Signed-off-by: Pádraig Brady <P@draigBrady.com>
2010-03-19tests: change help-version to per-program functionsPaolo Bonzini
* help-version: Change each *_args variable to a *_setup function.
2010-03-16timeout: add the --kill-after optionPádraig Brady
Based on a report from Kim Hansen who wanted to send a KILL signal to the monitored command when `timeout` itself received a termination signal. Rather than changing such a signal into a KILL, we provide the more general mechanism of sending the KILL after the specified grace period. * src/timeout.c (cleanup): If a non zero kill delay is specified, (re)set the alarm to that delay, after which a KILL signal will be sent to the process group. (usage): Mention the new option. Separate the description of DURATION since it's now specified in 2 places. Clarify that the duration is an integer. (parse_duration): A new function refactored from main(), since this logic is now called for two parameters. (main): Parse the -k option. * doc/coreutils.texi (timeout invocation): Describe the new --kill-after option and use @display rather than @table to show the duration suffixes. Clarify that a duration of 0 disables the associated timeout. * tests/misc/timeout-parameters: Check invalid --kill-after. * tests/misc/timeout: Check a valid --kill-after works. * NEWS: Mention the new feature.
2010-03-04tests: don't let the LANGUAGE envvar perturb testsJim Meyering
* tests/envvar-check (vars): Add LANGUAGE to the list of envvars to unset. At least in glibc (as an extension to POSIX), its value actually trumps LC_ALL: $ LC_ALL=es_ES LANGUAGE=fr_FR.UTF-8 /bin/cat no-such /bin/cat: no-such: Aucun fichier ou dossier de ce type but only when the default locale is not C: $ LC_ALL=C LANGUAGE=fr_FR.UTF-8 /bin/cat no-such /bin/cat: no-such: No such file or directory Prompted by a report from Mads Kiilerich.
2010-03-01sort: fix issues with month sorting in some localesPádraig Brady
* src/sort.c (char fold_toupper[]): Change to unsigned so as the correct comparisons are made in getmonth(). This fixes unibyte locales where abbreviated months have characters that are > 0x7F, but it also works for multibyte locales with the caveat that multibyte characters are matched case sensitively. With this change, the following example sorts correctly: $ echo -e "1 márta\n2 Feabhra" | LANG=ga_IE.utf8 sort -k2,2M 2 Feabhra 1 márta * src/sort.c (inittables): Since we ignore blanks around months in the input, don't include them when they're present in the locale. With this change, the following example sorts correctly: $ echo -e "1 2月\n2 1月" | LANG=ja_JP.utf8 sort -k2,2M 2 1月 1 2月 * tests/misc/sort-month: A new test to exercise the above cases. * tests/Makefile.am: Reference the new test. * NEWS: Mention the fix.
2010-02-25expr: clarify error messageEric Blake
* src/expr.c (eval4, eval3): Clarify that expr expects integers, and not the broader category of numbers. * tests/misc/expr: Update test accordingly. Suggested by Dan Jacobson.
2010-02-17ls: fix a regression by honoring NORMAL attributes againMoritz Orbach
Output the NORMAL attribute before non file name text. This attribute will continue into file names that would not otherwise be colored unless FILE is also set. The regression was introduced with commit 483297d5, 28-02-2009, "ls --color no longer outputs unnecessary escape sequences". * src/ls.c (set_normal_color): A new function to output the NORMAL attribute sequence if it's enabled. (print_current_files): Output NORMAL before printing long format info. (print_file_name_and_frills): Output NORMAL before printing file name. (print_color_indicator): Reset the attributes before a file name with attributes so that NORMAL attributes will not combine with them. (print_name_with_quoting): Ensure attributes are reset after printing the file name if NORMAL attributes were output. * tests/ls/color-norm: A new test for NORMAL and FILE combinations. * tests/Makefile.am: Reference the new test. * NEWS: Mention the fix. Reported in https://savannah.gnu.org/bugs/?26512
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-07tests: include help-version test settings used by gzip and grepJim Meyering
* tests/misc/help-version: ...the better to keep this file in sync.
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.