1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-13 18:47:58 +00:00
Commit graph

4055 commits

Author SHA1 Message Date
Nicolas Boichat
b142b9e748 test_*: Disable tests that require setting rlimit on Android
See #7542, it's not totally clear where the problem comes from,
but blanking LD_PRELOAD set by termux seems to fix the problem
(but introduces other issues.

Let's just disable these tests for now.
2025-03-23 20:24:17 +01:00
Nicolas Boichat
7eb873c326 test_env: Try to execute an empty file instead of .
For some unclear reason, Android _now_ sometimes returns an
IsADirectory error, instead of PermissionDenied, when trying
to execute `.`.

Since this test really wants to test PermissionDenied, we try
to execute a file in the fixture instead, that doesn't have
exec permission.

Also, limit this test to Unix.

Fixes part of #7542.
2025-03-23 19:37:59 +01:00
Nicolas Boichat
152dada379 tests/common/util: Make sure test_altering_umask is run in correct shell
On Android CI, `sh` would point at a different flavor of shell
shipped with termux (dash).

The current umask test expects that `/system/bin/sh` is used though,
so create a new function TestScenario:cmd_shell that runs a command
in the default shell (that could be used in more tests).

Fixes one part of #7542.
2025-03-23 19:37:04 +01:00
Sylvestre Ledru
8931d2c26e
Merge pull request #7521 from usamoi/ptx
ptx: fixes
2025-03-23 09:28:20 +01:00
Sylvestre Ledru
53d277233d
Merge pull request #7527 from drinkcat/seq-tests
test_seq: Add a few more tests for corner cases
2025-03-23 09:26:20 +01:00
Sylvestre Ledru
eed5c81060
Merge pull request #7463 from blyxxyz/clean-shuf
Make `shuf` OsStr-compliant and bring newline handling in line with GNU
2025-03-22 22:29:49 +01:00
Nicolas Boichat
596ea0a694 test_seq: Add a few more tests for corner cases
Some of these tests are not completely defined behavior, but
in many cases they make sense (or at least one can find some
consistent logic to it).

However, there are 2 edge cases that are more dubious IMHO.
One of them has been reported on list a while back, and I
just reported another.
2025-03-22 22:02:11 +01:00
Nicolas Boichat
59cd6e5e41 tests: Move seq/yes run function to Ucommand::run_stdout_starts_with
Tests for both `seq` and `yes` run a command that never terminates,
and check the beggining of their output in stdout, move the copied
parts of the wrapper function to common/util.

We still need to use slightly different logic to parse exit value
as `seq` returns success if stdout gets closed, while `yes` fails.
2025-03-22 22:02:11 +01:00
Nicolas Boichat
25c492ee19 uucore: format: Pad non-finite numbers with spaces, not zeros
`printf "%05.2f" inf` should print `  inf`, not `00inf`.

Add a test to cover that case, too.
2025-03-22 21:13:18 +01:00
Valerio
6658a0e610
Add test to ensure arch output is not empty (#7523)
* Add test to ensure arch output is not empty

This test ensures that the output of the arch command is non-empty, which is a minimal expectation across all supported architectures.

This helps avoid regressions or edge cases where the command might unexpectedly return an empty string on unsupported or misconfigured platforms.

* Update tests/by-util/test_arch.rs

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* Apply cargo fmt formatting

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2025-03-22 15:15:28 +01:00
usamoi
412d2b3b1f ptx: fixes 2025-03-22 19:25:19 +08:00
Terakomari
ae6d4dec28
base32/base64/basenc: add -D flag (#7479)
* base32/base64/basenc: add -D flag

* base32/base64/basenc: add test for -D flag

* update extensions.md

* remove redundant parameters

* merge  into a single category

* Update docs/src/extensions.md

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>

---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2025-03-18 14:39:53 +01:00
M Bussonnier
5532891f20
cp: create failing test for #7455 (#7457)
* Create failing test for #7455

Also update existing test to ensure output is empty.

* add ignore until relevant issue is fixed

---------

Co-authored-by: M Bussonnier <mbussonnier@gmail.com>
2025-03-16 15:31:06 +01:00
Jan Verbeek
f562543b6c shuf: Use OS strings, don't split individual arguments, cleanup
- shuf now uses OS strings, so it can read from filenames that are
  invalid Unicode and it can shuffle arguments that are invalid
  Unicode. `uucore` now has an `OsWrite` trait to support this without
  platform-specific boilerplate.

- shuf no longer tries to split individual command line arguments,
  only bulk input from a file/stdin. (This matches GNU and busybox.)

- More values are parsed inside clap instead of manually, leading to
  better error messages and less code.

- Some code has been simplified or made more idiomatic.
2025-03-16 14:10:31 +01:00
Daniel Hofstetter
75260a5889 test: adapt test to new version string 2025-03-15 16:03:17 +01:00
Dorian Péron
e147063e26
Merge pull request #7413 from drinkcat/printf-nan
Fix `nan` print, simplify negative number printing.
2025-03-14 14:23:31 +01:00
Daniel Hofstetter
5f6a7d0ffa
Merge pull request #7440 from sylvestre/selinux
CI: add a new job to test with Selinux
2025-03-14 13:40:01 +01:00
Nicolas Boichat
0c0d119413 test: printf: Add a test for scientific printing of negative number
This was broken before the last few commits.
2025-03-14 12:42:00 +01:00
Nicolas Boichat
92a291b71d test: printf: Add nan, inf, negative zero
Add a few end-to-end tests for printf of unusual floats (nan,
infinity, negative zero).
2025-03-14 12:42:00 +01:00
Nicolas Boichat
c0a1179e7c seq: Enable test_auto_precision and test_undefined
Those tests appear to have been fixed, enable them.
2025-03-14 12:05:16 +01:00
Nicolas Boichat
1782de8999 seq: Add tests for default float formats
Add tests for some of the default float formats (%f, %g, %E), mostly
to check that the default precision is correctly set to 6 digits.
2025-03-14 12:05:16 +01:00
Sylvestre Ledru
a193073556 disable some tests for now
Fails with:
```

---- test_ls::test_ls_color_norm stdout ----
touch: /tmp/.tmp9wbpVl/exe
touch: /tmp/.tmp9wbpVl/no_color
run: /home/runner.linux/work/target/debug/coreutils ls -gGU --color exe no_color
thread 'test_ls::test_ls_color_norm' panicked at tests/by-util/test_ls.rs:5307:10:
'norm exe
norm no_color
' does not contain 'norm exe
norm no_color'
---- test_ls::test_ls_inode stdout ----
touch: /tmp/.tmpiozh4d/test_inode
run: /home/runner.linux/work/target/debug/coreutils ls test_inode -i
run: /home/runner.linux/work/target/debug/coreutils ls test_inode
run: /home/runner.linux/work/target/debug/coreutils ls -li test_inode
thread 'test_ls::test_ls_inode' panicked at tests/by-util/test_ls.rs:2776:5:
assertion failed: re_long.is_match(result.stdout_str())
---- test_ls::test_ls_long_format stdout ----
mkdir: /tmp/.tmpDm1xDQ/test-long-dir
touch: /tmp/.tmpDm1xDQ/test-long-dir/test-long-file
mkdir: /tmp/.tmpDm1xDQ/test-long-dir/test-long-dir
run: /home/runner.linux/work/target/debug/coreutils ls -l test-long-dir
run: /home/runner.linux/work/target/debug/coreutils ls --long test-long-dir
run: /home/runner.linux/work/target/debug/coreutils ls --format=long test-long-dir
run: /home/runner.linux/work/target/debug/coreutils ls --format=lon test-long-dir
run: /home/runner.linux/work/target/debug/coreutils ls --for=long test-long-dir
run: /home/runner.linux/work/target/debug/coreutils ls --format=verbose test-long-dir
run: /home/runner.linux/work/target/debug/coreutils ls --for=verbose test-long-dir
run: /home/runner.linux/work/target/debug/coreutils ls -lan test-long-dir
thread 'test_ls::test_ls_long_format' panicked at tests/by-util/test_ls.rs:1139:62:
Stdout does not match regex:
total 0
drwxr-xr-x+ 3 1001 1001 80 Mar 14 08:14 .
drwxr-xr-x+ 3 1001 1001 60 Mar 14 08:14 ..
drwxr-xr-x+ 2 1001 1001 40 Mar 14 08:14 test-long-dir
-rw-r--r-- 1 1001 1001  0 Mar 14 08:14 test-long-file
---- test_ls::test_ls_long_formats stdout ----
touch: /tmp/.tmpCHVj2X/test-long-formats
run: /home/runner.linux/work/target/debug/coreutils ls -l --author test-long-formats
thread 'test_ls::test_ls_long_formats' panicked at tests/by-util/test_ls.rs:1514:10:
Stdout does not match regex:
-rw-r--r--+ 1 runner runner runner 0 Mar 14 08:14 test-long-formats
failures:
    test_ls::test_ls_color_norm
    test_ls::test_ls_inode
    test_ls::test_ls_long_format
    test_ls::test_ls_long_formats
```
2025-03-14 11:54:52 +01:00
M Bussonnier
57d0157c6a split test for 32 and 64 bits systems 2025-03-14 11:00:08 +01:00
M Bussonnier
7632acfc90 Fix touch -t with 2 digit years when YY > 68
When using `touch -t` with a 2 digit year, the year is interpreted as
a relative year to 2000.

When the year is 68 or less, it should be interpreted as 20xx.
When the year is 69 or more, it should be interpreted as 19xx.

This is the behavior of GNU `touch`.

fixes gh-7280

Arguably 2 digits years should be deprecated as we
are already closer to 2069, than 1969.
2025-03-14 11:00:08 +01:00
Sylvestre Ledru
2b294bb368 fix test_runcon::invalid stdout 2025-03-14 09:54:29 +01:00
Sylvestre Ledru
117fea23ba selinux test: disable some tests (not a big deal) 2025-03-14 09:54:29 +01:00
Sylvestre Ledru
3a858905fe chcon: ignore valid_reference_repeated_reference for causing issue 7443 2025-03-14 09:54:29 +01:00
Daniel Hofstetter
10fc96a78b true,false: remove newline from version string 2025-03-14 09:21:37 +01:00
Daniel Hofstetter
6cf1374b60 true,false: rename test_exit_code -> test_no_args 2025-03-14 08:59:27 +01:00
Daniel Hofstetter
77b701cfc4 true,false: use no_output() in tests 2025-03-14 08:57:30 +01:00
Louis DISPA
a236f85e9d expr: Add a long input test
Test a stack overflow that was happening on linux for long inputs.
2025-03-13 17:05:51 +01:00
Daniel Hofstetter
33a34e4e54 ls,wc: remove unnecessary unsafe blocks 2025-03-11 17:17:15 +01:00
Dorian Peron
cd1e764581 test(printf): Add test for escaped octal then newline 2025-03-10 16:25:02 +01:00
Daniel Hofstetter
df4dfea852 tests: replace run() with succeeds() or fails() 2025-03-09 16:53:56 +01:00
Sylvestre Ledru
2ae14a393a
Merge pull request #7408 from sylvestre/head-error
head: improve error mgmt.
2025-03-07 14:02:07 +01:00
Sylvestre Ledru
dedd644016 head: improve error mgmt.
And provide more details than GNU

Should fix tests/head/head-write-error
2025-03-07 11:24:54 +01:00
Sylvestre Ledru
0e7a26178f
Merge pull request #7213 from cakebaker/kill_add_tests
kill: test "-l <number>" & adapt error messages
2025-03-07 08:53:35 +01:00
Dorian Peron
a9d8eed217 expr: Remove useless arg in enum variant 2025-03-04 10:27:55 +01:00
Dorian Peron
985ac3b381 test(expr): Add GNU tests to rust testsuite 2025-03-04 10:27:55 +01:00
Sylvestre Ledru
72299d3e16
Merge pull request #7394 from drinkcat/msrv-1.82.0
Bump MSRV to 1.82.0
2025-03-04 10:26:52 +01:00
Nicolas Boichat
c6e06af84a tests/common/util: Use is_none_or instead of map_or
Following clippy advice:
error: this `map_or` can be simplified
     --> tests\common\util.rs:411:9
      |
  411 |         self.exit_status.map_or(true, |e| e.success())
      |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use is_none_or instead: `self.exit_status.is_none_or(|e| e.success())`
2025-03-04 09:57:13 +01:00
Sylvestre Ledru
3e1adf40ee Use the new function 'fails_with_code' v2 2025-03-04 09:27:47 +01:00
Sylvestre Ledru
18cb7dcf9e Use the new function fails_with_code
Done with
```
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.no_stdout\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2)\n\1.no_stdout();/gs' *rs
$ sed -i -e "s|.fails()(.*).code_is(|.fails_with_code(|g" *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2);/gs' *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)(.*?)[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\3)\2;/gs' *rs
...
```
2025-03-01 17:26:20 +01:00
Dorian Péron
76ad6042b5
Merge pull request #7253 from karlmcdowall/head_stdio_file
Head: ensure stdin input stream is correct on exit
2025-02-28 17:05:06 +01:00
Dorian Peron
86aff6186a test-utils: Add fails_with_code() function 2025-02-27 14:24:54 +01:00
Karl McDowall
ad20cb35a0 Head: ensure stdin input stream is correct on exit
Fix issue #7028
Head tool now ensures that stdin is set to the last character
that was output by the tool. This ensures that if any subsequent
tools are run from the same input stream they will start at the
correct point in the stream.
2025-02-26 11:41:29 -07:00
Daniel Hofstetter
15eaeaec14
Merge pull request #7347 from BigPapa314/cp--fix-don't-show-msg-with-cp--i--v---update=older-a-b-if-a-is-older-than-b
cp: disabled verbose output if file has been skipped
2025-02-26 08:48:35 +01:00
Thomas Kilian
63fe4fb327 cp: disabled verbose output if file has been skipped 2025-02-24 22:24:27 +01:00
Sylvestre Ledru
81048228cf
Merge pull request #7322 from alexsnaps/issue-7221
numfmt: fix Unit::SI uses lowercase `k` suffix for kilos
2025-02-24 19:28:00 +01:00
Daniel Hofstetter
cf08040348 tests: make wait_with_output private
and un-deprecate it
2025-02-24 09:26:05 +01:00