`default_missing_value` set to `OPT_DATE` (`"date"`)
`num_args(0..=1)` required for `default_missing_value`.
Using function name `test_date_rfc_8601_default`.
The function name `test_date_rfc_8601` is left intact for
compatibility.
Fixes: #4521
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
Open stdin using its file descriptor so that a `dd skip=N` command in
a subshell does not consume all bytes from stdin.
For example, before this commit, multiple instances of `dd` reading
from stdin and appearing in a single command line would incorrectly
result in an empty stdin for each instance of `dd` after the first:
$ printf "abcdef\n" | (dd bs=1 skip=3 count=0 && dd) 2> /dev/null
# incorrectly results in no output
After this commit, the `dd skip=3` process reads three bytes from the
file descriptor referring to stdin without draining the remaining
three bytes when it terminates:
$ printf "abcdef\n" | (dd bs=1 skip=3 count=0 && dd) 2> /dev/null
def
du --time formats a file's timestamp according to the local timezone,
but the test implicitly assumed UTC. This caused it to fail when
running locally in my UTC+1 machine.
$ cargo test --features "du touch" --no-default-features
Failure: https://gist.github.com/eggpi/651e01559b7c59e9457c1b22fe4c0c19
* Move the user and group resolution to the behavior decoding instead of
re-running on every file/directory creation. Simplifies code.
* Update error output to match GNU coreutils.
* Add tests to verify invalid owner and group.
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.
* cp: require preserve only certain attributes
# Conflicts:
# src/uu/cp/src/copydir.rs
# src/uu/cp/src/cp.rs
* tests/cp: preserve all and preserve xattr tests with todos
* tests/cp: rename preserve tests
* tests/cp: add android fail test for preserve=xattr
On Android, this cp with explicit preserve of xattr must fail, because of the limitations of the filesystem setup used on Android.
* cp: verify some metadata in cp preserve tests
# Conflicts:
# tests/by-util/test_cp.rs
* cp: run test_cp_preserve_all in all OS's but only check metadata on linux
* test/cp: don't expect the mode to change in explicit cp preserve
* cp: attributes struct instead of enum for unified required tracking
* cp: refactor preserver and handle_preserve
# Conflicts:
# src/uu/cp/src/cp.rs
* cp: update preserve attr to max
* test/cp: fix the preserve xattr test
Access timestamps appear to be modified only in this test. Running the command directly does not alter the access timestamp.
* cp/test: preserve all and context case
* cp: fix preserve args value source
* test/cp: don't check mtime on freebsd
* test/cp: don't check mtime on macos
* test/cp: fix freebsd deps
* test/cp: support freebsd tests
* cp: simplify try_set_from_string
* cp: parse context attr in preserve in any case to show warning later
* cp: print warnings for attribute errors if not required
* cp: show SELinux warning only once
* cp: show SELinux warning without error
* Revert "cp: show SELinux warning without error"
This reverts commit d130cf0d8c8e28ac2c903413992613241decf879.
* cp: add documentation for preserve components
* cp: simplify try_set_from_string
* cp: EN_US "behavior" spelling for cspell
This introduces an argument preprocessing step for the nice tool in
order to support the legacy nice adjustment syntax (`nice -1 foo`,
`nice --1 foo`, `nice -+1 foo` and so forth).
This is a preprocessing step because the interaction between these
arguments and the existing `nice -n -1` syntax becomes context
dependent, in a way that is currently difficult to capture through
clap.
Signed-off-by: Ed Smith <ed.smith@collabora.com>