btrfs-progs: tests: switch messages to _log

The _log helper should be used for test log messages instead of raw echo
to the results file.

Signed-off-by: David Sterba <dsterba@suse.com>
master
David Sterba 2019-07-24 15:53:18 +02:00
parent 6f24e7276b
commit 4e48f14f8b
7 changed files with 10 additions and 10 deletions

View File

@ -4,12 +4,12 @@ source "$TEST_TOP/common"
check_prereq btrfs
echo "extracting image default_case.tar.xz" >> "$RESULTS"
_log "extracting image default_case.tar.xz"
tar --no-same-owner -xJf default_case.tar.xz || \
_fail "failed to extract default_case.tar.xz"
check_image test.img
echo "extracting image skinny_case.tar.xz" >> "$RESULTS"
_log "extracting image skinny_case.tar.xz"
tar --no-same-owner -xJf skinny_case.tar.xz || \
_fail "failed to extract skinny_case.tar.xz"
check_image test.img

View File

@ -37,7 +37,7 @@ leaf_no_data_ext_list=(
generate_leaf_corrupt_no_data_ext()
{
dest=$1
echo "generating leaf_corrupt_no_data_ext.btrfs-image" >> "$RESULTS"
_log "generating leaf_corrupt_no_data_ext.btrfs-image"
tar --no-same-owner -xJf ./no_data_extent.tar.xz || \
_fail "failed to extract leaf_corrupt_no_data_ext.btrfs-image"
"$TOP/btrfs-image" -r test.img.btrfs-image "$dest" || \

View File

@ -32,7 +32,7 @@ corrupt_fst_item()
offset=$("$TOP/btrfs" inspect-internal dump-tree -t 10 "$TEST_DEV" | \
grep -o "[[:digit:]]* FREE_SPACE_BITMAP [[:digit:]]*" | \
cut -d' ' -f3 | tail -2 | head -1)
echo "Corrupting $objectid,FREE_SPACE_BITMAP,$offset" >> "$RESULTS"
_log "Corrupting $objectid,FREE_SPACE_BITMAP,$offset"
elif [[ $type == "extent" ]]; then
type=199
objectid=$("$TOP/btrfs" inspect-internal dump-tree -t 10 "$TEST_DEV" | \
@ -41,7 +41,7 @@ corrupt_fst_item()
offset=$("$TOP/btrfs" inspect-internal dump-tree -t 10 "$TEST_DEV" | \
grep -o "[[:digit:]]* FREE_SPACE_EXTENT [[:digit:]]*" | \
cut -d' ' -f3 | tail -2 | head -1)
echo "Corrupting $objectid,FREE_SPACE_EXTENT,$offset" >> "$RESULTS"
_log "Corrupting $objectid,FREE_SPACE_EXTENT,$offset"
else
_fail "Unknown item type for corruption"
fi

View File

@ -16,7 +16,7 @@ shrink_test()
{
min_size=$(run_check_stdout $SUDO_HELPER "$TOP/btrfs" inspect-internal min-dev-size ${1:+--id "$1"} "$TEST_MNT")
min_size=$(echo "$min_size" | cut -d ' ' -f 1)
echo "min size = ${min_size}" >> "$RESULTS"
_log "min size = ${min_size}"
if [ -z "$min_size" ]; then
_fail "Failed to parse minimum size"
fi

View File

@ -9,7 +9,7 @@ mkfs.ext4 -V &>/dev/null || _not_run "mkfs.ext4 not found"
prepare_test_dev
for ((i = 0; i < 20; i++)); do
echo "loop $i" >> "$RESULTS"
_log "loop $i"
mkfs.ext4 -F "$TEST_DEV" &>>"$RESULTS" || _not_run "mkfs.ext4 failed"
run_check "$TOP/btrfs-convert" "$TEST_DEV"
done

View File

@ -18,7 +18,7 @@ do_test()
good_size=$(echo "$output" | grep -oP "(?<=is )\d+")
prepare_test_dev "$good_size"
echo "Minimal device size is $good_size" >> "$RESULTS"
_log "Minimal device size is $good_size"
run_check_mkfs_test_dev "$@"
run_check_mount_test_dev
run_check_umount_test_dev

View File

@ -26,8 +26,8 @@ do_one_test ()
_fail "failed to get first device extent"
fi
echo "first dev extent starts at $first_dev_extent" >> "$RESULTS"
echo "reserved range is [0, $(( 1024 * 1024)))" >> "$RESULTS"
_log "first dev extent starts at $first_dev_extent"
_log "reserved range is [0, $(( 1024 * 1024)))"
# First device extent should not start below 1M
if [ "$first_dev_extent" -lt $(( 1024 * 1024 )) ]; then
_fail "first device extent occupies reserved 0~1M range"