From 707e1b2d595b0889a39f5e6fd7c5fdc4c324b77b Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Mon, 23 Oct 2023 17:04:19 -0400 Subject: [PATCH] Ensure dd creates the full 8K input test file. Without `iflag=fullblock` we encounter sporadic cases where the input file to the truncate test isn't fully written to 8K and ends up to be only 4K. The subsequent truncate tests then fail. We add a check to the input test file size just to be sure in the future. Signed-off-by: Auke Kok --- tests/tests/basic-truncate.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/tests/basic-truncate.sh b/tests/tests/basic-truncate.sh index d7479640..c7a3906f 100644 --- a/tests/tests/basic-truncate.sh +++ b/tests/tests/basic-truncate.sh @@ -11,8 +11,13 @@ FILE="$T_D0/file" # final block as we truncated past it. # echo "== truncate writes zeroed partial end of file block" -yes | dd of="$FILE" bs=8K count=1 status=none +yes | dd of="$FILE" bs=8K count=1 status=none iflag=fullblock sync + +# not passing iflag=fullblock causes the file occasionally to just be +# 4K, so just to be safe we should at least check size once +test `stat --printf="%s\n" "$FILE"` -eq 8192 || t_fail "test file incorrect start size" + truncate -s 6K "$FILE" truncate -s 12K "$FILE" echo 3 > /proc/sys/vm/drop_caches