mirror of
https://github.com/versity/scoutfs.git
synced 2026-04-22 14:30:31 +00:00
This happens with the basic-truncate test, only. It's the only user of the `yes` program. The `yes` command normally fails gracefully under the usual runs that are attached to some terminal. But when the test script runs entirely under something else, it will throw a needless error message that pollutes the test output: `yes: standard output: Broken pipe` Adjust the redirect to omit all stderr for `yes` in this case. Signed-off-by: Auke Kok <auke.kok@versity.com>
27 lines
678 B
Bash
27 lines
678 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 2>/dev/null | 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
|