Luv-Ray
fb2399f56b
fix clippy ( #8275 )
...
* fix clippy
* update
* update
2025-06-27 09:15:24 +02:00
Yuankun Zhang
e1f40ff601
cat: add error handling in write_fast function ( #8091 )
2025-06-13 11:02:03 +02:00
Teemu Pätsi
4d40671d79
cat: Fix reporting "input file is output file" error when outputting to an input file ( #8025 )
...
* cat: Check if a file can be overwritten safely in Unix
* cat: Check if a file can be overwritten safely in Windows
* cat: Test writing read-write file that is input and output
* cat: Unit test `is_appending` function
* cat: Unit test `is_unsafe_overwrite` function
* cat: Comment why a few function calls could return Err
* cat: Remove obvious comments from test
2025-06-06 12:01:31 +02:00
Karl McDowall
a4b621ad8a
cat: bugfix when running with -T option
...
Fixes an crash seen when running with -T option if no newline
is found in a buffer.
Added unit test to validate.
2025-04-02 18:59:27 -06:00
Sylvestre Ledru
a0179ea239
uutests: adjust the tests to use them
2025-03-28 21:40:31 +01:00
Sylvestre Ledru
a85539f530
Run cargo fmt on the tree
2025-03-24 21:33:12 +01:00
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
Daniel Hofstetter
df4dfea852
tests: replace run() with succeeds() or fails()
2025-03-09 16:53:56 +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
9a88526867
test(cat): add test for output appending to input file
2025-02-07 07:45:21 -05:00
GiM
d8eb4e2214
cat: fix #5186 by adding explicit flush. ( #5256 )
...
* fix #5186 by adding explicit flush.
* make test machine-independent
---------
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-10-06 11:31:31 +02:00
Peng Zijun
382e787d1c
cat: handle CRLF delimiters correctly ( #6763 )
...
* fix issue #6248
* add test to cat for the case of issue #6248
2024-10-02 15:15:06 +02:00
Laurent Cheylus
b69070fdff
tests: disable failed tests for cat on OpenBSD
...
Signed-off-by: Laurent Cheylus <foxy@free.fr>
2024-07-06 22:29:12 +02:00
n4n5
ab67947321
fix clippy tests
2024-06-30 16:27:08 +02:00
Ben Wiederhake
34da5029df
cat+tests: simplify spell-checker exceptions
2024-04-30 18:28:20 +02:00
Daniel Hofstetter
679b9e2c0a
cat: prefix two test fns with "test_"
2024-03-04 09:41:09 +01:00
Ben Wiederhake
cd70d7dec1
cat: ignore -u flag, just like GNU does
2024-03-01 23:56:30 +01:00
Ben Wiederhake
472b56f0ff
cat: fix -b and -n anti-symmetry
2024-03-01 23:56:30 +01:00
Ben Wiederhake
100a48fda9
cat: permit repeating command-line flags
2024-03-01 23:56:30 +01:00
Ben Wiederhake
bcd2d888a1
cat: don't flake even on exotic pipe buffer sizes
...
See also 9995c637aa
.
There is a race condition between the writing thread and the command.
It is easily possible that on the developer's machine, the writing
thread is always faster, filling the kernel's buffer of the stdin pipe,
thus succeeding the write. It is also easily possible that on the busy
CI machines, the child command runs first for whatever reason, and exits
early, thus killing the pipe, which causes the later write to fail. This
results in a flaky test. Let's prevent flaky tests.
2024-02-23 05:42:17 +01:00
Daniel Hofstetter
04ebd863a6
clippy: fix warnings introduced by Rust 1.76
2024-02-08 16:56:01 +01:00
Sylvestre Ledru
c24a51403a
cat: return the same error message as GNU with loop symlink ( #5466 )
...
* cat: return the same error message as GNU with loop symlink
Should fix tests/du/long-sloop.sh because it is using cat as a ref
for error messages
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-10-28 22:29:24 +02:00
Sylvestre Ledru
bfca6bf70f
Add license headers on all files
2023-08-21 10:49:27 +02:00
Daniel Hofstetter
94aeba9854
tests: fix unused imports warnings on Windows
2023-03-20 16:06:56 +01:00
Daniel Hofstetter
6988eb7ec6
tests: expand wildcard imports
2023-03-20 15:32:35 +01:00
Joining7943
1c230fd779
tests/util: Refactor UCommand and TestScenario.
...
Summary of changes in UCommand:
* Extend UCommand by builder methods and simplify methods in TestScenario
* Simplify code structures where possible. Add documentation.
* Store bin_path as PathBuf and util_name as String in all structs
* Remove UCommand::util and make bin_path, temp_dir private
* Rename UCommand::with_limit -> UCommand::limit
Summary of changes in TestScenario:
* Rename some parameters in TestScenario methods to be more descriptive
* Remove ucmd_keepenv, cmd_keepenv from TestScenario. Use UCommand::keep_env instead.
2023-02-18 23:38:20 +01:00
Joining7943
1fadeb43b2
tests/util: Do not trim stderr in CmdResult::stderr_is. Add method stderr_trimmed_is.
...
Fix tests assert whitespace instead of trimming it. Disable some tests in `test_tr` because `tr`
produces too many newlines.
2023-01-22 14:56:19 +01:00
Joining7943
4a2ced5940
tests: Adjust some tests to use improved UChild. test_tac: Ignore pipe tests on windows.
...
Summary:
* Disable test_retry6 on android because of intermittent failures
* Use wait() instead of wait_with_output in test_cat, test_cp, test_sort
* tests/sort: Simplify usage of test_sigpipe_panic
* Fix tests in test_tee.
tests/tac:
There was a change in the `tests/common/util.rs` test api concerning piped input which may have
revealed a bug in the implementation of tac. Please see also
https://github.com/uutils/coreutils/pull/4136
2022-12-02 13:13:10 +01:00
Joining7943
982fb682e9
tests: Use UChild in tests. Rename run_no_wait_child to run_no_wait and return UChild
...
tests/tail:
* test_stdin_redirect_file:. Test fails now when assert_alive()!
The follow test `tail -f < file` where file's content is `foo` fails with:
Assertion failed. Expected 'tail' to be running but exited with status=exit status: 0
I also tried on the command line and can confirm that tail isn't runnning when following by
descriptor. The test is deactivated until the implementation is fixed.
* test_follow_stdin_descriptor
* test_follow_stdin_explicit_indefinitely.
* test_follow_single
* test_follow_non_utf8_bytes
* test_follow_multiple
* test_follow_name_multiple
* test_follow_invalid_pid
* test_single_big_args
* test_retry3
* test_retry4
* test_retry5
* test_retry7
* test_retry8
* test_retry9
* test_follow_descriptor_vs_rename1
* test_follow_descriptor_vs_rename2
* test_follow_name_retry_headers
* test_follow_name_remove
* test_follow_name_truncate1
* test_follow_name_truncate2
* test_follow_name_truncate3
* test_follow_name_truncate4
* test_follow_truncate_fast
* test_follow_name_move_create1
* test_follow_name_move_create2
* test_follow_name_move1
* test_follow_name_move2
* test_follow_name_move_retry1
* test_follow_name_move_retry2
* test_follow_inotify_only_regular
* test_fifo
* test_illegal_seek
tests/cat:
* test_dev_full
* test_dev_full_show_all
* test_dev_random
* test_fifo_symlink
tests/dd:
* test_random_73k_test_lazy_fullblock
* test_sync_delayed_reader
tests/factor:
* test_parallel
tests/rm:
* test_rm_force_prompts_order
* test_rm_descend_directory
* test_rm_prompts
tests/seq:
* the helper run method
tests/sort:
* test_sigpipe_panic
tests/tee:
* the helper run_tee method
tests/tty:
* test_tty module
tests/yes:
* the helper run method
2022-12-02 08:06:45 +01:00
Niyaz Nigmatullin
fdd6a05259
chore: run cargo +nightly clippy --fix
2022-11-16 11:09:44 +02:00
Niyaz Nigmatullin
306272bf60
unix_sockets is deprecated, use std::os::unix::net instead
2022-08-20 17:02:29 +03:00
Justin Tracey
2a0d58d060
get android builds to compile and pass tests
2022-04-20 08:44:49 +02:00
Terts Diepraam
18369dc0be
all: use array intoiterator
2022-04-05 10:39:31 +02:00
Daniel Eades
f4c6ea0ee8
remove unnecessary 'to_owned'
2022-01-30 14:01:21 +01:00
Terts Diepraam
2412e4cbf7
add some tests for Clap's InferLongArgs setting
2022-01-29 02:06:32 +01:00
Jan Verbeek
516c5311f7
Close file descriptors of pipes after use ( #2591 )
...
* Close file descriptors of pipes after use
* cat: Test file descriptor exhaustion
* fixup! cat: Test file descriptor exhaustion
2021-08-24 12:00:07 +02:00
Sylvestre Ledru
ee98efd92e
Merge pull request #2552 from miDeb/cat/show-crlf
...
cat: show `\r\n` as `^M$` when `-E` is enabled
2021-08-09 12:23:59 +02:00
Michael Debertol
03ceb6750e
cat: check if the input file is also the output file
2021-08-08 01:32:22 +02:00
Michael Debertol
7229360217
cat: remove all per-file state
...
cat cannot keep per-file state, so move all remaining state (one_blank_kept)
to the global state.
2021-08-07 23:04:25 +02:00
Michael Debertol
5be4c48546
cat: show \r\n as ^M$ when -E is enabled
...
This functionality was recently added to GNU cat, but had a bug.
This implementation will be commpatible with gnu once the bug in gnu is fixed.
2021-08-07 21:18:15 +02:00
Roy Ivy III
0dc8c18bac
tests ~ fix cargo clippy
complaint (clippy::needless_borrow)
2021-06-06 19:28:25 -05:00
Roy Ivy III
3f35e0a421
refactor ~ cargo make format
2021-05-31 08:23:58 -05:00
Roy Ivy III
4e20dedf58
tests ~ refactor/polish spelling (comments, names, and exceptions)
2021-05-31 08:23:57 -05:00
Jan Scheer
3aeccfd802
fix a lot of clippy warnings
2021-05-29 15:11:22 +02:00
Terts Diepraam
ebe6341ae3
chore: replace tempdir with tempfile
2021-05-27 22:47:03 +02:00
Chad Brewbaker
9167a4128d
Update test_cat.rs
...
Refactored to constants
2021-05-19 04:06:46 -05:00
Chad Brewbaker
a69cb11de9
Removing debug code
2021-05-18 15:17:07 -05:00
Chad Brewbaker
c60d3866c3
dev random blocks on linux
2021-05-18 15:10:51 -05:00
Sylvestre Ledru
33206e1adc
Ignore test_domain_socket as it fails too often
2021-05-09 18:42:16 +02:00
Sylvestre Ledru
3ac481e4d3
rustfmt the recent change
2021-04-24 12:46:06 +02:00