btrfs-progs/tests/mkfs-tests/012-rootdir-no-shrink/test.sh
David Sterba e875cd98e3 btrfs-progs: tests: fix source path for testsuite
The commit cebf3b3722 ("btrfs-progs: introduce TEST_TOP and
INTERNAL_BIN for tests") did not convert all test paths. This would
break the exported testsutie.

Signed-off-by: David Sterba <dsterba@suse.com>
2018-03-30 22:15:54 +02:00

40 lines
897 B
Bash
Executable File

#!/bin/bash
# Test if mkfs.btrfs --rootdir will skip shrinking correctly
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
setup_root_helper
fs_size=$((512 * 1024 * 1024))
bs=$((1024 * 1024))
tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs.rootdirXXXXXXX)
prepare_test_dev $fs_size
# No shrink case
run_check "$TOP/mkfs.btrfs" -f --rootdir "$tmp" "$TEST_DEV"
run_check_mount_test_dev
# We should be able to write at least half of the fs size data since the fs is
# not shrunk
run_check $SUDO_HELPER dd if=/dev/zero bs=$bs count=$(($fs_size / $bs / 2)) \
of="$TEST_MNT/file"
run_check_umount_test_dev
# Shrink case
run_check "$TOP/mkfs.btrfs" -f --rootdir "$tmp" --shrink "$TEST_DEV"
run_check_mount_test_dev
run_mustfail "mkfs.btrfs for shrink rootdir" \
$SUDO_HELPER dd if=/dev/zero bs=$bs count=$(($fs_size / $bs / 2)) \
of="$TEST_MNT/file"
run_check_umount_test_dev
rm -rf -- "$tmp"