From 711f193e4e3e08f713b1d774ebf54319851b1cc0 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 22 Sep 2023 10:23:01 +0200 Subject: [PATCH] ls: fix test which fails if /tmp uses tmpfs --- tests/by-util/test_ls.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 87b3066569a..79a04b268ff 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -3608,9 +3608,13 @@ fn test_ls_dired_complex() { let mut cmd = scene.ucmd(); cmd.arg("--dired").arg("-l").arg("d"); let result = cmd.succeeds(); - // Number of blocks + + // Number of blocks. We run this test only if the default size of a newly created directory is + // 4096 bytes to prevent it from failing where this is not the case (e.g. using tmpfs for /tmp). #[cfg(target_os = "linux")] - result.stdout_contains(" total 4"); + if at.metadata("d/d").len() == 4096 { + result.stdout_contains(" total 4"); + } let output = result.stdout_str().to_string(); println!("Output:\n{}", output);