btrfs-progs: tests: Move code to create loop device to common
[platform/upstream/btrfs-progs.git] / tests / fsck-tests / 013-extent-tree-rebuild / test.sh
index 3290cd7..88a66cc 100755 (executable)
@@ -5,16 +5,7 @@ source $TOP/tests/common
 check_prereq btrfs-debug-tree
 check_prereq mkfs.btrfs
 setup_root_helper
-
-if [ -z $TEST_DEV ]; then
-       echo "\$TEST_DEV not given, use $TOP/test/test.img as fallback" >> \
-               $RESULTS
-       TEST_DEV="$TOP/tests/test.img"
-
-       # Need at least 1G to avoid mixed block group, which extent tree
-       # rebuild doesn't support.
-       run_check truncate -s 1G $TEST_DEV
-fi
+prepare_test_dev 1G
 
 if [ -z $TEST_MNT ];then
        echo "    [NOTRUN] extent tree rebuild, need TEST_MNT variant"