Commit graph

48 commits

Author SHA1 Message Date
Eli Youngs
71c889116e Fix formatting and unused variable checks 2022-01-30 00:33:06 -08:00
Eli Youngs
680e9081fe Don't panic when calling cp -a with a nonexistent file 2022-01-29 22:59:53 -08:00
Terts Diepraam
2412e4cbf7 add some tests for Clap's InferLongArgs setting 2022-01-29 02:06:32 +01:00
Terts Diepraam
f60c36f242
Merge pull request #2610 from miDeb/cp/abuse
cp: handle edge cases when dest is a symlink
2022-01-11 00:34:55 +01:00
Sylvestre Ledru
59da0d8cd6 cp: add a unit test for issue 1665 2021-12-19 18:19:48 +01:00
electricboogie
a1960f5da0
Fix cp bug: pre-write permission change (#2769) 2021-12-15 22:18:02 +01:00
Thomas Queiroz
c9624725ab
tests: use CmdResult::usage_error 2021-11-09 17:37:05 -03:00
Michael Debertol
3fdff304db cp: handle edge cases when dest is a symlink
- Fail if dest is a dangling symlink
- Fail if dest is a symlink that was previously created by the same
invocation of cp
2021-11-01 22:48:48 +01:00
Sylvestre Ledru
cc8522a2db Fixed a warning on freebdsd:
warning: unused import: `std::os::unix::fs::PermissionsExt`
2021-09-12 23:14:34 +02:00
Sylvestre Ledru
9c22def693 cp: ignore test_no_preserve_mode & test_preserve_mode 2021-09-05 18:54:43 +02:00
Michael Debertol
6a6da71403 cp: add a test for #2631 2021-09-03 14:56:35 +02:00
Michael Debertol
8b74562820 cp: correctly copy mode, ownership, acl and context
Fix a mix-up between ownership and mode. The latter (mode / file permissions)
can also be set on windows (which however only affects the read-only flag),
while there doesn't seem to be a straight-forward way to change file ownership
on windows.

Copy the acl as well when copying the mode. This is a non-default feature and can be
enabled with --features feat_acl, because it doesn't seem to work on CI.
It is only available for unix so far.

Copy the SELinux context if possible.
2021-09-01 00:16:22 +02:00
Michael Debertol
5f2335829a refactor ~ revert to single quotes for "Try '{0 --help'"
This is a test expectation for gnu.
2021-08-14 17:22:09 +02:00
Roy Ivy III
4da46d93c7 tests ~ fix tests for new execution_phrase!() and usage phrasing 2021-08-14 14:01:34 +02:00
Michael Debertol
ce1323ce1c cp: do not set the current directory in tests
Setting the current directory in tests affects other tests, even if the
change is reverted after, because tests are run in parallel.

This should fix the flaky cp tests.
2021-08-12 22:42:40 +02:00
Michael Debertol
9fb927aa85 cp: always delete the destination for symlinks 2021-06-19 18:59:57 +02:00
Michael Debertol
12a1c87cb8 cp: improve symlink handling 2021-06-17 22:26:13 +02:00
Hanif Bin Ariffin
23de181171 Added tests for cp --preserve without args
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-16 11:32:15 +08:00
Roy Ivy III
0dc8c18bac tests ~ fix cargo clippy complaint (clippy::needless_borrow) 2021-06-06 19:28:25 -05:00
Michael Debertol
7ffc7d073c cp: test that file descriptors are closed 2021-06-02 19:21:16 +02:00
Michael Debertol
a323e9cda1 cp: show errors in cow on linux 2021-06-01 23:06:38 +02:00
Roy Ivy III
4e20dedf58 tests ~ refactor/polish spelling (comments, names, and exceptions) 2021-05-31 08:23:57 -05:00
Jan Scheer
3aeccfd802 fix a lot of clippy warnings 2021-05-29 15:11:22 +02:00
Matt Blessed
41bea72f23 cp: fix regressed issue with --backup and -b
- add test for regressed issue
2021-05-26 18:29:03 -04:00
Matt Blessed
25ed5eeb0e cp: move option check to uumain and use show_usage_error
- add test for conflicting options `--backup` and `--no-clobber`
2021-05-26 11:10:04 -04:00
Matt Blessed
a8a1ec7faf cp: implement backup control with tests 2021-05-25 23:22:32 -04:00
Nicolas Thery
4bf33e98a8 cp: add --reflink support for macOS
Fixes #1773
2021-04-24 19:26:15 +02:00
Sylvestre Ledru
5f61848a38 fix a build failure with success() 2021-04-24 12:45:55 +02:00
Sylvestre Ledru
9517395839
Merge pull request #2088 from nthery/cp_reflink_never
cp: add support for --reflink=never
2021-04-24 10:07:41 +02:00
Nicolas Thery
1c5f47efaf use CmdResult methods rather than fields 2021-04-23 07:24:47 +02:00
Jan Scheer
646c6cacbc refactor tests (#1982) 2021-04-23 02:28:46 +02:00
Nicolas Thery
f36832c392 cp: add support for --reflink=never
- Passing `never` to `--reflink` does not raise an error anymore.
- Remove `Options::reflink` flag as it was redundant with
  `reflink_mode`.
- Add basic tests for this option.  Does not check that a copy-on-write
  rather than a regular copy was made.
2021-04-18 18:51:59 +02:00
Gilad Naaman
c5d7f63b3c Make CmdResult::code private 2021-04-17 18:50:41 +03:00
Gilad Naaman
81d42aa2b3 Fix some tests to not use CmdResult fields 2021-04-10 23:30:50 +03:00
Mikadore
b8079098f2 fixed panic! formatting 2021-03-31 13:30:06 +02:00
Neculai Balaban
c6927d97c8
cp: add support for -x/--one-file-system (#1840) 2021-03-19 21:15:35 +01:00
Craig Pastro
3ab114f283
cp: Implement --parents & --parent (#1797) 2021-03-12 13:25:15 +01:00
Benjamin Fox
5446ea2abf cp: implement --strip-trailing-slashes 2021-03-09 12:59:26 +02:00
Sylvestre Ledru
6c8af26e7f
fix(cp) - make "cp /dev/null target" work (#1674) 2021-02-11 15:59:20 +01:00
Sylvestre Ledru
a2d6c85e44 test(cp): cp /dev/null target is supposed to work. Add a test 2021-01-02 10:02:51 +01:00
Sylvestre Ledru
5a62dcafaa bug(cp): like gnu/cp, don't show any message when --no-clobber is used
Simple example:
touch bar
rm -rf /tmp/foo
mkdir -p /tmp/foo
cp -pnL -v bar /tmp/foo
echo $?
cp -pnL -v bar /tmp/foo
echo $?

rm -rf /tmp/foo
mkdir -p /tmp/foo
./target/debug/coreutils cp -pnL -v bar /tmp/foo
echo $?
./target/debug/coreutils cp -pnL bar /tmp/foo
echo $?
2020-12-17 20:50:38 +01:00
Sylvestre Ledru
cd97adb39d Minor fixes in the tests 2020-12-13 12:11:42 +01:00
Sylvestre Ledru
c483fa501b feature(cp): also implement --dereference/-L 2020-11-29 20:48:29 +01:00
Sylvestre Ledru
f76a0ec972 feature(cp): implement archive + add missing tests 2020-11-29 20:48:23 +01:00
Roy Ivy III
96092b01fc tests/cp ~ disable intermittent failures on MacOS (includes FixME comments)
- track repair progress at GH:uutils/coreutils/issues/1590
2020-10-16 20:24:57 -05:00
Sylvestre Ledru
2d62097843 feature(cp): Manage -P & -R 2020-06-20 10:49:15 +02:00
Sylvestre Ledru
280fafed8a feature(cp) implement -P/--no-deference 2020-06-20 09:38:39 +02:00
Roy Ivy III
de0375f909 tests ~ reorganize tests 2020-06-01 18:30:04 -05:00
Renamed from tests/test_cp.rs (Browse further)