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
rethab
b756b987a4
cat: make tests stable ( #2100 )
2021-04-22 08:42:56 +02:00
Árni Dagur
387227087f
cat: Put splice code in separate file, handle more failures ( #2067 )
...
* cat: Refactor splice code, handle more failures
* cat: Add tests for stdout redirected to files
2021-04-21 12:21:31 +02:00
Sylvestre Ledru
879ab2ecb0
Disable test_no_options_big_input on freebsd too ( #2093 )
2021-04-19 11:14:04 +02:00
Sylvestre Ledru
58a2821dce
Also disable on test_three_directories_and_file_and_stdin
2021-04-16 19:44:40 +02:00
Sylvestre Ledru
3aff898acd
Disable test_no_options_big_input on Windows
2021-04-16 18:58:46 +02:00
Árni Dagur
eb4971e6f4
cat: Unrevert splice patch ( #2020 )
...
* cat: Unrevert splice patch
* cat: Add fifo test
* cat: Add tests for error cases
* cat: Add tests for character devices
* wc: Make sure we handle short splice writes
* cat: Fix tests for 1.40.0 compiler
* cat: Run rustfmt on test_cat.rs
* Run 'cargo +1.40.0 update'
2021-04-10 22:19:53 +02:00
Sylvestre Ledru
7750db4f8e
cat: add a trivial test
2021-04-03 16:06:57 +02:00
Sylvestre Ledru
1d271991af
Rustfmt new tests
2021-03-18 10:24:30 +01:00
Sylvestre Ledru
e331186fee
unbreak build with rustc 1.32: force tempfile 3.1.0 ( #1695 )
2021-01-19 08:15:53 +01:00
Sylvestre Ledru
ac34d136f2
refactor(global): Move from tempdir to tempfile:
...
* the crate has been deprecated
2020-06-09 11:30:19 +02:00
Roy Ivy III
de0375f909
tests ~ reorganize tests
2020-06-01 18:30:04 -05:00