1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00
Commit graph

3511 commits

Author SHA1 Message Date
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
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
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
Sylvestre Ledru
fae7bb0a57
Merge pull request #7332 from RenjiSann/expr-other-approach
expr: Evaluate parenthesis content before checking for closing parenthesis
2025-02-24 08:19:05 +01:00
Daniel Hofstetter
e2412e003a yes: fix use of deprecated function in test
use wait() instead of wait_with_output()
2025-02-23 16:53:46 +01:00
Dorian Peron
4513b58e59 test(expr): Add test for eager evaluation 2025-02-23 16:22:06 +01:00
Daniel Hofstetter
be1b2b7632 tee: fix use of deprecated function in tests
use pipe_in_and_wait() instead of pipe_in_and_wait_with_output()
2025-02-22 16:21:08 +01:00
jfinkels
4acc59d075
test: add < and > operators for string comparison (#7315)
* test: add < and > operators for string comparison

Fixes #7254.

* Add more tests for string inequality

* Use match in place of if/elseif block

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

* Change test name to specify lt/gt operator

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2025-02-21 14:41:15 +01:00
Sylvestre Ledru
12bb82fac0
Merge pull request #7294 from karlmcdowall/head_read_but_last_n_bug
head: Fix bug printing large non-seekable files
2025-02-20 12:09:57 +01:00
Daniel Hofstetter
1910da5869 test: remove sleep from tests 2025-02-20 10:48:01 +01:00
Dorian Peron
989b6ba2a0 tr: raise an error when there are two chars or more in an equivalence class 2025-02-19 16:15:40 +01:00
Daniel Hofstetter
99d4fbdd85
Merge pull request #7325 from jfinkels/rm-prompt-message-inaccessible
rm: correct prompt for removing inaccessible dir
2025-02-19 10:36:30 +01:00
Jeffrey Finkelstein
2b531b78ef rm: correct prompt for removing inaccessible dir
Change the prompt when attempting to remove an inaccessible
directory. Before this commit, the prompt was

    rm: remove write-protected directory 'dir'?

After this commit, the prompt is

    rm: attempt removal of inaccessible directory 'dir'?

This required slightly adjusting the logic for which prompt messages to
display under which circumstances.

Fixes #7309.
2025-02-18 18:39:45 -05:00
Alex Snaps
17a409532f
Fix #7219: from iec-i without suffix are bytes
Signed-off-by: Alex Snaps <alex@wcgw.dev>
2025-02-18 17:17:29 -05:00
Alex Snaps
448dde7f5c
Fixed tests to reflect si's handling of kilos
Signed-off-by: Alex Snaps <alex@wcgw.dev>
2025-02-18 16:32:53 -05:00
Jeffrey Finkelstein
1606968bf2 rm: recursive implementation of -r option
Change the implementation of `rm -r` so that it is explicitly recursive
so that (1) there is one code path regardless of whether `--verbose` is
given and (2) it is easier to be compatible with GNU `rm`.

This change eliminates a dependency on the `walkdir` crate.

Fixes #7033, fixes #7305, fixes #7307.
2025-02-17 11:18:24 -05:00
Sylvestre Ledru
58c336d5c3
Merge pull request #6040 from hamflx/main
Make mv command fallback to copy only if the src and dst are on different device
2025-02-17 08:47:06 +01:00
Sylvestre Ledru
91784d0bff
Merge pull request #7306 from jfinkels/rm-add-tests-interactive
rm: add two passing tests for -i option
2025-02-17 08:44:51 +01:00
Jeffrey Finkelstein
ba67469c9c rm: add two passing tests for -i option 2025-02-16 18:40:14 -05:00
hamflx
b96f825503 mv: Make mv command fallback to copy only if the src and dst are on different device 2025-02-17 00:22:28 +01:00
Jeffrey Finkelstein
464181bb56 rm: simplify remove_dir() helper function 2025-02-16 12:18:37 -05:00
Jeffrey Finkelstein
183a99d532 split: avoid extremely long format width in test
Avoid an extremely long format width specifier in test case
`test_long_lines`. The Rust compiler is planning an upcoming change to
restrict the maximum width that can be specified to 65535, so this
change defends against future limitations in the compiler. For more
information, see
<https://github.com/uutils/coreutils/pull/7128#discussion_r1955787665>.
2025-02-14 17:41:36 -05:00
Daniel Hofstetter
cdc8d5f627 kill: test "-l <number>" & adapt error messages 2025-02-14 14:27:12 +01:00
Karl McDowall
84b42a8ce4 head: Fix bug printing large non-seekable files
Fixes issue #7288.
Rewrite logic for print-all-but-last-n-bytes in non-seekable
files.
2025-02-12 10:16:44 +01:00
aimerlief
dd7b45465c
cp: print verbose msg after prompt (#7287)
* cp: fix verbose output order after prompt

Fixes: #7285

* cp: add test for verbose message order

* cp: fix test for interactive prompt ordering

* cp: update test for verbose output order

* cp: fix test cases to use update option
2025-02-11 09:19:08 +01:00
Jeffrey Finkelstein
18f9ca9da4 csplit: don't panic on missing suppressed file
Avoid a panic that would occur when attempting to remove a file that
didn't exist. This would happen when scanning for a regular expression
match, advancing by a positive offset, and suppressing empty files. For
example, before this commit,

    echo a | csplit -z - %a%1

would cause a panic. After this commit, the process terminates as
expected: without error, without output, and without any files written.

Fixes #7251.
2025-02-09 22:04:47 -05:00
Daniel Hofstetter
d86a7fb593
Merge pull request #7274 from jfinkels/touch-obsolete-posix-args
touch: support obsolete POSIX timestamp argument
2025-02-08 15:24:23 +01:00