Daniel Hofstetter
8d3181fed5
df: fix incorrect test & add another test
2024-05-27 11:53:12 +02:00
Daniel Hofstetter
0164934afe
df: fix rounding issue in test
...
Set block size to 1 so the returned values are the same values as
used for the calculation of the percentage values
2023-12-21 10:46:11 +01:00
Sylvestre Ledru
bfca6bf70f
Add license headers on all files
2023-08-21 10:49:27 +02:00
Daniel Hofstetter
2d76a3b88e
df: disable failing tests on Windows
2023-06-28 14:43:35 +02:00
Daniel Hofstetter
6988eb7ec6
tests: expand wildcard imports
2023-03-20 15:32:35 +01: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
jfinkels
dd0daa5e06
df: remove trailing spaces in rightmost column ( #3882 )
...
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2022-09-22 08:37:20 +02:00
Terts Diepraam
9177cb7b24
all: add tests for usage error exit code
2022-09-10 20:59:42 +02:00
Jan Scheer
391709c911
tests: ignore failing tests for FreeBSD ( #3778 )
2022-08-13 10:09:05 +02:00
anastygnome
f5ae859c38
Adds a test for sync.
...
It is probably too hard to verify that the sync is actually performed,
so we just check that we have a test using the code path, pro forma.
Signed-off-by: anastygnome <noreplygitemail@protonmail.com>
2022-06-05 09:43:59 +02:00
Daniel Hofstetter
113c1855fd
df: trim size header in tests
...
Fixes #3580
2022-05-31 10:34:20 +02:00
Jeffrey Finkelstein
d7b528f60b
df: show "total" label in correct column
...
Show the "total" label in the "source" column or in the "target"
column if the "source" column is not visible.
Before this commit,
$ df --total --output=target .
Mounted on
/
-
After this commit,
$ df --total --output=target .
Mounted on
/
total
2022-05-30 11:22:07 -04:00
Daniel Hofstetter
ea284ce55e
df: read block size from env vars
2022-05-23 09:24:07 +02:00
Daniel Hofstetter
27dd59635a
uucore: add InvalidSuffix to ParseSizeError
2022-05-17 15:37:49 +02:00
Daniel Hofstetter
598dc79b69
df: test default blocksize in POSIX mode
2022-05-12 10:11:24 +02:00
Sylvestre Ledru
c212f4a556
Merge pull request #3513 from cakebaker/portability_headers
...
df: implement POSIX conform header line
2022-05-12 08:33:50 +02:00
Daniel Hofstetter
a6b100a5ca
df: show error if provided block size is zero
2022-05-11 12:59:51 +02:00
Daniel Hofstetter
e26fed61b3
df: implement POSIX conform header line
...
It also fixes #3195
2022-05-11 12:59:47 +02:00
Daniel Hofstetter
f668b69a2c
df: use blocksize of 512 if POSIXLY_CORRECT is set
2022-05-08 14:46:31 +02:00
Daniel Hofstetter
5a3933a882
df: fix "Size" header for multiples of 1000 & 1024
2022-05-06 15:37:52 +02:00
Sylvestre Ledru
cbe39b4154
Merge pull request #3456 from cakebaker/ticket_3193
...
df: fix "Size" column header
2022-05-05 07:58:48 +02:00
Daniel Hofstetter
15412f100a
df: show "block-size argument too large" error
2022-05-03 09:26:57 +02:00
Daniel Hofstetter
023fc96aab
df: fix "Size" column header
...
Fixes #3193
2022-04-30 07:33:00 +02:00
Sylvestre Ledru
181ebd3996
Revert "df: remove trailing spaces in rightmost column"
2022-04-24 20:39:39 +02:00
Daniel Hofstetter
0f13de4e1a
df: allow sizes with a suffix for --block-size
...
Fixes #3416
2022-04-24 15:37:23 +02:00
Daniel Hofstetter
78dc90124e
df: simplify get_header() in test_block_size_1024
2022-04-23 16:56:06 +02:00
Daniel Hofstetter
2d4552cce4
df: respect -t arg when specific file is provided
...
Fixes #3325
2022-04-22 10:27:25 +02:00
Terts Diepraam
e8574ca184
Merge pull request #3418 from cakebaker/ticket_3409
...
df: show error if all types are excluded
2022-04-20 23:51:36 +02:00
Sylvestre Ledru
4ed3bbe705
Merge pull request #3423 from cakebaker/remove_trailing_spaces_in_rightmost_column
...
df: remove trailing spaces in rightmost column
2022-04-20 11:42:27 +02:00
Daniel Hofstetter
9de407b1f0
df: fix "File" column width for unicode filenames
...
Fixes #3425
2022-04-19 11:09:46 +02:00
Daniel Hofstetter
cc4b28780b
df: show error if all types are excluded
...
Fixes #3409
2022-04-19 09:10:37 +02:00
Daniel Hofstetter
576ec49fa5
df: remove trailing spaces in rightmost column
2022-04-19 08:13:35 +02:00
Daniel Hofstetter
0d7f99a21f
df: fix broken "test_df_output_overridden" test
2022-04-19 07:46:00 +02:00
Sylvestre Ledru
d7cf3e7483
Merge pull request #3414 from gmnsii/main
...
df: -h -H shouldn't cause an error #3366
2022-04-18 22:24:36 +02:00
Daniel Hofstetter
a052855061
df: fix incorrect whitespace between columns
...
Fixes #3194
2022-04-17 14:00:52 +02:00
gmnsii
c9bf31f97e
Args override themselves and conflicting arguments
2022-04-17 01:52:05 -07:00
gmnsii
85d113ab79
df: -h -H shouldn't cause an error #3366
2022-04-16 07:51:24 -07:00
Daniel Hofstetter
a5477960a5
df: show error if specified type doesn't exist
...
Fixes #3252 . As a side effect, "df -H -total" will now fail, too, as
expected.
2022-04-14 10:39:48 +02:00
Daniel Hofstetter
56e8dda606
df: fix calculation of IUse%
...
Fixes #3355
2022-04-13 11:19:24 +02:00
Jeffrey Finkelstein
460bd67050
df: show error when file argument does not exist
...
For example:
$ df not-a-file
df: not-a-file: No such file or directory
Fixes #3373 .
2022-04-10 22:22:18 -04:00
Jeffrey Finkelstein
c5413167e2
df: correct --total argument used in unit test
...
Add a missing dash to the `--total` argument applied in the
`test_df_output` test case. Before this commit, the argument `-total`
was treated as a path argument. After this commit, `--total` is
treated as a command-line option that causes the total file usage to
be displayed.
2022-04-10 22:22:18 -04:00
Daniel Hofstetter
876924f5d5
df: show error if same type is included & excluded
...
Fixes #3302
2022-04-05 14:21:32 +02:00
Daniel Hofstetter
bf69c63e09
df: Fix calculation of Use% in "total" row
...
Change formula from: "Used/Size * 100" to "Used/(Used + Avail) * 100".
This formula also works if "Used" and "Avail" do not add up to "Size",
which is the case if there are reserved disk blocks.
2022-04-01 08:25:30 +02:00
Sylvestre Ledru
05ec34eb94
Merge pull request #3322 from jfinkels/df-multiple-columns-error
...
df: error on duplicate columns in --output arg
2022-03-29 22:30:14 +02:00
Daniel Hofstetter
e152ebaead
df: fix calculation of Use% column
...
Change formula from: "Used/Size * 100" to "Used/(Used + Avail) * 100".
This formula also works if "Used" and "Avail" do not add up to "Size",
which is the case if there are reserved disk blocks.
2022-03-28 18:57:12 +02:00
Daniel Hofstetter
a68d77b8cf
df: --output w/o "=" doesn't expect further args
...
"df --output ." was treated as "df --output=." and hence "." was
interpreted as a column name. With this commit, "." is treated as
an argument on its own.
Fixes #3324
2022-03-28 10:13:54 +02:00
Jeffrey Finkelstein
a1f300e8a7
df: allow multiple occurrences of --output arg
...
Allow multiple occurrences of the `--output` argument. For example,
$ df --output=source --output=target | head -n1
Filesystem Mounted on
2022-03-27 22:14:16 -04:00
Jeffrey Finkelstein
6f32a1921a
df: error on duplicate columns in --output arg
...
Print a usage error when duplicat column names are specified to the
`--output` command-line argument. For example,
$ df --output=source,source
df: option --output: field ‘source’ used more than once
Try 'df --help' for more information.
2022-03-27 22:02:55 -04:00
Jeffrey Finkelstein
ab717ce370
df: implement the File column
...
Implement the "File" column in the `df` output table. Before this
commit, a blank entry appeared in the "File" column for each
row. After this commit, a "-" entry appears when `df` is run with no
positional arguments and the filename appears when run with positional
arguments. For example:
$ touch a b c && df --output=target,file a b c
Mounted on File
/ a
/ b
/ c
2022-03-27 13:17:36 -04:00