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.
Improve the display of the total time spent transferring bytes so that
the number of seconds is displayed using the `%g` format specifier as
in `printf`. This matches the behavior of GNU `dd`.
Before this commit, the precision was always set to one digit after
the decimal point. For example,
$ dd count=100000 if=/dev/zero of=/dev/null
100000+0 records in
100000+0 records out
51200000 bytes (51 MB, 49 MiB) copied, 0.2 s, 268.1 MB/s
After this commit, the precision increases dynamically as the duration
decreases. For example,
$ dd count=100000 if=/dev/zero of=/dev/null
100000+0 records in
100000+0 records out
51200000 bytes (51 MB, 49 MiB) copied, 0.1019 s, 507 MB/s
$ dd count=1000 if=/dev/zero of=/dev/null
1000+0 records in
1000+0 records out
512000 bytes (512 kB, 500 KiB) copied, 0.002663 s, 256 MB/s
$ dd count=10 if=/dev/zero of=/dev/null
10+0 records in
10+0 records out
5120 bytes (5.1 kB, 5.0 KiB) copied, 0.000182 s, 5.1 MB/s
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.
Summary of changes in tests/util:
* Introduce global constant TESTS_BINARY holding the path to `coreutils`
* Implement running an arbitrary command in a sh or cmd shell per default.
* Implement std::fmt::Display for UCommand.
* Change usages of UCommand::util_name from &Option<OsStr> to Option<OsStr>
* `UCommand::new_from_tmp`: Use OsStr directly instead of TempDir -> String -> OsStr
* Collect arguments in `UCommand::args` field
* Build environment variables in `UCommand` itself instead of `std::process::Command`
* Move building of std::process:Command from fields in UCommand to own method `build`
* Remove assertions of UCommand::has_run in arg, args and env.
Summary of changes in tests/by-util:
* Remove usages of UCommand::raw. Fix tests to use UCommand::to_string.
* test_test: Adjust test_invalid_utf8_integer_compare to use `UCommand::args`
* test_chmod: run_single_test
* test_pwd: symlinked_env
* test_cp:
Fix the usage of &Option<OsStr> in `test_src_base_dot`
Refactor test_src_base_dot to not use UCommand::new but ts.ucmd() instead
* tests/util: Fix documentation of UCommand::stderr_only and usage_error
* tests/util: Remove trimming from CmdResult::stdout_matches and stdout_does_not_match. Fix tests.
The tests are fixed to match the trailing newline instead of ignoring it.
Prevent a panic in `cp -a` when the target of a hard link already
exists in the target directory structure.
For example,
$ mkdir -p src dest/src
$ touch src/f dest/src/f
$ ln src/f src/link
$ cp -a src dest
The `cp` command now succeeds without error.
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
A short summary of changes:
* Add some basic tests for UChild and the run methods.
* Try more often in a fixed interval to create the tempfile for CapturedOutput.
* Fix drop order of struct fields for better cleanup of temporary files/dirs.
* Mark UChild::wait_with_output and UChild::pipe_in_and_wait_with_output deprecated
* Make CapturedOutput private
* Panic in stdout_all, stdout_all_bytes etc. if output is not captured.
* Rename some methods, refactor, clean up, fix documentation, add try_... methods
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.
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.