Commit graph

12270 commits

Author SHA1 Message Date
Ben Wiederhake
e91d0bd14f uniq: fix flaky test gnu_tests
The testcase tries to write to the stdin pipe while the process under
test is simultaneously exiting with an error code. Naturally, this is a
race, and we should ignore any stdin write errors. However, adding this
feature to the list makes it even more unreadable, and adds no real
value, so let's skip the input data entirely.
2024-02-25 17:59:09 +01:00
Terts Diepraam
d7a09c042a
Merge pull request #6010 from BenWiederhake/dev-pr-fix-flaky-diff-timestamp
pr: Check the correct timestamp in test_with_pr_core_utils_tests
2024-02-25 11:46:39 +01:00
Sylvestre Ledru
174864566e
Merge pull request #6006 from BenWiederhake/dev-tr-multi-arg
tr: Correctly handle multiple appearances of flag-args
2024-02-25 09:51:40 +01:00
Sylvestre Ledru
8301a8e5be
Merge pull request #5980 from BenWiederhake/dev-shuf-number-speed
shuf: Fix OOM crash for huge number ranges
2024-02-25 09:50:49 +01:00
Yury Zhytkou
17174ab986
uniq: pass remaining GNU tests (#5994) 2024-02-25 09:45:37 +01:00
Ben Wiederhake
5fed98bb01 pr: check the correct timestamp in test_with_pr_core_utils_tests 2024-02-24 23:48:33 +01:00
Ben Wiederhake
f25b2102db shuf: document new benchmark category 2024-02-24 21:36:13 +01:00
Ben Wiederhake
44310f426c tr: enable passing -t multiple times 2024-02-24 18:37:45 +01:00
Ben Wiederhake
268af90843 tr: enable passing -s multiple times 2024-02-24 18:37:45 +01:00
Ben Wiederhake
352a8a5bd7 shuf: handle --input-range with huge number ranges
This requires special handling, because we cannot always generate all
possible strings beforehand, e.g. in the case of "-n 2 -i 0-2147483647".
2024-02-24 18:33:46 +01:00
Ben Wiederhake
989178f438 shuf: extract minimal required interface between data and core loop 2024-02-24 18:33:46 +01:00
Ben Wiederhake
dc664006fe tr: enable passing -d multiple times 2024-02-23 11:58:22 +01:00
Ben Wiederhake
cad94a69be tr: prevent passing options in the wrong place
Note: This requires using the DEPRECATED item Command::trailing_var_arg
in clap. This is going to be another
[problem with clap](https://github.com/tertsdiepraam/uutils-args/blob/main/docs/design/problems_with_clap.md).
2024-02-23 11:58:22 +01:00
Ben Wiederhake
d9b6675bbf tr: enable passing -c multiple times 2024-02-23 11:58:18 +01:00
Daniel Hofstetter
5a2e0c700e
Merge pull request #5990 from BenWiederhake/dev-shuf-head-null
shuf: Do not read input when -n0 is given
2024-02-23 09:01:14 +01:00
Sylvestre Ledru
208b2dbb51
Merge pull request #5997 from BenWiederhake/dev-unignore
Un-Ignore two tests that fail for nonsense reasons
2024-02-23 08:34:07 +01:00
Sylvestre Ledru
1691127c79
Merge pull request #6001 from BenWiederhake/dev-dd-small-times
dd: fix flaky test_final_stats_unspec
2024-02-23 08:33:35 +01:00
Sylvestre Ledru
9af65c0397
Merge pull request #5999 from BenWiederhake/dev-tr-squeeze-last-set
tr: Properly handle deleting and squeezing
2024-02-23 08:33:13 +01:00
Ben Wiederhake
ede944e1f8 dd: fix flaky test_final_stats_unspec
If the first four decimal digits are zero, GNU dd elides them altogether.
Here's an execution on my PC:

```console
$ for i in $(seq 20000); do LC_ALL=C gnu_dd if=/dev/null of=/dev/null \
    2>&1; done | grep copied | grep -E ' [0-9]e'
0 bytes copied, 1e-05 s, 0 B/s
0 bytes copied, 9e-06 s, 0.0 kB/s
```

Our implementation conforms to this, resulting in the following CI flake:

```
---- test_dd::test_final_stats_unspec stdout ----
run: D:\a\coreutils\coreutils\target\x86_64-pc-windows-gnu\debug\coreutils.exe dd
thread 'test_dd::test_final_stats_unspec' panicked at 'Stderr does not match regex:
0+0 records in
0+0 records out
0 bytes copied, 8e-05 s, 0.0 B/s
', tests\by-util\test_dd.rs:280:10
stack backtrace:
   0: rust_begin_unwind
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src/panicking.rs:578:5
```

Of course, this is just an overly strict regex in the test. This was a
one-in-tenthousand flaky test.
2024-02-23 06:24:11 +01:00
Ben Wiederhake
617f3a8b6f tr: when deleting and squeezing, never complement set2 2024-02-23 06:08:37 +01:00
Ben Wiederhake
48c4b57c97 tr: require second string argument when deleting and squeezing 2024-02-23 03:23:07 +01:00
Ben Wiederhake
27030e9f53 touch: re-enable test, fix typo in expected error messge 2024-02-23 00:21:19 +01:00
Ben Wiederhake
e50eb19056 head: fix 'test_spams_newline' to check *against* newline spam
The comment was introduced in commit 8320b1ec5f,
the test was introduced in commit c1f518e586
claiming to be about "failing GNU head tests".

However, a simple check reveals no such difference:

```console
$ echo -n a | hd
00000000  61                                                |a|
00000001
$ echo -n a | head | hd  # GNU head
00000000  61                                                |a|
00000001
$ echo -n a | cargo run -- head | hd
00000000  61                                                |a|
00000001
$ echo -n a | busybox head | hd
00000000  61                                                |a|
00000001
$
```

Looking at the GNU tests directly, it seems that there is a similar, but different test.
2024-02-23 00:21:19 +01:00
Terts Diepraam
69ea02d9b0
Merge pull request #5989 from BenWiederhake/dev-shuf-echo-anywhere
shuf: treat -e as a flag, not as a multi-value arg
2024-02-23 00:16:42 +01:00
Ben Wiederhake
a29f68b720 shuf: Do not read input when -n0 is given
This is explicitly tested by some suites, including the GNU test suite.
2024-02-22 23:50:03 +01:00
Ben Wiederhake
a59924ece5 shuf: treat -e as a flag, not as a multi-value arg 2024-02-22 23:22:35 +01:00
Sylvestre Ledru
f7821cd0d2
Merge pull request #5995 from cakebaker/factor_enable_debug_assert
factor: enable a debug_assert! statement
2024-02-22 16:51:54 +01:00
Sylvestre Ledru
c8ce04e310
Merge pull request #5996 from cakebaker/shuf_add_missing_word
shuf: add missing word to BENCHMARKING.md
2024-02-22 16:46:06 +01:00
Daniel Hofstetter
999303e0d4 shuf: add missing word to BENCHMARKING.md 2024-02-22 15:13:54 +01:00
Daniel Hofstetter
4da633b835 factor: enable a debug_assert! statement 2024-02-22 09:33:29 +01:00
Sylvestre Ledru
4dba45d1da
Merge pull request #5988 from cakebaker/fix_imported_redundantly_warnings
Fix "item x imported redundantly" warnings
2024-02-20 08:17:06 +01:00
Daniel Hofstetter
725da985c1 Fix "item x imported redundantly" warnings 2024-02-19 15:39:37 +01:00
Terts Diepraam
177ac7ea28
stat: use chrono instead of time in fsext (#5934)
* stat: use chrono instead of time in fsext

This removes the dependency of `fsext` on `time` and it cleans up the code.

* stat: use chrono instead of time in fsext

This removes the dependency of `fsext` on `time` and it cleans up the code.

* stat: fix two errors from clippy & spell-checker

* stat: move fn to fix clippy error

* stat: print - if birth time unknown

* uucore/fsext: fix "unused import" error on Windows

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-02-19 10:21:26 +01:00
Sylvestre Ledru
33785c93a3
Merge pull request #5983 from cakebaker/printf_set_lc_all_for_fuzzing
fuzzing: set LC_ALL=C when running GNU printf
2024-02-18 15:20:09 +01:00
Sylvestre Ledru
9866f022a8
Merge pull request #5987 from tertsdiepraam/expand-remove-collect-ignore
`expand`: do not ignore invalid UTF-8
2024-02-18 15:19:47 +01:00
Terts Diepraam
913656be9d expand: do not ignore invalid UTF-8 2024-02-18 14:26:23 +01:00
Daniel Hofstetter
f0a6593aa6
Merge pull request #5986 from tertsdiepraam/numfmt-invalid-utf8
`numfmt`: remove clap workaround
2024-02-18 14:25:24 +01:00
Terts Diepraam
4da6d58a6b numfmt: remove clap workaround 2024-02-18 13:32:00 +01:00
Daniel Hofstetter
88e1a35701
Merge pull request #5984 from cre4ture/fix/disable_test_od_test_f16_for_android_ci
disable failing test_od::test_f16() for android CI
2024-02-18 13:15:55 +01:00
Daniel Hofstetter
c78d2c038c
Merge pull request #5985 from uutils/renovate/textwrap-0.x
chore(deps): update rust crate textwrap to 0.16.1
2024-02-18 12:33:28 +01:00
renovate[bot]
d76b3103f0
chore(deps): update rust crate textwrap to 0.16.1 2024-02-17 20:06:01 +00:00
Ulrich Hornung
d6ca9e3800
disable failing test_od::test_f16() for android CI. 2024-02-17 18:24:09 +01:00
Daniel Hofstetter
a12d7c2b67
Merge pull request #5978 from BenWiederhake/dev-shuf-multi
shuf: include all echo args, not just the last
2024-02-17 16:22:52 +01:00
Daniel Hofstetter
89bad851e6 fuzzing: set LC_ALL=C when running GNU printf 2024-02-17 16:07:03 +01:00
Ben Wiederhake
b091911aae shuf: refuse multiple input ranges and multiple output files 2024-02-16 21:14:56 +01:00
Ben Wiederhake
69f23c2521 shuf: obey all headcount args, not just the last 2024-02-16 21:08:16 +01:00
Ben Wiederhake
07e8f4c7a5 shuf: include all echo args, not just the last 2024-02-16 20:49:59 +01:00
Daniel Hofstetter
420dfe8a9b
Merge pull request #5958 from tertsdiepraam/csplit-printf
`csplit`: use `printf` functionality from `uucore`
2024-02-16 14:39:03 +01:00
Terts Diepraam
fc82360f58 csplit: fix up tests and error message for filenames 2024-02-16 11:51:04 +01:00
Daniel Hofstetter
bfe6f0f004
Merge pull request #5979 from BenWiederhake/dev-shuf-null-input
shuf: Treat empty file as zero elements instead of one emptystring
2024-02-16 09:19:44 +01:00