Commit graph

73 commits

Author SHA1 Message Date
Daniel Hofstetter
29e5d0b42b clippy: fix redundant_clone lint warnings in tests 2024-04-21 01:26:50 +02:00
Ulrich Hornung
7cd754eb1f
Fix install: invalid link at destination
also remove some FixMEs for FreeBsd
2024-03-11 23:31:26 +01:00
Ulrich Hornung
dc533a915a
install: fix strip program stdout and destination hyphen handling #5718 (#5848)
* Fix missing dependency to "process" to make it compile.

* fix issue of not forwarding stdout from strip program

* fix issue of applying "./" redundantly

* cargo fmt
2024-01-17 10:07:34 +01:00
Sylvestre Ledru
d82ee771aa install: Add a test to cover recent changes 2023-12-28 16:34:09 +01:00
Matei Mantu
bf26eda786
install: remove / from end of path if it exists so as not to mess with .exists() (#5730)
* remove / from end of path if it exists so as not to mess with .exists()

* install: fix / removal from path

* Fix clippy warnings

* Add test for install target ends with /
2023-12-27 13:37:17 +01:00
Sylvestre Ledru
0220353c4c
test_install.rs: Remove a debug artifact 2023-12-24 15:26:38 +01:00
Daniel Hofstetter
be822009f0
Merge pull request #5686 from sylvestre/install-basic
install: with -t, check if we aren't passed a file
2023-12-23 15:33:45 +01:00
Sylvestre Ledru
2832694056
install: support when a hyphen is passed (#5697)
* install: support when a hyphen is passed

Should fix: tests/install/strip-program.sh

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-12-23 15:29:32 +01:00
Sylvestre Ledru
9ca7c3e107 install: with -t, check if we aren't passed a file
Should pass tests/install/basic-1
2023-12-22 18:16:23 +01:00
Sylvestre Ledru
bfca6bf70f Add license headers on all files 2023-08-21 10:49:27 +02:00
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