Commit graph

2392 commits

Author SHA1 Message Date
Kyle Manna 376f4d90ef install: add tests for invalid owner and group
* 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.
2023-02-18 22:46:12 -06:00
Kyle Manna 7aa7f219a0 install: fix issue #4360 with bad target directory permissions
* Correct bug that set the last directory to the mode the file should
  have been set to.
* Add unit test to verify correct functionality.
2023-02-18 22:32:31 -06: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
Jeffrey Finkelstein c52647a632 dd: add support for skipping in input FIFO
For example, `dd skip=1 if=fifo` will now work.
2023-02-18 21:24:16 +01:00
Jeffrey Finkelstein 9c3f810f97 dd: add support for seeking in output FIFOs
For example, `dd seek=1 of=fifo` will now work.
2023-02-18 21:24:16 +01:00
Yang Hau 678a11dcf2 cksum: Implement option -a
Implement option -a --algorithm.
Move digest to src/uucore/src/lib/features and rename it to hash.

fix lint

fix Cargo.toml
2023-02-18 20:58:53 +08:00
Joining7943 fdf0f96a01 tests/util: Restructure UCommand to run in shell per default. Introduce constant TESTS_BINARY.
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
2023-02-17 17:39:33 +01:00
Joining7943 2b5b0c82c1 tests/util: Bump rlimit version to 0.9.1 to be able to use prlimit on android 2023-02-17 17:39:30 +01:00
Terts Diepraam 9fdce975fd
Merge pull request #4359 from dmatos2012/chmod-multiple-files-error
chmod: change permissions for files present even when there is a missing file
2023-02-17 11:27:32 +01:00
David Matos 946c8d2d4a chmod: change permissions for files present even when there is a missing file 2023-02-16 23:13:06 +01:00
Joining7943 f610f33aa7
tests/util: Don't trim output in CmdResult::stdout_matches and stdout_does_not_match (#4304)
* 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.
2023-02-16 15:33:33 +01:00
Terts Diepraam ff5000d4d0
Merge pull request #4239 from Joining7943/tail-fix-parsing-of-sleep-interval
`tail`: fix argument parsing of sleep interval
2023-02-16 15:14:53 +01:00
Sylvestre Ledru d3fc0e8706
Merge pull request #4314 from cakebaker/comm_total_with_output_delimiter
comm: use delimiter on "total" line
2023-02-16 14:24:02 +01:00
Terts Diepraam df7fe29095
Merge pull request #4339 from howjmay/tr-newline
tr: Remove the extra newline in stderr
2023-02-14 22:58:40 +01:00
Yang Hau ec81a23afc tr: Remove the extra newline in stderr
closes #4301
2023-02-15 02:04:43 +08:00
Joining7943 3a613cbc7f tests/util: Fix path resolution of test executable 2023-02-14 11:22:49 +01:00
Jeffrey Finkelstein c6d9d7f11c Clippy fixes 2023-02-13 21:33:42 -05:00
Joining7943 0ed6a9f882 tail: Fix parsing of sleep interval. Use duration parser from fundu crate.
Activate tests for parsing sleep interval
2023-02-12 20:23:55 +01:00
Daniel Hofstetter a22749ec57 comm: enable "no_arguments" & "one_argument" tests 2023-02-09 10:51:32 +01:00
Daniel Hofstetter ccf999473c comm: use delimiter on "total" line 2023-02-07 09:22:55 +01:00
Sylvestre Ledru efc70ade68
Merge pull request #4260 from sbentmar/expand-fix-perl-failures
expand: improve plus specifier handling
2023-01-28 18:15:08 +01:00
Sylvestre Ledru d8c3205d4c
Merge pull request #4300 from cakebaker/comm_total
comm: implement --total
2023-01-28 18:14:17 +01:00
Joining7943 c809bb3888 tests/tail: Disable test_follow_with_pid on freebsd because of intermittent failures in the ci 2023-01-28 13:02:33 +01:00
Sebastian Bentmar Holgersson 1bf723fe40 expand: fix formatting issues and cleanup 2023-01-27 21:08:16 +01:00
Sebastian Bentmar Holgersson 69d8729598 expand: replace while loop with constant time algorithm 2023-01-27 21:08:16 +01:00
Sebastian Bentmar Holgersson ddc6fabca0 expand: all perl tests passing 2023-01-27 21:08:16 +01:00
Sebastian Bentmar Holgersson cbab8677e6 expand: improve handing of + 2023-01-27 21:08:16 +01:00
Daniel Hofstetter f6b646e4e5 clippy: fix warnings introduced with Rust 1.67.0 2023-01-27 17:37:56 +01:00
Terts Diepraam fc7e51a4f8
Merge pull request #4261 from Joining7943/tests-util-enhance-cmdresult
`tests/util`: Implement enhancements of `CmdResult` #4259
2023-01-25 10:06:32 +01:00
Daniel Hofstetter b06485990d comm: implement --total 2023-01-24 16:49:43 +01:00
Terts Diepraam 8c35465e03
Merge pull request #4265 from sylvestre/add_test_test
test: add a test matching what busybox is doing
2023-01-22 23:42:54 +01:00
Sylvestre Ledru 6f95f0953b
Merge pull request #4271 from eds-collabora/eds/nice
Support legacy argument syntax for nice
2023-01-22 20:57:08 +01:00
Joining7943 78a381032b tests/util: Improve assertion messages of CmdResult::stderr_is_bytes, stdout_is_bytes 2023-01-22 14:56:19 +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 7c0ed0340b tests/util: Add stdout_check, stdout_str_check ... to CmdResult to run arbitrary assertions 2023-01-22 14:56:19 +01:00
Joining7943 c2ad54fe09 tests/util: Add methods in CmdResult to assert the received signal on unix systems
Add tests for these signal methods. Include `signals` feature in Cargo.toml uucore dev-dependencies.
2023-01-22 14:56:19 +01:00
Joining7943 19db042022 tests/util: Use ExitStatus instead of code, success in CmdResult. Rewrite tests for CmdResult 2023-01-22 14:48:23 +01:00
Joining7943 37e06edadc tests/util: Introduce CmdResult::stdout_str_apply ... to preprocess stdout, stderr before asserting 2023-01-22 14:48:23 +01:00
Emil Suleymanov 50c1833c11
cp: require preserve only certain attributes (#4099)
* 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
2023-01-19 13:02:06 +01:00
Ed Smith 8aa9f346ef Support legacy argument syntax for nice
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>
2023-01-18 11:44:41 +01:00
Sylvestre Ledru 8c137f5d7c
Merge pull request #4278 from cakebaker/sum
sum: fix output when using BSD sum algo (-r)
2023-01-18 11:33:41 +01:00
Sylvestre Ledru afbe850115
Merge pull request #4279 from rivy/up.uname
change/uname ~ update and revise
2023-01-18 11:33:29 +01:00
Roy Ivy III b4e3e66236 test/uname ~ test for invisible characters in output (ie, NULs) 2023-01-14 22:16:41 -06:00
Roy Ivy III cfdbaca6c1 test/uname ~ update tests for expected platform-v1.0.2 outputs 2023-01-14 22:16:41 -06:00
Roy Ivy III d78e1e7399 tests: revise/standardize usage error testing (for dd, install, mktemp, rm, seq, and touch) 2023-01-13 22:14:48 -06:00
Daniel Hofstetter 747bc2513e sum: fix output when using BSD sum algo (-r) 2023-01-13 10:05:09 +01:00
Sylvestre Ledru 6a9660f9f6
Merge pull request #4268 from rivy/fix.sleep
Fix `sleep` argument parsing and errors
2023-01-12 18:41:04 +01:00
Roy Ivy III f8b545d6f8 test/sleep: add and refine sleep test cases 2023-01-08 12:10:32 -06:00
Sylvestre Ledru b9e972094b test: add a test matching what busybox is doing 2023-01-07 09:50:50 +01:00
Joining7943 463c58afd0 tests/tail: Remove redundant set_stdin(Stdio::null()) 2023-01-03 16:30:12 +01:00
Joining7943 9b35c5d5c1 tests/util: Use Stdio::null as default in UCommand for Child stdin instead of Stdio::piped 2023-01-03 16:30:08 +01:00
Terts Diepraam 44ea43f058 tests: remove status_code, which is the same as code_is 2023-01-01 17:25:59 +01:00
Terts Diepraam 267a22e12c add track_caller attribute to assertion functions 2023-01-01 15:25:37 +01:00
Terts Diepraam 36f3507bed
Merge pull request #4232 from TechHara/whitespace
cut: add whitespace option for separating fields
2023-01-01 12:58:28 +01:00
Sylvestre Ledru a3c76678fe
Merge pull request #4247 from tertsdiepraam/rm/add-fifo-test
rm: add test for #4246
2022-12-30 12:09:53 +01:00
Roy Ivy III 737271de96 test/expr: add regex tests 2022-12-29 23:22:13 -06:00
Roy Ivy III 812d811ff6 test/expr: add simple value and EXIT_CODE tests 2022-12-29 22:49:02 -06:00
Roy Ivy III be37e033be test/expr: add more index testing of unicode strings 2022-12-29 22:49:02 -06:00
Roy Ivy III 8e7dbb0bf6 test/expr: add 'index' operator tests 2022-12-29 22:48:55 -06:00
Terts Diepraam ea8085e2ca rm: add test for #4246 2022-12-29 16:15:41 +01:00
jaggededgedjustice b8a755a396
date: Catch panic from invalid format string (#4240)
* Catch panic from invalid date string
2022-12-25 21:11:34 +01:00
Terts Diepraam bdd6f56ae4
Merge pull request #4231 from Joining7943/add-timeout-in-tests
`tests/common/util`: Add possibility to set timeout for UCommand and UChild. Add `rstest` with timeout macro to dev dependencies
2022-12-23 01:12:57 +01:00
TechHara c29839f4f9 Merge branch 'main' into whitespace 2022-12-18 09:07:03 -05:00
Joining7943 09c04d9f3f tests: Set timeout for tests which would fail with the default timeout in test_factor, test_sort 2022-12-17 21:55:01 +01:00
Joining7943 1d7447d42e tests/util: Add setting timeout for UChild::kill and run and wait methods in UCommand and UChild.
Additional notes:
* Set default timeout to 30s
* Fix UChild::kill to always fail on timeout if zero
2022-12-17 21:53:39 +01:00
Sylvestre Ledru 8489e9b69c Ignore some cp tests on android
Closes: #4233
2022-12-17 16:54:23 +01:00
TechHara bae78e62e0
Merge branch 'main' into whitespace 2022-12-15 22:23:03 -05:00
Sylvestre Ledru c5728a61b4
fix some clippy warnings (#4229)
* fix some clippy warnings

* Fix the last two
2022-12-14 15:42:07 +01:00
Terts Diepraam e4bed1c087
Merge pull request #4135 from Joining7943/refactor-tail-check-warnings
`tail`: Refactor handling of warnings and early exits
2022-12-14 13:21:54 +01:00
TechHara 9798ae7987 fix clippy complaint 2022-12-13 20:34:01 -05:00
TechHara 11e64958d6 add test cases to cover cut -w failing options 2022-12-13 11:43:20 -05:00
Joining7943 b339f6d80c tests/tail: Add all additional tests written during refactoring tail from tip of refactoring branch
Other changes summmary:
* Use module level imports instead of fully qualified imports where appropriate
* Fix intermittent failing test_positive_zero_bytes because of broken pipe
* Cleanup old disabled test for warning of following indefinitely
2022-12-13 16:16:14 +01:00
Joining7943 d57545d09c tail: Refactor: Handle warnings and early exits in one place. Remove InputService ...
Other changes summary:
* Cleanup imports
* Remove stdin_is_pipe_of_fifo function
* Rename WatcherService to Observer
2022-12-13 16:16:08 +01:00
Terts Diepraam 7555527d07
Merge pull request #4225 from Joining7943/4223-fix-intermittent-test-failures
tests/util: Fix #4223: intermittent failing uchild tests
2022-12-13 11:40:11 +01:00
TechHara 6516519af3 Merge branch 'main' into whitespace 2022-12-12 22:07:05 -05:00
Sylvestre Ledru f9c0ca4383
Merge pull request #4184 from jfinkels/cp-verbose
cp: correct --verbose --parents output for both files and directories
2022-12-12 21:31:15 +01:00
TechHara f6a0abaee3 add whitespace delimiter option 2022-12-12 12:00:57 -05:00
Joining7943 7ef9504952 tests/util: Fix intermittent failing uchild tests on macos. The ci can be slow, so increase delay.
Closes #4223
2022-12-12 12:52:10 +01:00
Kai M 42b9b7b62c
install: fix issue #3814 (#3950)
* install: fix installing one file when using -Dt options

* install: fix installing multiple files with -Dt

Code was missing the logic to create the target dir when multiple files
should be copied and target dir is given by -t option.
This simplifies the copy logic also when only one file should be copied
to the target dir.

* install: fix verbose output when using -D

Also adds a unit test to verify the same behaviour as the gnu tools.

* install: add more testcases for create leading dir

Tests various combinations of "-D" with and w/o "-t" when installing
either a single file or multiple files into a non existing directory.

  install -D file1 file2 (-t) not_existing_dir
  install -D file1 (-t) not_existing_dir/

Also fixes file formatting, spelling and adds some more test asserts.

* install: fix error for nonex. dir path ending on /

The install command failed with a different error message than the
original GNU install tool. Checking for a trailing slash fixes this.
Only works on unix though.

* install: add windows support when checking for '/'

* install.rs: fix spelling

* install.rs: add more tests regarding omitting dir

This increases the CI test coverage and also checks for more corner
cases to ensure uu_install is compliant with GNU's original.

    export C=coreutils/target/debug/

    rm -rf dir1 no-dir2 dir3 file
    mkdir -p dir1 dir3
    touch file

    ${C}install dir1/file1 dir1/.. no-dir2
    ${C}install dir1/file1 dir1/.. dir3
    ${C}install dir1/.. dir3

* install: improve test_install_missing_arguments

Also check that install returns the correct error messages, when only a
target directory is given via -t and that is is not created (-D option).

* install: rework the checks for missing file args

This ensures correct (GNU install like) behavior. Tests from the last
commit will pass now.
2022-12-06 09:11:23 +01:00
Jeffrey Finkelstein 1a839fb2c4 cp: correct --verbose --parents output for dirs
This commit corrects the behavior of `cp -r --parents --verbose` when
the source path is a directory, so that it prints the copied ancestor
directories. For example,

    $ mkdir -p a/b/c d
    $ cp -r --verbose --parents a/b/c d
    a -> d/a
    a/b -> d/a/b
    'a/b/c' -> 'd/a/b/c'
2022-12-05 21:37:13 -05:00
Jeffrey Finkelstein bd665ea44a cp: correct --verbose --parents output for files
This commit corrects the behavior of `cp --parents --verbose` when the
source path is a file so that it prints the copied ancestor
directories. For example,

    $ mkdir -p a/b d
    $ touch a/b/c
    $ cp --verbose --parents a/b/c d
    a -> d/a
    a/b -> d/a/b
    'a/b/c' -> 'd/a/b/c'

Fixes #3332.
2022-12-05 21:36:56 -05:00
Sylvestre Ledru b7925465a8 factor: trim the input to fix some busybox results 2022-12-05 22:49:48 +01:00
Jeffrey Finkelstein 682667fd1d cp: force link between two files that exist
Allow `cp` to link files that exist. For example,

    $ touch src dest
    $ cp -f --link src dest

Before this commit, an error was raised.
2022-12-04 19:36:05 -05:00
Jeffrey Finkelstein bf54fce055 tests: skip inode check on BSD 2022-12-03 23:50:39 -05:00
Jeffrey Finkelstein 3a5b31a30f dd: correct rendering of SI and IEC byte counts
Adjust the rendering of the concise byte counts in both SI and IEC
units to better match the behavior of GNU dd.

Before this commit,

    $ head -c 1024 /dev/zero | dd > /dev/null
    2+0 records in
    2+0 records out
    1024 bytes (1 KB, 1024 B) copied, 0.0 s, 1.0 MB/s

After this commit,

    $ head -c 1024 /dev/zero | dd > /dev/null
    2+0 records in
    2+0 records out
    1024 bytes (1.0 kB, 1.0 KiB) copied, 0.0 s, 1.0 MB/s

For comparison, GNU dd produces the following:

    $ head -c 1024 /dev/zero | dd > /dev/null
    2+0 records in
    2+0 records out
    1024 bytes (1.0 kB, 1.0 KiB) copied, 0.000332864 s, 3.1 MB/s
2022-12-03 10:14:00 -05:00
Sylvestre Ledru 75502aba93
Merge pull request #4136 from Joining7943/tail-test-runner
`tests/common/util`: Implement UChild, an abstraction for std::process::Child, to return UChild from run_no_wait instead
2022-12-03 10:18:25 +01:00
Sylvestre Ledru 818012e30b
Merge pull request #4193 from jfinkels/touch-relative-time
touch: add support for some relative times
2022-12-03 10:16:21 +01:00
Jeffrey Finkelstein 66ee373373 cp: preserve hard links when target already exists
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.
2022-12-02 23:50:18 -05: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 4f54eedb74 tests/util: Improve UChild. Cleanup redundant functions in util.rs.
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
2022-12-02 08:06:48 +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
Joining7943 040a5e8301 tests/util: Implement UChild. UCommand: implement stderr_to_stdout, capture output as default
See pr #4136 (https://github.com/uutils/coreutils/pull/4136)
2022-12-02 08:05:05 +01:00
Joining7943 9b446bf261 tests/tail: Fix clippy warning same-item-push. Do not push same flag twice. 2022-12-02 08:05:05 +01:00
Daniel Hofstetter 9a2174ba02 chore: standardize creation of empty strings 2022-12-01 13:49:23 +01:00
Jeffrey Finkelstein 9632db4f86 dd: correctly set file size when conv=sparse
Before this commit, if `sparsefile` were a regular file of non-zero
size whose contents are all null bytes, then

    dd if=sparsefile of=outfile conv=notrunc

would have resulted in `outfile` having zero size as reported by
`stat`. After this commit, `outfile` will have the same size as
`sparsefile` (even if the contents are represented sparsely by the
filesystem).
2022-11-29 22:53:18 +01:00
Jeffrey Finkelstein a396ebd883 touch: add support for some relative times
For example,

    $ touch -d +1 days

Fixes #3964.
2022-11-29 22:53:13 +01:00
Sylvestre Ledru 27958a27ef
Merge pull request #4159 from sylvestre/issue_3780
date: add a test for the issue 3780 to make sure we don't regress
2022-11-27 18:24:07 +01:00
Miles Liu 3896aa31be
cp: fix cp --force --backup f f fails on macOS 2022-11-20 18:14:42 +08:00
Jeffrey Finkelstein 903ad1656d dd: move tests of slow reader to test_dd.rs
Move some tests that simulate a slow reader from `dd.rs` to
`tests/by-util/test_dd.rs`, and employ a FIFO and `sleep()` to
simulate the slow reader instead of a custom struct that implements
`Read`. This change restricts the type of `Input`s the
`Output::dd_out()` function can accept, facilitating a future change
to make `Input` an enum.
2022-11-19 09:27:23 -05:00
Terts Diepraam 1b35e467ac
Merge pull request #4137 from jfinkels/dd-bytes-suffix
dd: allow B as a suffix for count, seek, and skip
2022-11-19 12:23:43 +01:00