Joining7943
2658f8ae5b
tail: improve performance of piped stdin
...
Rewrite handling of stdin when it is piped and read input in chunks.
Fixes https://github.com/uutils/coreutils/issues/3842
2022-09-09 13:51:37 +02:00
Terts Diepraam
ba713b6365
Simplify invalid encoding handling into two small methods of Args
...
The previous encoding handling was unnecessarily complex. This commit removes the enum that specifies the handling and instead has two separate methods to collect the strings either with lossy conversion or by ignoring invalidly encoded strings.
2022-08-17 15:20:20 +02:00
Terts Diepraam
5621502a95
all: remove accept_{any, complete, lossy}
and ConversionResult
...
Outside of tests, only `accept_any` was used, meaning that this unnecessarily complicated the code. The behaviour of `accept_any` is now the default (and only) option.
2022-08-17 14:57:28 +02:00
Daniel Hofstetter
dd19f85d2b
Fix clippy warnings in tests
2022-08-12 09:45:16 +02:00
Sylvestre Ledru
e239ed9417
Merge pull request #3692 from jfinkels/cp-preserve-perm-link
...
cp: correctly copy attributes of a dangling symbolic link
2022-07-11 22:50:24 +02:00
Niyaz Nigmatullin
9d285e953d
Realpath symlinks handling, solves issue #3669 ( #3703 )
2022-07-10 16:49:25 +02:00
Sylvestre Ledru
922afa29ff
Merge branch 'main' into cp-preserve-perm-link
2022-07-07 15:22:57 +02:00
Jeffrey Finkelstein
78a11ad69b
tests/common/util: add AtPath::symlink_exists()
...
Add helper method for deciding whether a symbolic link exists in the
test directory.
2022-07-03 13:44:29 -04:00
Niyaz Nigmatullin
b3642b64c5
test_realpath: reformatted using rustfmt
2022-06-30 11:52:17 +02:00
Niyaz Nigmatullin
1ecc789dea
test_realpath: fixed test to be the one that was supposed to be and
...
added non-passing test
2022-06-30 11:52:17 +02:00
Jan Scheer
12d7d9846a
test/util: improve run_ucmd_as_root
for CICD
...
* ensure that `fn run_no_wait` is only invoked if the system running the
test has `sudo` in $path
Previously, if run inside CICD, calling `fn run_ucmd_as_root`
would provoke `fn run_no_wait` to panic because there's no `sudo`.
2022-05-10 23:41:22 +02:00
Sylvestre Ledru
eaad6c5286
more comment
...
mostly to retrigger the ci :)
2022-05-01 20:15:44 +02:00
Jan Scheer
bab7ba8a52
Update util.rs
2022-05-01 20:15:44 +02:00
Jan Scheer
de01b11a7d
Update util.rs
...
add feature for `whoami`
2022-05-01 20:15:44 +02:00
Jan Scheer
e991838ca8
tests/util: add a convenience wrapper to run a ucmd with root
...
permissions
2022-05-01 20:15:44 +02:00
Justin Tracey
67a01a5d79
preserve LD_PRELOAD in the test env
2022-04-20 08:44:49 +02:00
Justin Tracey
1f025c19af
address libc weirdness on 32 bit android
2022-04-20 08:44:49 +02:00
Justin Tracey
2a0d58d060
get android builds to compile and pass tests
2022-04-20 08:44:49 +02:00
Sylvestre Ledru
991672a030
Adjust rlimit usage with the new version
2022-04-13 11:18:37 +02:00
Jeffrey Finkelstein
7192856da4
tests: print stdout in error msg for no_stdout()
...
Fix a bug in which the error message displayed when using
`CmdResult::no_stdout()` was incorrectly showing stderr when it should
have been showing stdout.
2022-04-09 12:44:24 -04:00
Hanif Ariffin
30a174e6e4
realpath: Error when resolved symlink is absolute and ENOENT ( #3037 )
...
* realpath: Match behavior where resolving symlinks with absolute path is an error if ENOENT
This PR changes `realpath` to match the behavior in GNU where,
```shell
hbina@akarin ~/Documents> mkdir dir1
hbina@akarin ~/Documents> mkdir dir2
hbina@akarin ~/Documents> touch dir2/bar
hbina@akarin ~/Documents> ln -s ../dir2/bar dir1/foo1
hbina@akarin ~/Documents> ln -s /dir2/bar dir1/foo2
hbina@akarin ~/Documents> ln -s ../dir2/baz dir1/foo3
hbina@akarin ~/Documents> realpath ./dir1/foo1 ./dir1/foo2 ./dir1/foo3
/home/hbina/Documents/dir2/bar
realpath: ./dir1/foo2: No such file or directory
/home/hbina/Documents/dir2/baz
```
Currently, our `realpath` will happily print the second one out,
```shell
hbina@akarin ~/Documents> ~/git/uutils/target/debug/coreutils realpath ./dir1/foo1 ./dir1/foo2 ./dir1/foo3
/home/hbina/Documents/dir2/bar
/dir2/bar
/home/hbina/Documents/dir2/baz
```
Closes https://github.com/uutils/coreutils/issues/3036
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-03-03 23:06:15 +01:00
Jeffrey Finkelstein
e598bf0835
tests: add CmdResult::stdout_is_fixture_bytes()
...
Add helper method `CmdResult::stdout_is_fixture_bytes()`, which is
like `stdout_is_fixture()` but compares stdout to the raw bytes of a
given file instead of decoding the contents of the file to a UTF-8
string.
2022-02-15 21:50:48 -05:00
Jeffrey Finkelstein
e6a63a78f6
tests: fix no_stderr check in stderr_only_bytes()
...
Fix a bug in `stderr_only_bytes()` where it was unintentionally
checking `no_stderr()` when it should have been checking
`no_stdout()`.
2022-02-06 18:03:13 -05:00
Daniel Eades
ba45fe312a
use 'Self' and derive 'Default' where possible
2022-01-30 15:08:26 +01:00
Daniel Eades
784f2e2ea1
use semicolons if nothing returned
2022-01-30 15:08:26 +01:00
Daniel Eades
a2d5f06be4
remove needless pass by value
2022-01-30 15:08:26 +01:00
Daniel Eades
191e29f951
simplify some boolean operations
2022-01-30 14:01:21 +01:00
Jeffrey Finkelstein
83f96ec29d
tail: don't error when following non-UTF-8 data
...
Fix a bug where `tail -f` would terminate with an error due to failing
to parse a UTF-8 string from a sequence of bytes read from the
followed file. This commit replaces the call to `BufRead::read_line()`
with a call to `BufRead::read_until()` so that any sequence of bytes
regardless of encoding can be read.
Fixes #1050 .
2022-01-24 21:32:52 -05:00
Terts Diepraam
448b84806f
fix Rust 1.58 clippy lints ( #2874 )
2022-01-16 15:57:33 +01:00
Roy Ivy III
7133efd0a5
tests ~ fix cargo clippy
complaint (clippy::needless_return)
2021-11-19 17:55:02 -06:00
Thomas Queiroz
f43dfa9a61
tests/common: implement CmdResult::usage_error
2021-11-09 16:36:03 -03:00
Thomas Queiroz
0bbc805e43
tests/common: add util_name+bin_path to CmdResult
2021-11-09 16:36:03 -03:00
Thomas Queiroz
ab4573bde9
tests/common: create TestScenario::composite_cmd
...
This is made to call UCommand::new with Some(util_name)
2021-11-09 16:35:38 -03:00
Thomas Queiroz
d4ca4371d7
tests/common: add util_name+bin_path to UCommand
2021-11-09 04:04:56 -03:00
Thomas Queiroz
fc300dda24
tests/common: UCommand::new rename arg to bin_path
...
Merge and remove unecessary `.as_ref()`
2021-11-09 00:12:11 -03:00
Thomas Queiroz
007f1b9f84
uu+tests: use strip_prefix and strip_suffix
2021-10-24 12:23:32 -03:00
Sylvestre Ledru
c43436d50a
Merge pull request #2710 from jfinkels/tests-add-missing-assert-placeholder
...
tests: add template string to assert! statements
2021-10-19 20:53:35 +02:00
Jan Scheer
bfa8a2a068
tests/util: add more wrappers for common file handling tasks
...
truncate, rename, remove, copy, rmdir, etc.
2021-10-19 01:12:12 +02:00
Jeffrey Finkelstein
9e21d26b7c
tests: add template string to assert! statements
...
Add missing "{}" template strings to `assert!()` statements.
2021-10-11 16:51:14 -04:00
Sylvestre Ledru
00de952592
Fix various 'if_then_panic' clippy warnings
2021-10-10 09:57:39 +02:00
Jan Scheer
e9371dc57d
common/util: fix parsing of coreutil version
...
For the CICD on macOS, this fixes:
```
---- common::util::tests::test_check_coreutil_version stdout ----
---- common::util::tests::test_expected_result stdout ----
thread 'common::util::tests::test_expected_result' panicked at
'byte index 4 is out of bounds of `9.0`', tests/common/util.rs:1172:41
```
2021-10-02 00:58:04 +02:00
Jan Verbeek
0a3785bf84
whoami: Run tests on Windows
2021-09-14 14:13:58 +02:00
Sylvestre Ledru
450a3faf9f
Add to the spell ignore list
2021-09-13 12:29:28 +02:00
Jan Scheer
deedb73bcb
tests/common: make call to host_name_for
idempotent
...
This fixes an issue on macOS/bsd where multiple calls
to `host_name_for` each added a prefix 'g'.
The issue led to some tests being skipped because `util_name` was
renamed to e.g. "ggid" instead of "gid".
2021-09-13 12:28:47 +02:00
Jan Verbeek
b4c95d49d8
pwd: Properly resolve logical working directory ( #2604 )
...
* pwd: Properly resolve logical working directory
* fixup! pwd: Properly resolve logical working directory
* fixup! pwd: Properly resolve logical working directory
2021-08-28 22:31:20 +02:00
Roy Ivy III
4da46d93c7
tests ~ fix tests for new execution_phrase!()
and usage phrasing
2021-08-14 14:01:34 +02:00
Jeffrey Finkelstein
2a4c0a867a
tests: better arg names in link helper functions
...
Change the argument names in
* `AtPath::hard_link()`,
* `AtPath::symlink_file()`, and
* `AtPath::symlink_dir()`,
from `src` and `dest` to `original` and `link` to match the arguments of
the corresponding functions from the Rust standard library. For example,
see `std::os::unix::fs::symlink()`.
2021-08-01 19:50:58 -04:00
Sylvestre Ledru
caf984bd55
fix various clippy issues
2021-07-11 11:22:33 +02:00
Jan Scheer
14b348dd4b
tests: fix tests for CICD environment
2021-07-08 11:17:18 +02:00
Jan Scheer
abc59fbe85
tests/common: refactor: use TestScenario instead of util_name for expected_result()
2021-07-07 22:46:16 +02:00