summaryrefslogtreecommitdiff
path: root/tests/local.mk
AgeCommit message (Collapse)Author
2013-09-21id: add -z, --zero optionBernhard Voelker
* src/group-list.h (print_group_list): Add a parameter for the delimiter of type char. * src/group-list.c (print_group_list): Likewise, and use it instead of a white space character to delimit the group entries. * src/groups.c (main): Pass white space character to print_group_list(). * src/id.c (longopts): Add array element for the new long option. (usage): Document the new option. While at it, fix the alignment of the descriptions to match that of HELP_OPTION_DESCRIPTION. (main): Define the bool flag opt_zero indicating the use of the new option. In the getopt_long loop, handle it. Output an error diagnostic in the case the --zero option has been specified together with the default format. In the case of -gG, pass either a NUL or a white space character to print_group_list() - depending on the above new flag. Likewise change the printing of the final newline character: output a NUL instead if the --zero option has been specified. * doc/coreutils.texi (id invocation): Document the new option. While at it, move the @exitstatus macro down after the macro @primaryAndSupplementaryGroups in order to be consistent with other texinfo documents. (groups invocation): Move @exitstatus down after the macro @primaryAndSupplementaryGroups here, too. * tests/misc/id-zero.sh: Add new test exercising the new option. * tests/local.mk (all_tests): Reference it. * NEWS (New features): Mention the new option. Fixes http://bugs.gnu.org/9987
2013-07-27du: add --inodes optionBernhard Voelker
This new option can be used to find directories with a huge amount of files. The GNU find utility has the printf format "%h" which prints the number of entries in a directory, but this is non-cumulative and doesn't handle hard links. * src/du.c (struct duinfo): Add new member for counting inodes. (duinfo_init): Initialize inodes member with Zero. (duinfo_set): Set inodes counter to 1. (duinfo_add): Sum up the 2 given inodes counters. (opt_inodes): Add new boolean flag to remember if the --inodes option has been specified. (INODES_OPTION): Add new enum value to be used ... (long_options): ... here. (usage): Add description of the new option. (print_size): Pass inodes counter or size to print_only_size, depending on the inodes mode. (process_file): Adapt threshold handling: with --inodes, print or elide the entries according to the struct member inodes. (main): Add a case for accepting the new INODES_OPTION. Print a warning diagnostic when --inodes is used together with the option --apparent-size or -b. Reset the output_block_size to 1 ... and thus ignoring the options -m and -k. * tests/du/inodes.sh: Add a new test. * tests/local.mk (all_tests): Mention it. * doc/coreutils.texi (du invocation): Document the new option. * NEWS: Mention the new option.
2013-05-23split: with --line-bytes only allocate memory as neededPádraig Brady
* src/split.c (line_bytes_split): Rewrite to only buffer when necessary. I.E. only increase the buffer when we've already lines output in a split and we encounter a line larger than the input buffer size, in which case a hold buffer will be increased in increments of the input buffer size. (lines_rr): Use the more abstract xalloc_die() just like we did in line_bytes_split(), rather than explicitly printing the "memory exhausted" message and exiting. * tests/split/line-bytes.sh: Add a new test for this function which previously had no test coverage. * tests/local.mk: Reference the new test. * NEWS: Mention the improvement. Fixes http://bugs.gnu.org/13537
2013-05-11mkdir: don't assume umask equals POSIX default ACL maskPaul Eggert
This fixes Bug#14371, reported by Killer Bassist. * NEWS: Document this. * src/mkdir.c (struct mkdir_options): Remove member ancestor_mode. New member umask_value. All uses changed. * src/mkdir.c (make_ancestor): Fix umask assumption. * src/mkdir.c, src/mkfifo.c, src/mknod.c (main): Leave umask alone. This requires invoking lchmod after creating the file, which introduces a race condition, but this can't be avoided on hosts with "POSIX" default ACLs, and there's no easy way with network file systems to tell what kind of host the directory is on. * tests/local.mk (all_tests): Add tests/mkdir/p-acl.sh. * tests/mkdir/p-acl.sh: New file.
2013-04-29cut: make memory allocation independent of range widthCojocaru Alexandru
The current implementation of cut, uses a bit array, an array of `struct range_pair's, and (when --output-delimiter is specified) a hash_table. The new implementation will use only an array of `struct range_pair's. The old implementation is memory inefficient because: 1. When -b with a big num is specified, it allocates a lot of memory for `printable_field'. 2. When --output-delimiter is specified, it will allocate 31 buckets. Even if only a few ranges are specified. Note CPU overhead is increased to determine if an item is to be printed, as shown by: $ yes abcdfeg | head -n1MB > big-file $ for c in with-bitarray without-bitarray; do src/cut-$c 2>/dev/null echo -ne "\n== $c ==" time src/cut-$c -b1,3 big-file > /dev/null done == with-bitarray == real 0m0.084s user 0m0.078s sys 0m0.006s == without-bitarray == real 0m0.111s user 0m0.108s sys 0m0.002s Subsequent patches will reduce this overhead. * src/cut.c (set_fields): Set and initialize RP instead of printable_field. * src/cut.c (is_range_start_index): Use CURRENT_RP rather than a hash. * tests/misc/cut.pl: Check if `eol_range_start' is set correctly. * tests/misc/cut-huge-range.sh: Rename from cut-huge-to-eol-range.sh, and add a test to verify large amounts of mem aren't allocated. Fixes http://bugs.gnu.org/13127
2013-04-20tail: let -f --retry wait for inaccessible filesBernhard Voelker
The --retry option is indeed useful for both following modes by name and by file descriptor. The difference is that in the latter case, it is effective only during the initial open. As a regression of the implementation of the inotify support, tail -f --retry would immediately exit if the given file is inaccessible. * src/tail.c (usage): Change the description of the --retry option: remove the note that this option would mainly be useful when following by name. (main): Change diagnosing dubios uses of --retry option: when the --retry option is used without following, then issue a warning that this option is ignored; when it is used together with --follow=descriptor, then issue a warning that it is only effective for the initial open. Disable inotify also in the case when the initial open in tail_file() failed (which is the actual bug fix). * init.cfg (retry_delay_): Pass excess arguments to the test function. * tests/tail-2/retry.sh: Add new tests. * tests/local.mk (all_tests): Mention it. * doc/coreutils.texi (tail invocation): Enhance the documentation of the --retry option. Clarify the difference in tail's behavior regarding the --retry option when combined with the following modes name versus descriptor. * NEWS (Bug fixes): Mention the fix. Reported by Noel Morrison in: http://lists.gnu.org/archive/html/coreutils/2013-04/msg00003.html
2013-04-14dd: avoid buffer allocations unless neededOndrej Oprala
* src/dd.c: Add new static global variable ibuf. (alloc_ibuf, alloc_obuf): New functions factored from dd_copy(). (dd_copy): Call the new functions to allocate memory for ibuf and obuf when necessary. (skip): Likewise. * tests/dd/no-allocate.sh: New test. * tests/local.mk: Reference the test.
2013-04-10csplit: add the --suppress-matched optionAssaf Gordon
With --suppress-matched, the lines that match the pattern will not be printed in the output files. I.E. the first line from the second and subsequent splits will be suppressed. * src/csplit.c: process_regexp(),process_line_count(): Don't output the matched lines. Since csplit includes "up to but not including" matched lines in each split, the first line (in the next group) is the matched line - so just skip it. main(): Handle new option. usage(): Mention new option. * doc/coreutils.texi (csplit invocation): Mention new option, examples. * tests/misc/csplit-suppress-matched.pl: New test script. * tests/local.mk: Reference the new test. * NEWS: Mention new feature.
2013-03-25shuf: use reservoir-sampling for large or unknown sized inputsAssaf Gordon
Reservoir sampling optimizes selecting K random lines from large or unknown-sized input: http://en.wikipedia.org/wiki/Reservoir_sampling Note this also avoids reading any input when -n0 is specified. * src/shuf.c (main): Use reservoir-sampling when the number of output lines is known, and the input size is large or unknown. (input_size): A new function to get the input size for regular files. (read_input_reservoir_sampling): New function to read lines from input, keeping only K lines in memory, replacing lines with decreasing prob. (write_permuted_output_reservoir): New function to output reservoir. * tests/misc/shuf-reservoir.sh: An expensive_ test using valgrind to exercise the reservoir-sampling code. * tests/local.mk: Reference new test. * NEWS: Mention the improvement.
2013-02-28doc: move some info from all --help messages, onlinePádraig Brady
* src/system.h (emit_ancillary_info): Link to the bug report email addresses and general help URLs online rather than specifying directly. This give us greater scope to present better info like describing the difference between bug-coreutils@gnu.org and coreutils@gnu.org etc. * tests/misc/help-version.sh: Remove the check for bug-coreutils@gnu.org * tests/local.mk: Remove the no longer needed PACKAGE_BUGREPORT.
2013-02-11maint: avoid running check-root tests in gnulibBernhard Voelker
* tests/local.mk (check-root): Restrict to SUBDIRS=. as traversing into gnulib-tests induces a false failure.
2013-02-04numfmt: a new command to format numbersAssaf Gordon
* AUTHORS: Add my name. * NEWS: Mention the new program. * README: Reference the new program. * src/numfmt.c: New file. * src/.gitignore: Ignore the new binary. * build-aux/gen-lists-of-programs.sh: Update. * scripts/git-hooks/commit-msg: Allow numfmt: commit prefix. * po/POTFILES.in: Add new c file. * tests/misc/numfmt.pl: A new test file giving >93% coverage. * tests/local.mk: Reference the new test. * man/.gitignore: Ignore the new man page. * man/local.mk: Reference the new man page. * man/numfmt.x: A new template. * doc/coreutils.texi: Document the new command.
2013-01-26timeout: ensure a blocked SIGALRM from the parent is unblockedStephan Krempel
* src/timeout.c (unblock_signal): A new function to unblock a specified signal, or warn if not possible. (set_timeout): Ensure SIGALRM is unblocked before we setup the timer. * tests/misc/timeout-blocked.pl: A new test for the issue. * tests/local.mk: Reference the new test. * NEWS: Mention the fix. Fixes: http://bugs.gnu.org/13535
2013-01-21du: add -t SIZE, --threshold=SIZE optionJakob Truelsen
* src/du.c (opt_threshold): Add variable to hold the value of the --threshold option specified by the user. (long_options): Add a required_argument entry for the new --threshold option. (usage): Add --threshold option. (process_file): Elide printing the entry if its size does not meet the value specified by the --threshold option. (main): In the argument parsing loop, add a case for the new -t option. Convert the given argument by permitting the well-known suffixes for megabyte, gigabytes, etc. Handle the special case "-0": give an error as this value is not permitted. * doc/coreutils.texi (du invocation): Add documentation for the above new option. * tests/du/threshold.sh: Add new test to exercise the new option. * tests/local.mk (all_tests): Mention the above test. Co-authored-by: Bernhard Voelker <mail@bernhard-voelker.de>
2013-01-20tests: remove test case du/slinkBernhard Voelker
This test tried to ensure that not all symlinks (across all file system types) have Zero size and refers to a change in system.h from 2002-08-31 (commit SH-UTILS-2_0_15-55-g62808a7). The test used to do this by working on symlinks to long file names. This assumption is dependant on the underlying file system, and in some environments like XEN does not even work on file systems known to work otherwise. The test for dereferencing and no-dereferencing symlinks is already covered by other tests (du/deref.sh, du/deref-args.sh, and du/no-deref.sh). Therefore, remove it. * tests/du/slink.sh: Remove file. * tests/local.mk (all_tests): Remove the above test. Discussed in: http://lists.gnu.org/archive/html/coreutils/2013-01/msg00053.html
2013-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright", but then also run this, perl -pi -e 's/2\d\d\d-//' tests/sample-test to make that one script use the single most recent year number.
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-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-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-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-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: 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-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-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-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-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.