From 0164934afecbfb035281e5b58191bdcec2ad2b0b Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 14 Nov 2023 17:41:19 +0100 Subject: [PATCH] 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 --- tests/by-util/test_df.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_df.rs b/tests/by-util/test_df.rs index 227121ef4..0276f18c3 100644 --- a/tests/by-util/test_df.rs +++ b/tests/by-util/test_df.rs @@ -422,7 +422,11 @@ fn test_total_label_in_correct_column() { #[test] fn test_use_percentage() { let output = new_ucmd!() - .args(&["--total", "--output=used,avail,pcent"]) + // set block size = 1, otherwise the returned values for + // "used" and "avail" will be rounded. And using them to calculate + // the "percentage" values might lead to a mismatch with the returned + // "percentage" values. + .args(&["--total", "--output=used,avail,pcent", "--block-size=1"]) .succeeds() .stdout_move_str();