mirror of
https://github.com/versity/scoutfs.git
synced 2026-05-01 18:35:43 +00:00
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 <auke.kok@versity.com>
27 lines
666 B
Bash
27 lines
666 B
Bash
#
|
|
# Test basic correctness of truncate.
|
|
#
|
|
|
|
t_require_commands yes dd od truncate
|
|
|
|
FILE="$T_D0/file"
|
|
|
|
#
|
|
# We forgot to write a dirty block that zeroed the tail of a partial
|
|
# 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 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
|
|
od -Ad -x "$FILE"
|
|
|
|
t_pass
|