Commit graph

2353 commits

Author SHA1 Message Date
Joining7943
71bbebdc76 sleep: Fix whitespace issues. Don't panic when adding durations.
Refactor error propagation and use show_error! instead of USimpleError.
2023-03-07 13:33:49 +01:00
Joining7943
68f75af678 sleep: Fix duration parsing of multiple inputs when duration overflow should saturate and not panic 2023-02-28 08:04:55 +01:00
David Matos
d9a21ff8f0 chmod: allow verbose and quiet flags to be used more than once 2023-02-23 20:21:38 +01:00
Terts Diepraam
3554565c82
Merge pull request #4356 from howjmay/cksum-a
cksum: implement -a
2023-02-23 12:18:21 +01:00
Terts Diepraam
198e948f4a
Merge pull request #4419 from sylvestre/test_invalid_multi_byte_characters
timeout: add a test to verify that it fails as expected
2023-02-23 10:41:59 +01:00
Sylvestre Ledru
41018859bb
Merge pull request #4365 from kylemanna/km/fix-install-directory-chown
install: add missing directory chown
2023-02-22 21:49:22 +01:00
Sylvestre Ledru
74419366fd timeout: add a test to verify that it fails as expected
Follow up of PR #4388
2023-02-22 21:25:23 +01:00
Terts Diepraam
60d2df56de
Merge pull request #4164 from jfinkels/dd-fifo-seek
dd: allow skipping and seeking in FIFOs
2023-02-22 10:38:45 +01:00
Terts Diepraam
6bd42fde6a
Merge pull request #4293 from Joining7943/tests-util-refactor-ucommand-add-run-in-shell
`tests/util`: Small Refactor/Fixes of `UCommand` and add method to run a `UCommand` in a shell platform independently
2023-02-21 22:41:20 +01:00
Guilherme A. de Souza
7d7b9eb49a
Migrate from atty to is-terminal (#4382) 2023-02-21 21:52:18 +01:00
David Matos
dd4299c32e chmod: supress verbose output when not verbose 2023-02-20 22:18:07 +01:00
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