Commit graph

5487 commits

Author SHA1 Message Date
Jan Scheer
d57f474ae1
test_whoami: refactor use expected_result and whoami from common/util.rs 2021-07-08 00:21:28 +02:00
Jan Scheer
abc59fbe85
tests/common: refactor: use TestScenario instead of util_name for expected_result() 2021-07-07 22:46:16 +02:00
Jan Scheer
31aa8b2062
test_du: refactor use expected_result from common/util.rs 2021-07-07 22:09:01 +02:00
Jan Scheer
735ec4014e
test_who: refactor use expected_result from common/util.rs 2021-07-07 17:26:59 +02:00
Jan Scheer
805e024794
test_stat: refactor use expected_result from common/util.rs 2021-07-07 15:54:03 +02:00
Jan Scheer
90de4257b1
test_pinky: refactor use expected_result from common/util.rs 2021-07-07 15:53:46 +02:00
Jan Scheer
c2bd7ae9b1
test_id: refactor use expected_result from common/util.rs 2021-07-07 15:53:26 +02:00
Jan Scheer
9631d8cf2b
test_groups: refactor use expected_result from common/util.rs 2021-07-07 15:52:56 +02:00
Sylvestre Ledru
cea0fc844a
Merge pull request #2476 from siebenHeaven/du_uresult
du: Use UResult
2021-07-07 15:44:11 +02:00
Sylvestre Ledru
df683f8c84
Merge pull request #2465 from miDeb/install-test
[: install test as [ as well
2021-07-07 15:43:38 +02:00
Jan Scheer
c447863c8d
tests/common: refactor to reduce duplicate code
* move fn expected_result to common/util.rs
* move fn check_coreutil_version to common/util.rs
* move fn whoami to common/util.rs
* move macro unwrap_or_return to common/macros.rs
* add documentation
* add tests
2021-07-07 14:59:14 +02:00
Sylvestre Ledru
7018ff8925
Merge pull request #2477 from dhodder/uname_target_env
uname: don't report OS as "GNU/Linux" without GNU
2021-07-07 08:46:50 +02:00
Dave Hodder
7a62d8e4e7 uname: add NetBSD to operating systems list 2021-07-06 23:42:16 +01:00
Dave Hodder
330f797378 tests/uname: add --operating-system test 2021-07-06 23:40:38 +01:00
Andreas Hartmann
f64b708410 test: du: Skip nondynamic comparison on linux for test_du_bytes
The `test_du_bytes` testcase for the `du --bytes` command is written to perform
a dynamic comparison on linux hosts, i.e. it compares the output of the command
to that of the hosts `du` from the GNU coreutils.

Previously the test was written such that it would *first* perform the dynamic
comparison, and *after that* continue to a static comparison which may fail for
specific hosts that have a filesystem different from what the test expects.

This patch excludes linux hosts from the static comparison to ensure the test
performs only the dynamic comparison.
2021-07-06 19:45:06 +02:00
Sylvestre Ledru
9ad70a4f5d
Merge pull request #2480 from miDeb/sort/key-args
sort: make -k only take one argument per flag
2021-07-06 18:58:50 +02:00
Sylvestre Ledru
2a6fe0fd3b
Merge pull request #2479 from sylvestre/clip2
Fix some clippy warnings
2021-07-06 18:35:51 +02:00
Michael Debertol
8ace291b32 sort: make -k only take one argument per flag
This makes it so that `sort -k 1 file` treats `file` as the input file
and not the second key.
2021-07-06 15:47:32 +02:00
Michael Debertol
bc0727cc4d [: add support for --help and --version
I copied the help text verbatim from GNU, I hope that's ok.
2021-07-06 13:15:07 +02:00
Sylvestre Ledru
d5b2320a59 Fix clippy warning
Useless use of format
2021-07-06 12:44:33 +02:00
Sylvestre Ledru
16a5faf886 Silent buggy clippy warnings 2021-07-06 12:12:36 +02:00
Sylvestre Ledru
54b389fd1a
Merge pull request #2472 from 353fc443/hostname-uresult
Added UResult for hostname, hostid and dirname
2021-07-06 11:41:56 +02:00
Terts Diepraam
e253fb89db Merge branch 'master' into hostname-uresult 2021-07-06 11:21:42 +02:00
Dave Hodder
c74b77aec8 uname: don't report OS as "GNU/Linux" without GNU
The `uname` `-o` switch reports the operating system used. If the GNU C
standard library (glibc) is not in use, for example if musl is being
used instead, report "Linux" instead of "GNU/Linux".
2021-07-05 22:42:42 +01:00
Andreas Hartmann
9d94307880 mv: Adapt for new backup_control utilities 2021-07-05 12:44:44 +02:00
Andreas Hartmann
a783d05101 backup_control: Add module tests
Adds a tests submodule that performs tests on the
`determine_backup_mode` function to ensure it handles backup options
like specified by [GNU][1].

[1]: https://www.gnu.org/software/coreutils/manual/html_node/Backup-options.html
2021-07-05 12:44:44 +02:00
Andreas Hartmann
89c6d32a20 backup_control: Refactor backup mode determination
Refactor the function that determines which backup mode to select based
on user input. It now complies with what the [GNU manual][1] specifies.

[1]: https://www.gnu.org/software/coreutils/manual/html_node/Backup-options.html
2021-07-05 12:44:40 +02:00
Andreas Hartmann
1309757d4d backup_control: Make utility functions private 2021-07-05 12:43:28 +02:00
Andreas Hartmann
fa0b4861b9 backup_control: Match abbreviated backup options
Add a function that takes a user-supplied backup option and checks if it
matches any of the valid backup options. This is because GNU allows to
abbreviate backup options, as long as they are valid and unambiguous.

In case a backup option is either invalid or ambiguous, an error type is
returned that contains a formatted error string for output to the user.
2021-07-05 12:43:28 +02:00
Andreas Hartmann
3b8f135842 backup_control: Add backup help string from GNU utils
The previous help string for the backup subroutines didn't comply with
the formatting found in the `--help` output of e.g. `mv` or `ln`.

Use the exact help string from these utilities instead.
2021-07-05 12:43:28 +02:00
Sylvestre Ledru
41d289377b
Merge pull request #2475 from sylvestre/clip
silent buggy clippy warning
2021-07-04 20:15:40 +02:00
Anup Mahindre
a9ba4c6d9f du: Use UResult 2021-07-04 22:44:25 +05:30
Sylvestre Ledru
f2e12fee0a Silent buggy clippy warnings
Fails with:
```
error: use of irregular braces for `write!` macro
  --> src/uucore/src/lib/features/encoding.rs:19:17
   |
19 | #[derive(Debug, Error)]
   |                 ^^^^^
   |
   = note: `-D clippy::nonstandard-macro-braces` implied by `-D warnings`
help: consider writing `Error`
  --> src/uucore/src/lib/features/encoding.rs:19:17
   |
19 | #[derive(Debug, Error)]
   |                 ^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonstandard_macro_braces
   = note: this error originates in the derive macro `Error` (in Nightly builds, run with -Z macro-backtrace for more info)
```
2021-07-04 19:06:37 +02:00
Sylvestre Ledru
1136221f6f rustfmt the recent change 2021-07-04 13:01:31 +02:00
353fc443
d0805605e0
imported UUsageError 2021-07-04 16:09:55 +05:30
Sylvestre Ledru
38c0880989
fix the clippy warning 2021-07-04 12:03:36 +02:00
Sylvestre Ledru
e4204fcf07
Merge pull request #2436 from hbina/hbina-ls-refactor-options-module
ls: Refactored options and other long constants to fix formatting
2021-07-04 11:59:06 +02:00
Sylvestre Ledru
aa79e7a8c2
Merge pull request #2342 from Mikadore/master
Test `head` being able to work on invalid utf8
2021-07-04 11:58:10 +02:00
Sylvestre Ledru
ae1935c3cb
Merge branch 'master' into master 2021-07-04 11:57:59 +02:00
Sylvestre Ledru
ec1a301c56
Merge pull request #2473 from tertsdiepraam/usage-error
uucore: add usage errors
2021-07-04 11:46:07 +02:00
Sylvestre Ledru
91078cfcb3
Merge pull request #2445 from syukronrm/du-inodes
du: add `--inodes`
2021-07-04 11:28:03 +02:00
Sylvestre Ledru
010919a9a9
Merge pull request #2460 from miDeb/completions-errors
coreutils: better errors for invalid args for completions
2021-07-04 11:27:26 +02:00
Sylvestre Ledru
d3652cc3c0
Merge pull request #2457 from Funky185540/install-implement-backup
install: implement --backup, -b and -S
2021-07-04 09:57:45 +02:00
Terts Diepraam
e46ce2947e add usage error 2021-07-02 19:31:16 +02:00
353fc443
23f5f55560
Added UResult for dirname 2021-07-02 12:14:24 +00:00
353fc443
f66f10c4ed
Added UResult for hostid 2021-07-02 12:03:14 +00:00
353fc443
330db2eb3e
Added UResult for hostname 2021-07-02 08:19:33 +00:00
Terts Diepraam
5a40148602
Merge pull request #2463 from miDeb/wrap-help
all utils: enable wrap_help
2021-07-01 13:18:32 +02:00
Terts Diepraam
7a0a7aecc4
Merge pull request #2461 from miDeb/sort/check-no-out
sort: disable -o with -C and -c
2021-07-01 13:07:05 +02:00
Terts Diepraam
6213a2a967
Merge pull request #2462 from miDeb/sort/version
sort/ls: implement version cmp matching GNU spec
2021-07-01 13:02:59 +02:00