Commit graph

82 commits

Author SHA1 Message Date
Daniel Hofstetter
89af8b9769 du,uucore: add words to spell-checker:ignore 2024-04-24 16:54:32 +02:00
Michael Vogt
61e0450c66 du: give -h output the same precision as GNU coreutils
When printing the `du -h` output GNU coreutils does autoscale
the size, e.g.
```
$ truncate -s12M a
$ truncate -s8500 b
$ truncate -s133456345 c
$ truncate -s56990456345 d
$ du -h --apparent-size a b c d
12M	a
8,4K	b
128M	c
54G	d
```
Align our version to do the same by sharing the code with `ls`.

Closes: #6159
2024-04-24 16:53:08 +02:00
Ben Wiederhake
27a81f3d32 du: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:46 +02:00
Carbrex
49c7e65f5d Use time-style only if time is provided 2024-04-01 17:09:59 +02:00
Daniel Hofstetter
d1e1e9ce0f du: adapt error msg to match GNU's 2024-01-30 10:08:50 +01:00
Daniel Hofstetter
e4fbc31714 du: ignore duplicate names with --files0-from 2024-01-03 09:39:16 +01:00
Daniel Hofstetter
239e5426e6 du: show error for nul names with --files0-from 2024-01-02 16:06:41 +01:00
Daniel Hofstetter
2d260ded58 du: use concat! to improve readability in tests 2023-12-26 15:19:45 +01:00
Daniel Hofstetter
37c83ec480 du: simplify file creation in tests 2023-12-26 15:15:02 +01:00
Sylvestre Ledru
30eb77ac79
du: implement files0-from (#5721)
* du: implement files0-from

Should make tests/du/files0-from-dir pass

* du: prepare tests/du/files0-from.pl

* fix the build on Windows

* add testfile to the ignore list

* remove useless comment

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* mkdir is enough

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* address review comments

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-12-26 14:40:31 +01:00
Sylvestre Ledru
6d2486c096
Merge pull request #5503 from cakebaker/du_unused_du_basics
du: call unused _du_basics() in test_du_basics()
2023-12-25 22:38:27 +01:00
Daniel Hofstetter
030fd3d4d2 du: test behavior with POSIXLY_CORRECT set 2023-12-25 13:17:17 +01:00
Daniel Hofstetter
c111dc88ac du: fix issue with dereference in test 2023-12-08 10:23:15 +01:00
Daniel Hofstetter
49fb72ed21 du: disable test on Android 2023-12-03 14:07:03 +01:00
Daniel Hofstetter
4903b91973 du: call unused _du_basics() in test_du_basics() 2023-12-02 16:52:12 +01:00
Daniel Hofstetter
12e61d451c du: make -l/--count-links work 2023-11-09 16:07:02 +01:00
Daniel Hofstetter
7afb8461cb du: add -H (alias for --dereference-args) 2023-11-07 10:30:54 +01:00
Daniel Hofstetter
bbdde2890a du: ignore test under Android & FreeBSD 2023-11-05 14:27:20 +01:00
Daniel Hofstetter
29f6631554 du: add -P/--no-dereference 2023-11-03 17:17:44 +01:00
Terts Diepraam
c3f9e19a3b all: normalize license notice in all *.rs files 2023-08-24 12:21:09 +02:00
Daniel Hofstetter
c99d81a05b du: fix "unused import" warning on Windows 2023-06-27 15:05:27 +02:00
John Shin
b34e7f7bf6 du: directories have apparent size of 0 2023-06-25 15:56:57 -07:00
Daniel Hofstetter
7730c8171d du: fix clippy warning in test 2023-04-21 17:01:40 +02:00
Sylvestre Ledru
47cb40c020 du: adjust test_du_basics_bad_name as we made it work 2023-04-13 13:27:04 +02:00
Sylvestre Ledru
eea8d40e78 du: add support of --dereference-args
Should fix tests/du/deref.sh
2023-04-13 13:27:04 +02:00
Sylvestre Ledru
5a1d9cec7e du: an error code when done on a non existing file 2023-04-13 13:27:04 +02:00
Maciej Habasiński
d277603bf1 du: fmt fix 2023-03-26 23:38:31 +02:00
Maciej Habasiński
892f1d910a test: du invalid threshold 2023-03-26 15:08:56 +02:00
Daniel Hofstetter
0140f4f7d0 tests: fix "unresolved import" warnings on Windows 2023-03-20 16:26:31 +01:00
Daniel Hofstetter
6988eb7ec6 tests: expand wildcard imports 2023-03-20 15:32:35 +01:00
Koki Ueha
0b042f0b32 test_du: fix unnecessary boolean operation 2023-03-19 04:59:08 +00:00
Guilherme Gonçalves
d29119728a tests/du: run test_du_time with TZ=UTC.
du --time formats a file's timestamp according to the local timezone,
but the test implicitly assumed UTC. This caused it to fail when
running locally in my UTC+1 machine.

$ cargo test --features "du touch" --no-default-features
Failure: https://gist.github.com/eggpi/651e01559b7c59e9457c1b22fe4c0c19
2023-03-02 22:14:03 +00:00
Daniel Hofstetter
f6b646e4e5 clippy: fix warnings introduced with Rust 1.67.0 2023-01-27 17:37:56 +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
Terts Diepraam
9177cb7b24 all: add tests for usage error exit code 2022-09-10 20:59:42 +02:00
Ackerley Tng
c2bb9596d9 du: update du to use parse_glob::from_str 2022-08-09 10:36:23 +02:00
Daniel Hofstetter
27dd59635a uucore: add InvalidSuffix to ParseSizeError 2022-05-17 15:37:49 +02:00
Ackerley Tng
88a62c4922 du: use common error methods with show! instead of set_exit_code 2022-05-04 07:33:19 -07:00
Justin Tracey
2a0d58d060 get android builds to compile and pass tests 2022-04-20 08:44:49 +02:00
Sylvestre Ledru
8b719a8591
du: add support for --exclude and --exclude-from (#3381)
* du: add support for --exclude and --exclude-from

And add an option --verbose (doesn't exist in GNU)
2022-04-11 22:50:01 +02:00
Sylvestre Ledru
a2cefd9b52 du: Return non zero error code when dealing with permissions errors
Nd make the tests/du/no-x.sh & long-sloop.sh pass
2022-04-10 01:47:39 +02:00
Daniel Eades
4f8d1c5fcf add additional lints 2022-01-31 20:40:47 +01:00
Syukron Rifail M
37c986b005 test_du: ignore unsupported --time=birth 2021-07-19 06:55:11 +07:00
Sylvestre Ledru
2177b8dc37
Merge pull request #2481 from Funky185540/fix/test_du_bytes_nondynamic_on_linux
test: du: Skip nondynamic comparison on linux for test_du_bytes
2021-07-09 09:11:52 +02:00
Jan Scheer
14b348dd4b
tests: fix tests for CICD environment 2021-07-08 11:17:18 +02:00
Jan Scheer
31aa8b2062
test_du: refactor use expected_result from common/util.rs 2021-07-07 22:09:01 +02: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
Syukron Rifail M
27e0507844 du: more tests 2021-06-28 07:51:17 +07:00
Syukron Rifail M
d8a33da5b3 du: add --inodes 2021-06-28 07:51:17 +07:00
Jan Scheer
c0be979611 fix some issues with locale (replace "LANGUAGE" with "LC_ALL")
`LANGUAGE=C` is not enough, `LC_ALL=C` is needed as the environment
variable that overrides all the other localization settings.

e.g.
```bash
$ LANGUAGE=C id foobar
id: ‘foobar’: no such user

$ LC_ALL=C id foobar
id: 'foobar': no such user
```

* replace `LANGUAGE` with `LC_ALL` as environment variable in the tests
* fix the the date string of affected uutils
* replace `‘` and `’` with `'`
2021-06-23 11:30:28 +02:00