Sylvestre Ledru
a85539f530
Run cargo fmt on the tree
2025-03-24 21:33:12 +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
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
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
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
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
Dorian Peron
86aff6186a
test-utils: Add fails_with_code() function
2025-02-27 14:24:54 +01:00
Daniel Hofstetter
cf08040348
tests: make wait_with_output private
...
and un-deprecate it
2025-02-24 09:26:05 +01:00
Daniel Hofstetter
277a84d521
tests/common/utils.rs: remove deprecated function
2025-02-22 16:21:08 +01:00
sreehari prasad
c2505841e0
Tests: provides easy mount of temp fs ( #7249 )
2025-02-01 19:01:49 +01:00
Daniel Hofstetter
730b404b6e
tests/common/random.rs: adapt to rand API changes
2025-01-30 08:52:42 +01:00
Sylvestre Ledru
9d404e5ee8
clippy: it is more idiomatic to use 'Option<&T>' instead of '&Option<T>'
2024-11-29 08:36:54 +01:00
Etienne Cordonnier
8ab99d4bfe
test(sleep): add test for signal handling
2024-10-25 16:47:40 +02:00
Samuel Tardieu
7332151d1e
tests: do not elide named lifetimes
...
Eliding named lifetimes elicits a warning in Rust 1.83+.
2024-09-06 01:00:41 +02:00
Ben Wiederhake
584d91f8b5
test: fix indentation that fails clippy nightly
...
See also https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
2024-07-18 15:59:37 +02:00
Ben Wiederhake
471f047a64
clippy: simplify code according to nightly 'byte_char_slices' lint
...
https://rust-lang.github.io/rust-clippy/master/index.html#/byte_char_slices
2024-07-18 15:59:36 +02:00
Sylvestre Ledru
c90b69398f
Merge pull request #6382 from BenWiederhake/dev-signal-casing
...
uucore+timeout: accept signals of any casing
2024-07-09 23:18:25 +02:00
Laurent Cheylus
f731b4e779
tests: disable common::util::tests::test_altering_umask on OpenBSD
...
Signed-off-by: Laurent Cheylus <foxy@free.fr>
2024-07-06 22:45:10 +02:00
Ben Wiederhake
8f6eb57856
common: permit signal names of any casing in tests
2024-07-03 04:15:52 +02:00
n4n5
ab67947321
fix clippy tests
2024-06-30 16:27:08 +02:00
Sylvestre Ledru
09e53f3d2d
tests: fix some clippy warnings
2024-05-25 09:06:16 +02:00
sreehari prasad
3c096ee6ac
util: added umask manipulation ( #6404 )
...
Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>
2024-05-19 21:56:41 +02:00
Jadi
19d42c0339
Disabling xattrs function and tests on OpenBSD
...
The test_compare_xattrs test fails on OpenBSD because OpenBSD does
not support xattrs. Disabling this function and its test for
target_os = openbsd resolves the issue.
Fixes #6348
2024-05-05 09:08:35 +03:30
Ulrich Hornung
537941b676
config terminal simulation for specific stdios only
2024-04-23 19:56:17 +02:00
Krysztal112233
a61761f090
util: fix compile failed on Windows.
...
Use `std::path::MAIN_SEPARATOR_STR` instead of `std::path::MAIN_SEPARATOR`
2024-03-23 17:13:07 +08:00
Krysztal112233
6f5dfa3c46
lint: fix unused_imports of util.rs
2024-03-23 17:02:32 +08:00
Krysztal112233
1484d06887
lint: fix clippy::manual_main_separator_str for util.rs on Windows cfg.
2024-03-23 16:56:43 +08:00
Krysztal112233
d21dc125d0
lint: fix clippy::suspicious_open_options of project.
2024-03-23 16:49:35 +08:00
Ulrich Hornung
c62ba559d0
env: support string args by "-S", "-vS" or "--split-strings"
2024-03-19 00:45:05 +01:00
Ulrich Hornung
db142f9449
use std::command::pre_exec() to set limits on child before exec
2024-03-08 20:30:34 +01:00
Daniel Hofstetter
d651063de3
tests/common/util.rs: add cfg(feature = "env")
2024-03-03 15:02:19 +01:00
Ulrich Hornung
d8b3b41850
added configurable terminal size
2024-02-25 21:47:07 +01:00
Ulrich Hornung
a4d5defeef
simulate terminal utility (squash)
2024-02-25 18:15:15 +01:00
Daniel Hofstetter
04ebd863a6
clippy: fix warnings introduced by Rust 1.76
2024-02-08 16:56:01 +01:00
Sylvestre Ledru
238fb776ad
test: add a function to compare the xattr between two files.
...
used by cp & mv (at least)
2024-01-16 13:12:02 +01:00
Samuel Tardieu
05d85618e3
test: use clearer expression for CI testing
...
`bool::is_ok_and()` is available in Rust 1.70.0 and above, which is compatible
with the current MSRV.
2024-01-01 21:04:13 +01:00
Benjamin Bara
616c3f4a7f
util: extend run_ucmd_as_root for stdin/stdout
...
This enables to give path to files (as str) which are then used as either stdin or stdout.
2023-09-24 10:00:10 +02:00
Terts Diepraam
c3f9e19a3b
all: normalize license notice in all *.rs files
2023-08-24 12:21:09 +02:00
Sylvestre Ledru
0b9c829bce
Merge pull request #5182 from sylvestre/clippy_
...
Fix some of the recent clippy warnings
2023-08-21 16:21:02 -04:00
Sylvestre Ledru
bfca6bf70f
Add license headers on all files
2023-08-21 10:49:27 +02:00
Sylvestre Ledru
7c9f4ba92a
Fix some clippy warnings
2023-08-21 08:41:40 +02:00
John Shin
b34e7f7bf6
du: directories have apparent size of 0
2023-06-25 15:56:57 -07:00
Sylvestre Ledru
47e61f064c
Fix a comment in the rustdoc
2023-04-20 23:22:05 +02:00
Daniel Hofstetter
f96f2fae5b
tests: fix unused import "rstest::rstest" warning
2023-03-26 11:53:20 +02:00
Sylvestre Ledru
a4a290caf2
Merge branch 'main' into default-env-for-tests
2023-03-24 20:33:34 +01:00
Miles Liu
81a4e8fb7d
Remove keep_env from the test framework
2023-03-24 14:25:37 +08:00
Terts Diepraam
4dd88680eb
tests: define default env vars for test commands
...
We now run each command with TZ=UTC and LC_ALL=C to ensure consistent
behavior independent from external timezone and locale settings. These
can still be overridden with other values if necessary.
2023-03-23 18:15:05 +01:00
daviddwk
c24194f454
util: fix unnecessary boolean not operations
2023-03-22 17:13:50 +01:00
jfinkels
59d34ce667
Merge branch 'main' into dd-seconds-precision-3
2023-03-19 13:29:14 -04:00
Sylvestre Ledru
d42b4883e1
Fix some simply clippy warnings
...
With:
`cargo +nightly clippy --features unix --allow-dirty --fix -- -W clippy::pedantic`
2023-03-18 14:36:49 +01:00