summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2012-12-17readlink: support multiple command line argumentsPádraig Brady
This allows efficient processing of multiple files, while also increasing compatibility with BSD's readlink(1). We also add the -z, --zero option to delimit output items with the NUL character which disambiguates output in the presence of '\n' characters. * src/readlink.c (usage): Add the --zero description, and also adjust the description of --no-newline accordingly. (main): Handle the -z option and iterate over multiple arguments. Also as in commit v8.15-24-g9d46b25 we use fputs() and putchar() rather than printf() for performance reasons. * doc/coreutils.texi (readlink invocation): Document the new --zero option, adjust the --no-newline description, and tweak the general info to indicate multiple files are supported. * tests/readlink/multi.sh: A new test for the new functionality. * tests/local.mk: Reference the new test. * man/readlink.x: Adjust the summary and also reference realpath. * NEWS: Mention the improvement. * THANKS.in: Suggested by Aaron Davies.
2012-12-14maint: fix typos found by misspellingsBernhard Voelker
* doc/coreutils.texi (df invocation): s/occurence/occurrence/. * tests/df/skip-rootfs.sh: s/supressed/suppressed/
2012-12-09tests: add test case and note that last week's cut change is a bug fixJim Meyering
* tests/misc/cut-huge-to-eol-range.sh: New test, showing that the change in v8.20-51-g7d03466 is a bug fix after all. * tests/local.mk (all_tests): Add it. * NEWS (Bug fixes): Mention it.
2012-12-08cp: fix --no-preserve=mode to not exit 1Bernhard Voelker
cp --no-preserve=mode exited 1 unconditionally. Furthermore, the tests which would have detected this error - namely link-preserve.sh and reserve-mode.sh - failed to test cp's exit code. * src/copy.c (copy_reg): In the case x->explicit_no_preserve_mode, do only set return_val to false iff the previous set_acl () failed. * tests/cp/link-preserve.sh: Check cp's exit code. * tests/cp/link-symlink.sh: Likewise. * tests/cp/preserve-mode.sh: Likewise. * NEWS: Mention the fix. Bug introduced in commit v8.19-145-g24ebca6. Reported by Florian Pritz in http://bugs.gnu.org/13119.
2012-12-07df: do not print duplicate entries and rootfs by defaultOndrej Oprala
* src/df.c (struct devlist): Add new struct for storing already- examined device numbers. (devlist_head): Add new store of the above type. (show_rootfs): Add new global boolean to not skip rootfs. (dev_examined): Add new function to check if the device has already been traversed. (get_dev): Filter out rootfs unless "-t rootfs" or the -a option is specified. Filter out duplicate entries by calling the above new dev_examined unless the -a option is specified. (main): Set the show_rootfs variable appropriately when the -t option is specified for rootfs. Free device list (guarded by IF_LINT). * tests/df/skip-duplicates.sh: Add test to exercise the skipping of duplicate entries. * tests/df/skip-rootfs.sh: Add test to exercise the skipping of the rootfs pseudo file system. * tests/local.mk: Add the above new tests. * NEWS (Changes in behavior): Mention the changes. * doc/coreutils.texi (df invocation): Document df's behavior about skipping rootfs and duplicate entries. Co-authored-by: Bernhard Voelker.
2012-12-06maint: fix a referenced coreutils version in a test commentPádraig Brady
* tests/misc/cut.pl: This particular bug existed up to v8.10.
2012-12-06tests: fix regex to match "-" in ipcent field in df/total-verify.shBernhard Voelker
The regular expression failed to match for file systems that do not provide inode statistics, e.g. VFAT or CIFS (depending on the underlying peer file system). * tests/df/total-verify.sh: Fix the regular expression to match a dash in the ipcent field again. Reported by Assaf Gordon in http://bugs.gnu.org/13099. Bug introduced in commit v8.20-18-gdae8d22.
2012-12-06tests: cut.pl: adjust for changed diagnosticPádraig Brady
* tests/misc/cut.pl: Since we now output the more complete error message irrespective of running in a multi-byte locale or not, adjust the test accordingly.
2012-12-06cut: improve error reportingCojocaru Alexandru
* src/cut.c (main): Treat a NUL delimiter (-d '') consistently with non NUL delimiters, and disallow such a delimiter option, unless a field is also specified. (set_fields): Provide a more accurate error message when a given list is invalid. * tests/misc/cut.pl: Add a test case.
2012-11-24cut: do not print extraneous delimiters in some unusual casesJim Meyering
When printing output delimiters, and when a to-EOL range subsumes at least one other range, cut would mistakenly print delimiters for the subsumed range. This bug was probably introduced via commit v5.2.1-639-g847e066. * src/cut.c (set_fields): Ignore any range that is subsumed by a to-EOL range. Also, move two declarations down. * tests/misc/cut.pl: Add tests to exercise this. * NEWS (Bug fixes): Mention it. Reported by Marcel Böhme in http://bugs.gnu.org/12966
2012-11-24cut: treat -b2-,3- like -b2-, not like -b3-Jim Meyering
* src/cut.c (set_fields): When two right-open-ended ranges are specified, don't blindly let the latter one take precedence over the former. Instead, use the union of the ranges. * tests/misc/cut.pl: Add tests to exercise this. * NEWS (Bug fixes): Mention it. Reported by Marcel Böhme in http://bugs.gnu.org/12966 Thanks to Berhard Voelker for catching log and NEWS typos.
2012-11-24tests: use sub-second timeouts to speed up a timeout testPádraig Brady
* tests/misc/timeout.sh: Take advantage of recent support for sub-second timeouts to decrease runtime from about 6s to 2s.
2012-11-24tests: accept EEXIST from rm -dPádraig Brady
* tests/rm/d-2.sh: EEXIST is a valid error on some systems. Reported by Michael Felt on AIX 6.1
2012-11-24tests: don't rely on sed -i being availablePádraig Brady
* tests/df/df-output.sh: sed --in-place is not generally available. Also add a couple of simplifications from Bernhard Voelker. Removing all spaces, rather than just leading spaces, suffices. Searching for ' --output' in unadjusted df --help, suffices.
2012-11-24seq: ensure correct output width for scientific notation inputPádraig Brady
* src/seq.c (scan_arg): Calculate the width more accurately for numbers specified using scientific notation. * tests/misc/seq.pl: Add tests for cases that were mishandled. * NEWS: Mention the fix. * THANKS.in: Reported by Marcel Böhme. Fixes http://bugs.gnu.org/12959
2012-11-22df: reorder default field list of --output optionBernhard Voelker
As the inodes information is usually not so much of interest, and some file systems including btrfs do not even provide it, reading of the full df --output is easier when the block statistic fields come just left of the last field, the mount point. * src/df.c (all_args_string): Move the inodes fields before the block fields. (usage): Likewise. * tests/df/df-output.sh: Likewise. * doc/coreutils.texi (df invocation): Likewise. Additionally, explicitly mention the default order of the --output option.
2012-11-19cut: do not accept the invalid range 0-Bernhard Voelker
The command "echo 12345 | cut -b 0-" prints an empty line while it should fail with "fields and positions are numbered from 1". * src/cut.c (set_fields): Add a diagnostic for the invalid open range which starts with Zero, i.e., the range 0-. * tests/misc/cut.pl: Add tests to ensure the range 0- fails for fields (-f) and for positions (-b, -c). * NEWS: Mention the fix. Reported by Marcel Böhme in <http://bugs.gnu.org/12903>.
2012-11-09tests: fix factor's tests to use coreutil's own sha1sumBernhard Voelker
The test used the shasum utility which seems to belong to the perl package. On SLES-10.4, perl doesn't include this yet: + seq 0 10000000 + factor + shasum -c --status exp ./tests/factor/t00.sh: line 30: shasum: command not found + Exit 1 It is better to use our own stuff anyway. * tests/factor/run.sh: s/shasum/sha1sum/. Additionally, add sha1sum to the print_ver_ call.
2012-11-09df: port the new df test to POSIX sed, larger file systemsPaul Eggert
* tests/df/df-output.sh: For the test "df -B1K --output=size", do not assume that the file system size fits in 9 bytes; it might be larger than that, so omit leading space. Also, use portable 'sed' commands: POSIX says sed commands inside { } should all end in newline.
2012-11-08df: add a test for the --output optionBernhard Voelker
* tests/df/df-output.sh: Add a test case. * tests/local.mk (all_tests): Mention the test. * cfg.mk (sc_file_system): Exempt the test from this syntax-check.
2012-11-08df: add --output to select which fields to displayBernhard Voelker
This supports changing the order of the fields displayed, and also allows the simultaneous display of inode and block fields. src/df.c (get_dev): Factor out calling get_header to ... (main): ... here. Call print_table only if file_systems_processed. src/df.c (Displayable fields): Rename DEV_FIELD to SOURCE_FIELD. Rename TYPE_FIELD to FSTYPE_FIELD. Rename FREE_FIELD to AVAIL_FIELD. Rename MNT_FIELD to TARGET_FIELD. * src/df.c (display_field_t): Turn loose enum definition of the displayable fields into a typedef. Add the inode fields ITOTAL_FIELD, IUSED_FIELD, IAVAIL_FIELD, IPCENT_FIELD. (field_data_t): Define structure to hold the display field, the caption, the width and the alignment for each field of the above type. (field_data): Add array the values of field data for each display field. (headers, alignments, widths): Remove arrays. (columns): Add a pointer to the storage for the array of the actual output columns, i.e., fields. (ncolumns): Add counter for the current output columns. (alloc_table_row): Allocate the dynamic ncolumns value of strings. (print_table): Loop over ncolumns instead of constant NFIELDS. Rename loop variable 'field' to 'col' to avoid ambiguity with the 'field' element in the columns structure. Adjust the condition for printing the last column by comparing with the column number instead of the field name (TARGET_FIELD). Use the width and the alignment stored in the columns data. (alloc_field): Add new function to allocate a field in the columns array. (get_field_list): Add new function to fill the array of output columns for each mode. (get_header): Loop over ncolumns instead of constant NFIELDS. Rename the loop variable 'field' to 'col' to avoid ambiguity with the 'field' element in the columns structure. Remove the code for continuing the loop if the current column is the file system type and print_type is not active (which is now impossible). Store the cell in the columns store along with the new width. (get_dev): Loop over ncolumns instead of the constant NFIELDS. Rename the loop variable 'field' to 'col' to avoid ambiguity with the 'field' element in the columns structure; move the definition down to where it is used first. Add cases for the inode fields ITOTAL_FIELD, IUSED_FIELD, IAVAIL_FIELD and IPCENT_FIELD. Store the cell in the columns store along with the new width. (main): Use new get_field_list function to fill the list of output columns. * src/df.c (print_table): Instead of fputs()ing directly, apply ambsalign on the last field, too. Use the new MBA_NO_RIGHT_PAD flag for this. * src/df.c (TOTAL_OPTION): Add new enum value. (long_options): Use it for the "total" option instead of 'c'. (main): Likewise. * src/df.c (get_dev): Remove condition to copy the fstype into the FSTYPE_FIELD - based on whether print_type is non-Null. Since the introduction of get_field_list(), there are only fields added to the columns array which have to be added. * src/df.c (get_dev): Guard the summing up of the values for the grand total: only do it if we have to print the total and if the current invocation is not for processing it. * src/df.c (main): Pass a hyphen "-" for the mount point name to get_dev. (get_dev): As the mount_point is now always there, remove the condition and the else case for the TARGET_FIELD. Instead, simply copy the mount_point. All cells are now always present. Therefore, add an assertion statement if one was not. Furthermore, hide the problematic characters unconditionally. (print_table): Remove the skipping of empty cells. * tests/df/total-verify.sh: Accommodate to the new "-" in the target field of the summary line. * NEWS: Mention the change in behavior. * src/df.c (field_type_t): Add new typedef of 3 enums to distinguish between block, inode and other fields. (field_data_t): Add field_type member of the above new type. (field_data): Add default values for the above field_type, indicating whether a field contains block values, inode values or other, generic values. (field_values_t): Add this struct to store the field values, used by and factored out from get_dev to be able to define such a struct for both the inode and the block values. (get_field_values): Add this function to obtain the block values and the inode values from the file system usage, used by and factored out from get_dev. (add_to_grand_total): Add this function to sum the values of the current mount point up for the grand total, used by and factored out from get_dev. (get_dev): Move the definition of the variables fsu, buf, pct and cell down to where they are used first to give them a better scope. Factor out input_units, output_units, total, available, negate_available, available_to_root, used and negate_used into the above struct field_values_t. Factor out the mapping of the fsu values to the above variables into above function get_field_values. Factor out the summing up of the grand total values into the above function add_to_grand_total. Define block_values and inode_values of the new type and call the new get_field_values to fill them from the fsu values. Call the above function add_to_grand_total for summing up the values for the grand total. Inside the loop over all fields, define a variable 'v' to point to either the block_values or the inode_values, depending on the current field's field_type. Change the code in the cases TOTAL_FIELD/ITOTAL_FIELD, USED_FIELD/IUSED_FIELD, AVAIL_FIELD/ IAVAIL_FIELD and PCENT_FIELD/IPCENT_FIELD to use the field values where 'v' is pointing to, i.e., either the block_values or the inode_values. * src/df.c (main): Remove setting of grand_fsu.fsu_blocks in the inode_format case as this is no longer needed and would lead to wrong results once when mixed block/inode fields will be used. * src/df.c (main): Cleanup the code at the end regarding file_systems_processed to make the code clearer. * src/df.c (inode_format): Remove variable. (main): Remove initialization of the above variable. In getopts loop, directly set the header_mode to INODES_MODE instead of using the above variable. Afterwards, remove the mapping to INODES_MODE as it is already set. * src/df.c (posix_format): Move variable ... (main): ... to here. * src/df.c (print_table): Enhance the comment about 2-line format in cases where the SOURCE_FIELD exceeds 20 chars, as such behavior has been removed long ago by commit v8.10-40-g99679ff. * src/df.c (Display modes): Add OUTPUT_MODE, remove unused NMODES. (display_field_t): Remove unnecessary NFIELDS. (field_data_t): Add member 'arg' for the field name in the --output argument. Add member 'used' to remember if a field is already used in the columns array. (field_data): Add values for the above new members arg and used. (all_args_string): Add variable which represents the argument for the --output option which includes all fields. (OUTPUT_OPTION): Add enum to identify the long --output option. (long_options): Add optional-argument --output option. (alloc_field): Assert that the field is not already used. Mark the field as used. (decode_output_arg): Add function to parse the comma-separated field list passed to the --output option in order to add the appropriate fields to the columns array. (get_field_list): Add case for the new OUTPUT_MODE to add all available fields to columns in the case the --output option has been passed without any values. Use the comma-separated field list form to pass to decode_output_arg to keep the field header mapping for the OUTPUT_MODE only on one place. (main): Define format string msg_mut_excl to be used in the following checks whether the use of --output and the other option is mutually exclusive. In the getopt_long loop, add a check to the case for the -i option to issue an error message when it is used together with --output; Likewise for -T and -P. Add a new case for OUTPUT_OPTION, together with similar checks as above and eventually passing the optarg to decode_output_arg. After the getopt_long loop, consider the OUTPUT_MODE case in order not to run into -h or -P mode. * src/df.c (get_dev): Also xstrdup the dev_name, and free it afterwards to silence a valgrind warning about definitely lost memory. (main): Free the columns store to silence valgrind, guarded by the IF_LINT macro. * src/df.c (main): Pass "total" as the mount point to get_dev if the SOURCE_FIELD is not among the columns to output. * tests/df/df-output.sh: Change the test to ensure the content of the target field of the grand total line: if the source field is present, then the target should be "-", else the target field should be "target". * NEWS (Changes in behavior): Enhance the exiting NEWS entry. * doc/coreutils.texi (df invocation): Document the content of the source and target field in the grand total line. * src/df.c (main): Add another condition to the need_fs_type parameter of read_file_system_list whether the FSTYPE_FIELD is used or not. * src/df.c (get_header): Indicate the block size used, in the "size" header, when using --output without -h. * tests/df/df-output.sh: Adjust for, and add an extra test for, the new behavior.
2012-11-04timeout: add --preserve-status to always propagate the exit statusÁngel González
It's useful for commands that support running for an indeterminite amount of time, to not return a specific timeout exit status (124), and instead let the command handle the timeout signal and return a status for the work done so far. * doc/coreutils.texi (timeout invocation): Describe the new option. * src/timeout.c (preserve_status): A new global boolean to enable the --preserve-status behavior. (usage): Describe the new option. (main): Don't return EXIT_TIMEOUT of preserve_status is set. * tests/misc/timeout.sh: Add a test for the new option.
2012-10-27tests: shorten factor's inordinately-long test file namesBernhard Voelker
Besides what the subject says, this commit moves the test data for the factor tests from tests/local.mk into the directory tests/factor/ where it belongs. * tests/local.mk (EXTRA_DIST): Add new tests/factor/create-test.sh. (p,q,t1,t2) Factor out the factor-related magic numbers. (factor_tests): Rename the test names to t{00..36}.sh. Factor out the triples of test data. ($(factor_tests)): Add dependency to new tests/factor/create-factor.sh. Call that script to generate the test scripts. * tests/factor/run.sh: Turn this script into a template, and therefore remove it's executable permission bit. Add template variables START, END and CKSUM, replacing the code to split the test data from the test script's file name. Use the new template variables in the call to seq and for creating the exp file. * tests/factor/create-test.sh: Add new script to create the test scripts from the template tests/factor/run.sh. Use test data and magic numbers factored out from the above files. Let the script also change the __TEMPLATE__ line in run.sh to make clear that the test scripts are generated. * cfg.mk (sc_tests_list_consistency): Exempt the new test. (exclude_file_name_regexp--sc_prohibit_test_backticks): Likewise. Improved-by: Stefano Lattarini Improved by: Jim Meyering
2012-10-25maint: remove an obsolete test commentJim Meyering
* tests/du/bind-mount-dir-cycle.sh: Remove obsolete comment spotted by Gilles Espinasse.
2012-10-25pr: fix -n to pad consistently and not crashPádraig Brady
* src/pr.c: Replace the code to truncate the most significant digits of line numbers, with much simpler string manipulation that supports arbitrary widths. Before this, specifying a width >= 32 to -n would result in a divide by zero error. Also remove the inconsistent padding with zeros and spaces, which would result in zero padding for widths 12 and 15. * tests/pr/pr-tests.pl: Added a test to ensure no zero padding, and also a test for the divide by zero case. * NEWS: Mentioned the fix Reported by Ondrej Oprala
2012-10-25maint: refactor tests/misc/pr.pl into tests/pr/pr-tests.plPádraig Brady
* tests/misc/pr.pl: Refactor this test into ... * tests/pr/pr-tests.pl: ... here. * tests/local.mk: Remove the reference to the removed test Improved by Jim Meyering
2012-10-23tests: correctly restrict factor test without GMPPádraig Brady
* tests/misc/factor.pl: Correct the precedence and regular expression in the command to check for GMP.
2012-10-17cp: avoid data-corrupting free-memory-readJim Meyering
* src/extent-scan.c (extent_scan_read): Reset our last_ei pointer whenever the parent buffer might have just been freed. * tests/cp/fiemap-extent-FMR.sh: New test. * tests/local.mk (all_tests): Add it. * NEWS (Bug fixes): Mention it. Reported by Mike Gerth in http://bugs.gnu.org/12656, and with help from Alan Curry. Bug introduced in commit v8.10-60-g18f5a85.
2012-10-09factor: fix integer validation and GMP fallbackPádraig Brady
In the recent factor rewrite, the GMP code wasn't actually used; just an error was printed on integer overflow. While fixing that it was noticed that correct input validation wasn't done in all cases when falling back to the GMP code. * src/factor.c (print_factors) Fallback to GMP on overflow. (strto2uintmax): Scan the string for invalid characters, so that case can be detected independently of overflow. Return an error when an empty string is passed. Also allow leading spaces and '+' in input numbers. * tests/misc/factor.pl: Ensure the GMP code is exercised when compiled in. Also add a test to verify leading spaces and '+' are allowed.
2012-10-04factor: merge with preexisting factor; integrate tests; avoid warningsJim Meyering
* src/factor.c: Renamed from factor-ng.c, with the following changes: Adjust copyright header to be consistent with others. Use xmalloc and xrealloc, to avoid segv upon OOM. Switch back to using readtokens to handle input. Diagnose invalid inputs. s/fprintf+exit/error/ (print_factors): Add comments. (strto2uintmax): Return strtol_error, not int. (read_item): Remove, no longer used. (main): Use atexit(close_stdout) so that we don't ignore failed write. * cfg.mk: Exempt src/longlong.h from several tests. Exempt run.sh from the test-list-consistency test. Exempt make-prime-list.c from numerous tests, since we won't be making it conform: it must not link with libcoreutils.a. Exempt factor-ng.c from the no-upper-case error message test. * AUTHORS (factor): Add Torbjörn and Niels. * tests/local.mk (factor_tests): Encode the 37 tests. ($(factor_tests)): Rule to generate a test script for each test. * tests/factor/run.sh: New script, marked as very expensive. * .gitignore: Ignore new generated files. * src/local.mk (src/primes.h): New rule. (noinst_PROGRAMS): Add make-prime-list. (noinst_HEADERS): Add longlong.h. Remove all wheel-related rules and files. * src/wheel-gen.pl: Remove file. maint: mark set-but-not-used variables with ATTRIBUTE_UNUSED * src/factor-ng.c (redcify, prime_p, isqrt2): Mark them, so we don't have to disable -Wunused-but-set-variable. maint: use __builtin_expect only if __GNUC__ * src/factor-ng.c (LIKELY, UNLIKELY) [__GNUC__]: Add #ifdef guard. build: avoid warning about unused macro * src/factor-ng.c (__GMP_DECLSPEC): Don't define here * src/longlong.h (__GMP_DECLSPEC): Define if not already defined.
2012-09-28cp: fix the --no-preserve=mode optionOndrej Oprala
The --no-preserve=mode option did not do what its name implies: it would mistakenly preserve permission mode bits. * NEWS: Mention the fix. * TODO: Remove an entry. * src/copy.c (copy_reg): Add a condition to properly handle the --no-preserve=mode option for files (copy_internal): Add a condition to properly handle the --no-preserve=mode option for directories. * src/copy.h (struct cp_options): Add a new boolean. * src/cp.c (cp_option_init,decode_preserve_arg): Set the new boolean value according to specified options. * src/install.c (struct cp_options): Initialize the new boolean. * src/mv.c (struct cp_options): Initialize the new boolean. * tests/cp/preserve-mode.sh: Add a new test. * tests/cp/link-preserve.sh (-a --no-preserve=mode): Adjust the expected perms: now, --no-preserve=mode overrides the --preserve=mode that is inherent in -a, as it should. * tests/local.mk: Add the new test to the list.
2012-09-24dd: new option, status=none to suppress output statisticsPozsár Balázs
* src/dd.c (STATUS_NONE): A new bitmask combining all STATUS_ options, thus used to suppress all informational output. (struct symbol_value statuses): Expose the "none" option, corresponding to the STATUS_NONE bitmask above. (print_stats): Return early if STATUS_NONE is specified. Also move the call to gethrxtime() down so that it's only called when needed. (usage): Describe the new options. * doc/coreutils.texi (dd invocation): Likewise. * NEWS: Mention the new feature. * tests/dd/misc.sh: Ensure the new option works.
2012-09-18tests: cp/link-heap: avoid new failure on rawhideJim Meyering
* tests/cp/link-heap.sh: Increase virtual memory limit by 2000KiB -- from 20,000 to 22,000 KiB -- to avoid a new failure on rawhide.
2012-09-16ls: fix coloring of dangling symlinks in default listing modePádraig Brady
When listing a directory containing dangling symlinks, and not outputting a long format listing, and orphaned links are set to no coloring in LS_COLORS, then the symlinks would get no color rather than reverting to the standard symlink color. The issue was introduced in v8.13-19-g84457c4 * src/ls.c (print_color_indicator): Use the standard method to check if coloring is specified for orphaned symlinks. The existing method would consider 'or=00' or 'or=0' as significant in LS_COLORS. Even 'or=' was significant as in that case the string='or=' and the length=0. Also apply the same change for missing symlinks for consistency. (gobble_file): Remove the simulation of linkok, which is only tested in print_color_indicator() which now handles this directly by keying on the LS_COLORS values correctly. * tests/misc/ls-misc.pl: Add a test case. * THANKS: Add the reporter. * NEWS: Mention the fix. Reported-by: David Matei
2012-09-14build: do not rely on automake's AM_TESTS_ENVIRONMENTJim Meyering
* tests/local.mk (TESTS_ENVIRONMENT): Rename from AM_TESTS_ENVIRONMENT, since it is not honored in automake-1.11.3 after all. This reverts commit v8.19-38-g34c9c8f. For now, I'll leave the following commit that made bootstrap.conf require 1.11.2. Prompted by a report of test failure from Pádraig Brady.
2012-09-14seq: 70x faster for non-negative whole numbers and incr==1Jim Meyering
Handle non-negative whole numbers robustly and efficiently when the increment is 1 and when no format-changing option is specified. On the correctness front, for very large numbers, seq now works fine: $ b=1000000000000000000000000000 $ src/seq ${b}09 ${b}11 100000000000000000000000000009 100000000000000000000000000010 100000000000000000000000000011 while the old one would infloop, printing garbage: $ seq ${b}09 ${b}11 | head -2 99999999999999999997315645440 99999999999999999997315645440 The new code is much more efficient, too: Old vs new: 55.81s vs 0.82s $ env time --f=%e seq $((10**8)) > /dev/null 55.81 $ env time --f=%e src/seq $((10**8)) > /dev/null 0.82 * seq.c (incr): New function, inspired by the one in cat.c. (cmp, seq_fast): New functions, inspired by code in nt-factor by Torbjörn Granlund and Niels Möller. (trim_leading_zeros): New function, without which cmp would malfunction. (all_digits_p): New function. (main): Hoist the format_str-vs-equal_width check to precede first treatment of operands, and insert code to call seq_fast when possible. * NEWS (Bug fixes): Mention the correctness fix. (Improvements): Mention the speed-up. * tests/misc/seq.pl: Exercise the new code. Improved by: Bernhard Voelker. http://thread.gmane.org/gmane.comp.gnu.coreutils.general/3340
2012-09-14tests: reenable "make -C tests ..." commandsJim Meyering
The README-documented way to run individual tests was invalidated by the conversion of tests/ to non-recursive make. Add a GNUmakefile shim to reenable that usage. * tests/GNUmakefile: New file, so that "make -C tests ..." works like it did before the conversion of tests/ to non-recursive build. Reported by Bernhard Voelker. * Makefile.am (EXTRA_DIST): Add it. * cfg.mk (sc_prohibit_tab_based_indentation): Also exempt any GNUmakefile from this syntax-check.
2012-09-07factor: NEWS and testsJim Meyering
* NEWS (Bug fixes): Mention it. * tests/misc/factor.pl: Add five of Torbjörn's tests.
2012-09-05rm: avoid bogus diagnostic for a slash-decorated symlink-to-dirJim Meyering
These commands would evoke an invalid diagnostic: $ mkdir d && ln -s d s && env rm -r s/ rm: cannot remove 's': Too many levels of symbolic links remove.c was stripping trailing slashes from "s/" before passing the name to "rm". But a trailing slash may change the semantics, and thus should not be stripped. * src/remove.c (rm_fts): Do not strip trailing slashes. * tests/rm/v-slash.sh: Adapt to new expected output. * gnulib: Update to latest, for an improved fts.c that merely normalizes trailing slashes. Reported by Paul Eggert in discussion of http://bugs.gnu.org/12339
2012-09-05tests: depend on the programs we're testingJim Meyering
* tests/local.mk ($(TEST_LOGS)): Depend on $(PROGRAMS), so that tests are rerun when any program is rebuilt. Technically, we could specify precisely which few programs are dependents of each test, but that can come later, if deemed worth the trouble and maintenance burden. Also, there is the issue of the primary program(s) being tested (i.e., those itemized via print_ver_) versus those that are tested incidentally: for example, nearly every test exercises "rm" when its clean-up code removes files.
2012-09-05maint: vc_exe_in_TESTS should actually be a syntax checkStefano Lattarini
Because it requires the presence of the '.git' directory, that is, can be run only for maintainers working from checked-out sources. * tests/local.mk (vc_exe_in_TESTS): Rename and move ... * cfg.mk (sc_tests_list_consistency): ... here, with minor adjustments.
2012-09-05tests: put test-suite.log back in 'tests/'Stefano Lattarini
* tests/local.mk (TEST_SUITE_LOGS): Define to 'tests/test-suite.log'.
2012-09-05build: don't use recursive make for tests/ subdirectoryStefano Lattarini
* Makefile.am (SUBDIRS): Remove 'tests'. (include): The '$(top_srcdir)/tests/local.mk' file. (check-root): Remove this convenience target, it's no longer needed now that the "real" check-root target once in 'tests/Makefile' will land in the top-level makefile. * configure.ac (AC_CONFIG_FILES): Remove 'tests/Makefile'. * tests/Makefile.am: Rename ... * tests/local.mk: ... like this, with a lot of adjustments. * tests/init.cfg: Move ... * init.cfg: ... here. This is necessary, for a limitation of the gnulib-provided 'tests/init.sh', which unconditionally look for 'init.cfg' in the $(srcdir) directory. * tests/*/*.sh: Adjust: expect init.sh to be in '$srcdir/tests', not in '$srcdir', and extend $PATH with './src', not with '../src'. * tests/Coreutils.pm: Adjust similarly. * tests/pr/pr-tests.pl ($pfx): Likewise.
2012-09-05maint: list of names of built programs available in the MakefilesStefano Lattarini
This is just a preparatory refactoring in view of future changes. * configure.ac (AC_SUBST): New 'built_programs'. * tests/Makefile.am (AM_TESTS_ENVIRONMENT): Simply define the exported variable 'built_programs' to the expansion of the '$(built_programs)' AC_SUBST'd make variable. (.built-programs): Remove this now-unneeded convenience target. (CLEANFILES, check_DATA): Delete, no longer needed.
2012-09-05tests: remove the unused 'root-hint' targetStefano Lattarini
* tests/Makefile.am (root-hint): Here. The interested user can see the reasons why some tests are skipped by looking at the messages they display on the console; here's an excerpt: ... PASS: misc/id-groups.sh id-setgid.sh: skipped test: must be run as root SKIP: misc/id-setgid.sh PASS: misc/md5sum.pl ... PASS: df/total-verify.sh 2g.sh: skipped test: very expensive: disabled by default SKIP: du/2g.sh ... Clear enough, and more specific and precise that a generic "some tests might need to be run as root" message. And if that user is interested in making those tests run anyway, he'll just take a look to the README files to look for info. So there's no reason to pollute the stdout with another "hint" that is subsumed by those messages, and that might go unnoticed anyway. Moreover, and possibly more importantly, that hint wasn't being displayed anyway, even before this change! That's because the 'root-hint' target was listed as prerequisite for the 'check-recursive' target, which however was not a dependency of the 'check' target in 'tests/Makefile.am', because that file contains no $(SUBDIRS) definition.
2012-09-05tests: use suffix, not exec-bit, to tell which files are testsStefano Lattarini
* tests/Makefile.am (vc_exe_in_TESTS): Adjust to look, in the 'tests/' subdirectory, for files that have one of the extensions listed in $(TEST_EXTENSIONS), rather than for executable files.
2012-09-05maint: make vc_exe_in_TESTS also work in VPATH buildsStefano Lattarini
* tests/Makefile.am (vc_exe_in_TESTS): It is easy to adjust this recipe to also work in VPATH setups, also thanks to modifications done by previous changes.
2012-09-05maint: remove useless dependency for vc_exe_in_TESTSStefano Lattarini
* tests/Makefile.am (vc_exe_in_TESTS): No need to depend on Makefile: this target is .PHONY, so it is always run anyway.
2012-09-05maint: avoid parsing of Makefile.am from vc_exe_in_TESTSStefano Lattarini
* tests/Makefile.am (TESTS): Rename ... (all_tests): ... like this, so that we'll still be able to know the complete list of our tests even if the user overrides TESTS from the command line (which he's allowed to do by the test harness API). (root_tests): Rename ... (all_root_tests): ... like this, for similar reasons. (TESTS, root_tests): Redefine their defaults to to $(all_tests) and $(all_root_tests) respectively. (vc_exe_in_TESTS): It can now safely use $(all_tests) to get the complete list of test cases according to the Makefile, instead of having to resort to "parsing" of Makefile.am. (EXTRA_DIST): Use $(all_tests), not $(TESTS). (v_, w_): Delete, no longer needed.
2012-09-05build: use 'check-local' to extend the 'check' targetStefano Lattarini
* tests/Makefile.am (check-local): Here, by making this depend on 'vc_exe_in_TESTS' ... (check): ... rather than making this depend on them. While the old usage worked, it relied on an implementation detail rather than on documented behavior. * src/local.mk (check-local): Similarly, make this depend on 'check-README' and 'check-duplicate-no-install' ... (check): ... rather than on this.