aboutsummaryrefslogtreecommitdiffstats
path: root/tests (follow)
AgeCommit message (Collapse)AuthorFilesLines
2025-09-21tests: fix OMP_NUM_THREADS misspellingPaul Eggert1-1/+1
* tests/nproc/nproc-quota.sh: Fix misspelling.
2025-09-21tests: avoid false failure on older Linux kernelsPádraig Brady1-1/+3
* tests/fold/fold-zero-width.sh: Check the shell was able to create the redirection file, as intermittently on CentOS 5,6,7 this wasn't the case, with the shell giving an xmalloc failure due to the ulimit. Reported by William Bader and Bruno Haible.
2025-09-21tests: tail: avoid false failure with overlayfsPádraig Brady1-0/+8
* tests/tail/inotify-dir-recreate.sh: Add an extra check that inotify is in use, as it's required for this test. Inotify is avoided with overlayfs for which the df --local check is not sufficient exclusion for.
2025-09-20tests: fold: avoid false failures on Solaris 10Pádraig Brady3-3/+8
* tests/fold/fold-characters.sh: Ensure we have independent verification of the width of characters before testing based on those widths. * tests/fold/fold-zero-width.sh: Likewise. * tests/fold/fold.pl: Only compare the exit status, as the error message can be translated.
2025-09-20tests: dd: avoid false failure on Solaris 10Pádraig Brady1-1/+1
* tests/dd/no-allocate.sh: Give some extra space to the determined vm limit.
2025-09-20tests: avoid false failure on CentOS 5,6,7Pádraig Brady1-1/+1
* tests/fold/fold-zero-width.sh: Increase vm limit to avoid failures on CentOS 5,6,7. Match the limit used in write-errors.sh as per commit v9.5-255-g0bd149403
2025-09-19tests: env: skip a few tests if LD_LIBRARY_PATH is setCollin Funk2-0/+23
* tests/env/env-null.sh: Skip test if LD_LIBRARY_PATH or platform's equivalent is set, since 'env -i' will unset it which may prevent programs from running. * tests/env/env-S.pl: Likewise. Issue and suggested fix reported by Bruno Haible.
2025-09-18tests: tail/overlay-headers.sh: protect against hangPádraig Brady1-2/+2
* tests/tail/overlay-headers.sh: Protect tail invocation with timeout, and extend the possible running period to 60 seconds like other tests. Reported by Brudno Haible on T2SDE Linux/alpha
2025-09-18tests: tests/tail/wait.sh: protect against hangPádraig Brady1-1/+1
* tests/tail/wait.sh: This test was seen to hang occasionally on an Alpine Linux 3.20 system, so protect the tail(1) call with `timeout 60` as done in similar tests. Reported by Bruno Haible.
2025-09-17tests: write-errors.sh: avoid portability issue with dashPádraig Brady2-2/+2
* tests/misc/write-errors.sh: Use printf rather than echo since the echo builtin in dash will interpret backslashes. * tests/misc/read-errors.sh: Likewise for consistency.
2025-09-17maint: STREQ → streqPaul Eggert2-10/+4
Use new Gnulib streq function instead of rolling our own macro. * bootstrap.conf (gnulib_modules): Add stringeq. * src/rm.c (main): Don’t assume streq is a macro that expands to (...), as it is now a function. * src/system.h: * tests/df/no-mtab-status.sh, tests/df/skip-duplicates.sh: (STREQ): Remove. All uses replaced by streq.
2025-09-17tests: fix issues with fold-characters.sh testPádraig Brady2-6/+1
This was noticed with: trap '' PIPE && # Ignore SIGPIPE make check TESTS=tests/fold/fold-characters.sh SUBDIRS=. * tests/fold/fold-characters.sh: Move memory limit test to ... * tests/misc/write-errors.sh: ... which avoids "write error" messages on stderr due to the ignored SIGPIPE. It also protects the fold invocation with a timeout(1) so that fold implementations that don't exit promptly upon write error don't hang the test suite (Like we would have done before commit v9.7-311-gc95c7ee76).
2025-09-16fold: fix write error checks with invalid multi-byte inputPádraig Brady1-3/+8
* src/fold.c (write_out): A new helper to check all writes. (fold-file): Use write_out() for all writes. * tests/fold/fold-zero-width.sh: Adjust to writing more data in various patterns, rather than two buffers of NULs. This is a more robust memory bound check, and the '\303' case tests this particular logic change. * NEWS: fold now exits immediately, not just promptly.
2025-09-16fold: exit promptly upon write errorsPádraig Brady1-1/+3
* NEWS: Mention the improvement. * src/fold.c (fold_file): Check for write errors after each buffer read from stdin. * tests/misc/write-errors.sh: Add test cases.
2025-09-16tests: fold/fold-zero-width.sh: avoid false failure with ENOSPCPádraig Brady1-5/+6
* tests/fold/fold-zero-width.sh: Check relatively large test file is created appropriately. Also apply more idomatic wc -l usage.
2025-09-15fold: fix out of bounds write with zero width charactersCollin Funk2-0/+56
* src/fold.c (fold_file): Prefer putchar ('\n') to copying characters. If we do not have room in the output buffer print it since it is not a full line of text. * tests/fold/fold-zero-width.sh: New test case. * tests/local.mk (all_tests): Add it.
2025-09-14cksum,wc: support disabling hardware acceleration at runtimePádraig Brady3-6/+52
This is useful to give better test coverage at least, and may be useful for users to tune their environment. * bootstrap.conf: Reference the cpu-supports gnulib module. * src/cksum.c: Use cpu_supports() rather than __builtin_cpu_supports(). * src/wc.c: Likewise. * tests/cksum/cksum.sh: Adjust to testing all implementations. * tests/wc/wc-cpu.sh: A new test to do likewise. * tests/local.mk: Reference the new wc test.
2025-09-10maint: basenc: refactor all encodings to use finalizePádraig Brady1-0/+29
Finalize was required for base58, but it's a more general mechanism which simplifies the logic for all encodings * src/basenc.c (do_decode): Always call base_decode_ctx_finalize(), rather than the awkward double loop at end of buffer. * tests/basenc/basenc.pl: Add basenc finalization tests.
2025-09-09nohup: avoid FORTIFY runtime failure on Bionic libcPádraig Brady1-0/+20
The meaning of non-file permission umask bits is implementation defined. On Bionic libc, attempting to set them triggers a FORTIFY runtime check. $ nohup true FORTIFY: umask: called with invalid mask -601 Aborted nohup true * src/nohup.c: (main) Avoid setting non-permission bits in umask. Just clear the umask to ensure we create nohup.out with u+rw, as we restore the original umask before the exec(). * tests/misc/nohup.sh: Add a test case. * NEWS: Mention the bug fix.
2025-09-08basenc: ensure partial padding with newlines induces an errorPádraig Brady1-2/+8
* src/basenc.c (has_padding): A more robust helper to identify padding in the presence of trailing newlines. (do_decode): Use has_padding() rather than just looking at the last character. * tests/basenc/base64.pl: Fully test commit v9.4-53-g378dc38f4 by ensuring partially padded data is diagnosed. baddecode9 is the case fixed in this commit. * NEWS: Mention the bug fix.
2025-09-07tests: ensure option aliases are supportedPádraig Brady2-0/+62
This implicitly tests the previous commit to adjust how date(1) handles multiple named format options. Currrently it tests the following are supported: chown --quiet --silent date --rfc-email --rfc-822 --rfc-2822 date --uct --utc --universal dircolors --bourne-shell --sh dircolors --csh --c-shell head --quiet --silent * tests/misc/option-aliases.sh: A new test to ensure all option aliases supported by a command are supported. * Reference the new test.
2025-09-04tests: fold: check if multi-byte spaces are treated as blankCollin Funk1-13/+26
This avoids a test failure on FreeBSD 14, MacOS 15, and musl. Fix suggested by Pádraig Brady in: <https://bugs.gnu.org/79301#32>. * tests/fold/fold-spaces.sh (isblank): New function. Only run the tests if the character is treated as blank. Fixes https://bugs.gnu.org/79301
2025-09-04tests: cksum: check more length variantsPádraig Brady2-23/+28
* tests/cksum/cksum-raw.sh: Adjust to non legacy naming, and also check various length variations. * tests/misc/read-errors.sh: Likewise.
2025-09-04cksum: prefer -a sha2 -l ###, to -a sha###Pádraig Brady3-6/+19
To make the interface more concise and consistent, while being backwards compatible. * src/digest.c (main): Continue to support -a "sha###" but also support -a "sha2" and treat it like "sha3", except in... (output_file): ... maintain the legacy tags for better compatability. * doc/coreutils.texi (cksum invocation): Document the -a sha2 option. * tests/cksum/cksum-base64.pl: Adjust as per modified --help. * tests/cksum/cksum-c.sh: Add new supported SHA2-### tagged variant. * NEWS: Mention the new feature.
2025-09-03cksum: add support for SHA-3Collin Funk3-1/+87
* src/digest.c: Include sha3.h. (BLAKE2B_MAX_LEN): Rename to DIGEST_MAX_LEN since it is also used for SHA-3. (sha3_sum_stream): New function. (enum Algorithm, algorithm_args, algorithm_args, algorithm_types) algorithm_tags, algorithm_bits, cksumfns, cksum_output_fns): Add entries for SHA-3. (usage): Mention that SHA-3 is supported. Mention requirements for --length with SHA-3. (split_3): Use DIGEST_MAX_LEN instead of BLAKE2B_MAX_LEN. Determine the length of the digest for SHA-3. Make sure it is 224, 256, 384, or 512. (digest_file): Set the digest length in bytes. Use DIGEST_MAX_LEN instead of BLAKE2B_MAX_LEN. Always append the digest length to SHA3 in the output. (main): Allow the use of --length with 'cksum -a sha3'. Use DIGEST_MAX_LEN instead of BLAKE2B_MAX_LEN. Make sure it is 224, 256, 384, or 512. * tests/cksum/cksum-base64.pl (@pairs): Add expected sha3 output. (fmt): Modify the output to use SHA3-512 since that is the default. (@Tests): Modify arguments for sha3 to use --length=512. * tests/cksum/cksum-sha3.sh: New test, based on tests/cksum/b2sum.sh. * tests/local.mk (all_tests): Add the test. * bootstrap.conf: Add crypto/sha3. * gnulib: Update to latest commit. * NEWS: Mention the change. * doc/coreutils.texi (cksum general options): Mention sha3 as a supported argument to the -a option. Mention that 'cksum -a sha3' supports the --length option. Mention that SHA-3 is considered secure.
2025-09-02maint: avoid syntax-check failure from previous commitCollin Funk1-1/+1
* tests/seq/seq-long-double.sh: Place comma after "I.e.".
2025-09-02seq: be more accurate with large integer start valuesPádraig Brady1-1/+8
* src/seq.c (main): Avoid possibly innacurate conversion to long double, for all digit start values. * tests/seq/seq-long-double.sh: Add a test case. * NEWS: Mention the improvement. Fixes https://bugs.gnu.org/79369
2025-08-31ls: fix alignment with locale formatted --sizePádraig Brady1-2/+19
Fix allocated size alignment in locales with multi-byte grouping chars. Tested with: LC_ALL=sv_SE.utf8 ls --size --block-size=\'k * src/ls.c (print_file_name_and_frills): Don't rely on printf("%*s", width, string) to pad multi-byte strings appropriately. Instead work out the padding required and use: printf("%*s%s", padding, "", string) to pad multi-byte appropriately. * tests/ls/block-size.sh: Add a test case. * NEWS: Mention the bug fix. Fixes https://bugs.gnu.org/79347
2025-08-30b2sum: --length: fix upper bound checkPádraig Brady1-0/+12
* src/digest.c (main): Don't saturate -l to BLAKE2B_MAX_LEN, so that the subsequent bounds check is performed. * tests/cksum/b2sum.sh: Add a test case. * NEWS: Mention the fix introduced in commit v9.5-71-gf2c84fe63
2025-08-28fold: fix handling of invalid multi-byte charactersCollin Funk1-0/+11
* src/fold.c (fold_file): Continue the loop when we have buffered bytes but nothing left to read from the file. (adjust_column): Don't assume that the character is printable. * tests/fold/fold-characters.sh: Add a new test case. (bad_unicode): New function.
2025-08-27tests: fold: add tests for multi-byte widthPádraig Brady1-0/+22
* tests/fold/fold.pl: The i18n patch didn't actually test folding of multi-byte characters, so add tests for various multi-byte forms.
2025-08-27tests: fold: copy i18n patch testsPádraig Brady1-1/+33
* tests/fold/fold.pl: Copy tests from Fedora, removing copy & pasted logic that was extraneous to either the i18n patch or upstream.
2025-08-27tests: parameterize IO_BUFSIZEPádraig Brady1-1/+4
* src/getlimits.c (main): Output IO_BUFSIZE, useful for sizing data for tests. * tests/fold/fold-characters.sh: Use it rather than hardcoding.
2025-08-26fold: don't truncate multibyte characters at the end of the bufferCollin Funk1-0/+19
* src/fold.c (fold_file): Replace invalid characters with the original byte read. Copy multibyte sequences that may not yet be read to the start of the buffer before reading more bytes. * tests/fold/fold-characters.sh: Add a test case.
2025-08-26tests: fold: consolidate all fold tests in tests/foldPádraig Brady3-2/+2
* tests/misc/fold.pl: Move from here to ... * tests/fold/fold.pl: ... here. * tests/local.mk: Adjust accordingly.
2025-08-26tests: fold: add a memory constraint testPádraig Brady1-0/+6
Enforcing this interface behavior is worthwhile irrespective of our current implementation, to ensure future or other implementations conform. * tests/fold/fold-characters.sh: Ensure the fold implementation uses bounded memory.
2025-08-24tests: nproc: fix false failure on some systemsPádraig Brady1-12/+74
* tests/nproc/nproc-quota.sh: Also simulate sched_getscheduler() as this will not be called on older or non linux, or may return ENOSYS on Alpine. Fixes https://bugs.gnu.org/79299
2025-08-23tests: cp: ensure copy offload is not disabled for sparse filesPádraig Brady1-1/+20
Related to commits v9.1-109-g879d2180d and v9.7-248-g306de6c26 * tests/cp/sparse-perf.sh: This edge case was missed a couple of times, so add a test to ensure we attempt copy offload.
2025-08-22fold: add the --characters optionCollin Funk4-0/+146
* src/fold.c: Include mcel.h. (count_bytes): Remove variable. (counting_mode, last_character_width): New variables. (shortopts, long_options): Add the option. (adjust_column): If --characters is in used account for number of characters instead of their width. (fold_file): Use getline and iterate over the result with mcel functions to handle multibyte characters. (main): Check for the option. * src/local.mk (src_fold_LDADD): Add $(LIBC32CONV), $(LIBUNISTRING), and $(MBRTOWC_LIB). * tests/fold/fold-characters.sh: New file. * tests/fold/fold-spaces.sh: New file. * tests/fold/fold-nbsp.sh: New file. * tests/local.mk (all_tests): Add the tests. * NEWS: Mention the new option. * doc/coreutils.texi (fold invocation): Likewise.
2025-08-21tests: nproc: add a test for cgroup quotasPádraig Brady2-0/+86
* tests/nproc/nproc-quota.sh: New root only test. * tests/local.mk: Reference the new test.
2025-08-19maint: prefer https to httpCollin Funk1-1/+1
* doc/sort-version.texi (Other version/natural sort implementations): Use https in documentation link. * tests/chmod/symlinks.sh: Use https in license text.
2025-08-14tsort: add do-nothing -w optionPaul Eggert1-0/+4
This is for conformance to POSIX.1-2024 * src/tsort.c: Include getopt.h. (main): Accept and ignore -w. Do not bother altering the usage message, as the option is useless. * tests/misc/tsort.pl (cycle-3): New test.
2025-08-12maint: use short form bug URLsPádraig Brady4-5/+5
* cfg.mk (sc_prohibit-long-form-bug-urls): Disallow long form in code. * scripts/git-hooks/commit-msg: Disallow long form in commit messages. * NEWS: Shorten long urls. * bootstrap.conf: Likewise. * configure.ac: Likewise. * scripts/git-hooks/commit-msg: Likewise. * src/csplit.c: Likewise. * src/fmt.c: Likewise. * src/make-prime-list.c: Likewise. * src/nohup.c: Likewise. * tests/od/od-float.sh: Likewise. * tests/rm/r-root.sh: Likewise. * tests/tail/inotify-race.sh: Likewise. * tests/tail/inotify-race2.sh: Likewise.
2025-08-10realpath: support the -E option required by POSIXCollin Funk1-0/+3
* src/realpath.c (longopts): Add the option. (main): Likewise. (usage): Add the option to the --help message. * tests/misc/realpath.sh: Add a simple test. * doc/coreutils.texi (realpath invocation): Mention the new option. * NEWS: Likewise.
2025-08-09basenc: add base58 supportPádraig Brady1-0/+69
A 58 character encoding that: - avoids visually ambiguous 0OIl characters - uses only alphanumeric characters Described at: - https://tools.ietf.org/html/draft-msporny-base58-03 This implementation uses GMP (or gnulib's gmp fallback). Performance is good in comparison to other implementations. For example when using libgmp on an i7-5600U system, encoding is 530 times faster, and decoding 830 times faster than the implementation using arbitrary precision ints in cpython 3.13. Memory use is proportional to the size of input. Encoding benchmarks: $ time yes | head -c65535 | src/basenc --base58 -w0 >file.enc real 0m0.018s ./configure --quiet --without-libgmp && make -j $(nproc) $ time yes | head -c65535 | src/basenc --base58 -w0 >file.enc real 0m3.431s # dnf install python3-base58 $ time yes | head -c65535 | base58 >file.enc # cpython 3.13 real 0m9.700s Decoding benchmarks: $ time src/basenc --base58 -d <file.enc >/dev/null real 0m0.010s $ ./configure --without-libgmp && make # gnulib gmp $ time src/basenc --base58 -d <file.enc >/dev/null real 0m0.145s $ time base58 -d <file.enc >/dev/null # cpython 3.13 real 0m8.302s * src/basenc.c (base_decode_ctx_finalize, base_encode_ctx_init, base_encode_ctx, base_encode_ctx_finalize): New functions to provide more general processing functionality. (base58_{de,en}code_ctx{_init,,_finalize}): New functions to accumulate all input before calling ... (base58_{de,en}code): ... the GMP based encoding/decoding routines. (do_encode, do_decode): Call the ctx variants if enabled. * doc/coreutils.texi (basenc invocation): Describe the new option, and indicate the main use case being interactive user use. * src/local.mk: Link basenc with GMP. * tests/basenc/basenc.pl: Add test cases. * NEWS: Mention the new feature.
2025-08-09basenc: fix stripping of '=' chars in some encodingsPádraig Brady1-0/+1
* src/basenc.c (do_decode): With -i ensure we strip '=' chars if there is no padding for the chosen encoding. * tests/basenc/basenc.pl: Add a test case. * NEWS: Mention the bug fix.
2025-08-05maint: use consistent references to standard files in messagesCollin Funk3-6/+6
* cfg.mk (sc_standard_outputs): Add a grep command for source files. * src/du.c (main): Use standard input instead of stdin, standard output instead of stdout, and standard error instead of stderr in messages. * src/nohup.c (main): Likewise. * src/sort.c (main): Likewise. * src/split.c (main): Likewise. * src/stdbuf.c (main): Likewise. * src/wc.c (main): Likewise. * tests/du/files0-from.pl (@Tests): Adjust test case to new messages. * tests/sort/sort-files0-from.pl: Likewise. * tests/wc/wc-files0-from.pl: Likewise.
2025-08-03tail: refactor to skip stat call on failurePaul Eggert1-1/+0
* src/tail.c (tail_bytes): New function. (tail_bytes, tail_lines, tail): Accept struct stat pointer from caller instead of calling fstat ourselves. All callers changed. (tail_file): Skip a call to fstat if fstat already failed. * tests/tail/follow-stdin.sh: Adjust to match new behavior on failure, which omits a redundant diagnostic.
2025-08-03tail: allow >=2**64 in traditional formPaul Eggert1-0/+1
This better matches the treatment of POSIX form, e.g., ‘tail +Nc’ is now like ‘tail -c +N’ even when N is large. * src/tail.c: Don’t include xstrtol.h. (parse_obsolete_option): Treat numbers greater than UINTMAX_MAX as if they are UINTMAX_MAX. Parse the number by hand with saturating arithmetic; nowadays that’s simpler than using xstrtoumax. There is no need for a diagnostic now, as the error cannot happen any more. * tests/tail/tail.pl (obs-plus-c3): New test.
2025-08-03readlink: emit errors when POSIXLY_CORRECT is setCollin Funk2-0/+49
* src/readlink.c (main): Set verbose if the POSIXLY_CORRECT environment variable is set. * tests/readlink/readlink-posix.sh: New file. * tests/local.mk (all_tests): Add it. * NEWS: Mention the change. * doc/coreutils.texi (readlink invocation): Document the behavior of POSIXLY_CORRECT.