Commit graph

63 commits

Author SHA1 Message Date
Daniel Hofstetter
29f011e28c Remove users crate 2023-06-04 14:55:16 +02:00
Daniel Hofstetter
6988eb7ec6 tests: expand wildcard imports 2023-03-20 15:32:35 +01:00
Sylvestre Ledru
49eb9a2e91
Merge branch 'main' into cp-pathbuf 2023-03-05 16:22:21 +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
Thayne McCombs
17f9507e17 Add tests for non-utf8 2023-02-21 22:58:39 -07: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
Daniel Hofstetter
f6b646e4e5 clippy: fix warnings introduced with Rust 1.67.0 2023-01-27 17:37:56 +01: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
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
Sylvestre Ledru
6e14dea73b Fix some clippy warnings
Fixed with `cargo clippy --features unix  --fix`
and manually
2022-10-13 09:07:22 +02:00
Terts Diepraam
9177cb7b24 all: add tests for usage error exit code 2022-09-10 20:59:42 +02:00
Jeffrey Finkelstein
8458bf1387 Clippy fixes in multiple crates 2022-08-23 18:30:43 -04:00
Sylvestre Ledru
2fb743b72a
Merge pull request #3663 from niyaznigmatullin/fix_install_C_test
Fix install c test
2022-06-23 17:09:02 +02:00
Niyaz Nigmatullin
ba136ba3fb tests: add tests for install to check -C option usage 2022-06-22 21:30:59 +03:00
Elijah Sink
81c45cde47 tests/install: fix mistakes when adding previous 2022-06-20 17:31:10 -05:00
Elijah Sink
2965581847 tests/install: add failing test for #3650 2022-06-20 14:26:46 -05:00
Justin Tracey
2a0d58d060 get android builds to compile and pass tests 2022-04-20 08:44:49 +02:00
Sylvestre Ledru
7910eca71b install: verbose - list all created directories
$ install -Dv source_file1 sub3/a/b/c/file
install: creating directory 'sub3'
install: creating directory 'sub3/a'
install: creating directory 'sub3/a/b'
install: creating directory 'sub3/a/b/c'
'source_file1' -> 'sub3/a/b/c/file'
2022-04-18 22:06:02 +02:00
Sylvestre Ledru
6da73e6a6d install: When install --strip-program=foor fails, remove the target file
Should fix:
tests/install/strip-program.sh
2022-04-17 22:24:44 +02:00
Sylvestre Ledru
74a348161e install: add tests to test with multiple directories
to please @calixteman
2022-04-03 16:47:06 +02:00
Sylvestre Ledru
2628f3ed60 install: support of -d dir/. to match GNU's 2022-04-03 16:47:06 +02:00
Sylvestre Ledru
ba83e5e901 use assert_eq instead of x == y. Better output in case of error 2022-03-23 10:41:31 +01:00
ndd7xv
47be40afae install: add tests for error handling 2022-02-25 21:17:43 -05:00
Terts Diepraam
184b65df20 uucore: allow backup suffix with hyphen value 2022-01-31 12:10:57 +01:00
Terts Diepraam
89112fb1c2 install: clap 3 2022-01-11 19:16:47 +01:00
Sylvestre Ledru
2c3e401b0b Remove some warnings on freebsd 2021-08-28 15:06:44 +02:00
Sylvestre Ledru
697dca25cb silent the failed tests for now on freebsd 2021-08-24 09:32:27 +02:00
Andreas Hartmann
69e8838b27 tests: install: Add tests for '--backup'
Tests the '--backup' option for the install utility. Most of the code is
adapted from the respective tests for 'mv'.
2021-06-27 09:55:10 +02:00
Michael Debertol
4e62c9db71 install: support target-directory 2021-06-18 16:45:36 +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
Yağız can Değirmenci
12f207a6d6 test: fix tests 2021-05-26 03:21:53 +03:00
Yağız can Değirmenci
071899d24d tests: delete 'error:' prefix from the tests 2021-05-26 02:45:53 +03:00
Jan Scheer
646c6cacbc refactor tests (#1982) 2021-04-23 02:28:46 +02:00
Sivachandran
0ea35f3fbc
Implement install create leading components(-D) option (#2092)
* Implement install's create leading components(-D) option

* Format changes

* Add install test to check fail on long dir name
2021-04-19 22:03:13 +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
Sivachandran
ee070028e4
install: implement stripping symbol table (#2047) 2021-04-10 11:53:29 +02:00
Juliana Rodrigueiro
97da14fcb2 install: Fix behaviour of the -d flag
The '-d' flag should create all ancestors (or components) of a
directory regardless of the presence of the "-D" flag.

From the man page:
       -d, --directory
              treat all arguments as directory names; create all components of the specified directories

With GNU:
    $ install -v -d dir1/di2
    install: creating directory 'dir1'
    install: creating directory 'dir1/di2'
With this version:
    $ ./target/release/install -v -d dir3/di4
    install: dir3/di4: No such file or directory (os error 2)
    install: dir3/di4: chmod failed with error No such file or directory (os error 2)
    install: created directory 'dir3/di4'

Also, one of the unit tests misinterprets what a "component" is,
and hence was fixed.
2021-04-02 20:04:25 +01:00
Antonio Gurgel
a655117a5f
std:🧵:sleep needs target_os
Co-authored-by: Sylvestre Ledru <sledru@mozilla.com>
2021-03-28 00:42:25 -07:00
Antonio Gurgel
ebb4568d52 Forgot to unignore the test 2021-03-27 22:46:57 -07:00
Antonio Gurgel
01eb913c05 test_install: Add sleeps
To ensure timestamps don't match. Fixes #1927.
2021-03-27 19:37:58 -07:00
Sylvestre Ledru
e9ffaf87ea ignore test_install_copy_then_compare_file_with_extra_mode
see https://github.com/uutils/coreutils/issues/1927
2021-03-27 10:47:28 +01:00
Sylvestre Ledru
75700677ca fix(install): improve the error output when the test is failing 2021-03-27 10:08:42 +01:00
Antonio Gurgel
35675fdfe7
install: implement -C / --compare (#1811)
* install: implement `-C` / `--compare`

GNU coreutils [1] checks the following: whether
- either file is nonexistent,
- there's a sticky bit or set[ug]id bit in play,
- either file isn't a regular file,
- the sizes of both files mismatch,
- the destination file's owner differs from intended, or
- the contents of both files mismatch.

[1] https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/install.c?h=v8.32#n174

* Add test: non-regular files

* Forgot a #[test]

* Give up on non-regular file test

* `cargo fmt` install.rs
2021-03-27 09:18:47 +01:00
Neculai Balaban
220ca78c9b install: normalize test filenames 2021-03-20 20:42:47 +02:00
Neculai Balaban
9b0eee9066 install: added additional tests 2021-03-20 20:07:19 +02:00
Neculai Balaban
ecddaf577a install: rustfmt test 2021-03-20 15:44:41 +02:00
Dominik Bittner
7a91281976 Install: remove path when copining files
- add a test for copying a file from one directory to another
- add the desired behavior

Fixes #1823
2021-03-20 15:35:40 +02:00