path: root/tests/mkfs-tests/010-minimal-size
diff options
authorDimitri John Ledkov <>2018-02-19 15:51:31 +0000
committerDimitri John Ledkov <>2018-02-19 15:52:49 +0000
commitb70cb0d0a21394d5d6b00b51f064115c2724cea8 (patch)
treef001381d2ee826e6665e003e7c6dccb084a54316 /tests/mkfs-tests/010-minimal-size
parentf1b0adb46b2c193e940f8c22b35036d2ee76c673 (diff)
Diffstat (limited to 'tests/mkfs-tests/010-minimal-size')
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/mkfs-tests/010-minimal-size/ b/tests/mkfs-tests/010-minimal-size/
new file mode 100755
index 00000000..62f8e16a
--- /dev/null
+++ b/tests/mkfs-tests/010-minimal-size/
@@ -0,0 +1,63 @@
+# test if the reported minimal size of mkfs.btrfs is valid
+source "$TOP/tests/common"
+check_prereq mkfs.btrfs
+check_prereq btrfs
+ # 1M should be small enough to reliably fail, we use the output to get
+ # the minimal device size for the given option combination
+ prepare_test_dev 1M
+ output=$(run_mustfail_stdout "mkfs.btrfs for small image" \
+ "$TOP/mkfs.btrfs" -f $@ "$TEST_DEV")
+ good_size=$(echo "$output" | grep -oP "(?<=is )\d+")
+ prepare_test_dev "$good_size"
+ echo "Minimal device size is $good_size" >> "$RESULTS"
+ run_check $TOP/mkfs.btrfs -f $@ "$TEST_DEV"
+ run_check_mount_test_dev
+ run_check_umount_test_dev
+do_test -n 4k -m single -d single
+do_test -n 4k -m single -d dup
+do_test -n 4k -m dup -d single
+do_test -n 4k -m dup -d dup
+do_test -n 8k -m single -d single
+do_test -n 8k -m single -d dup
+do_test -n 8k -m dup -d single
+do_test -n 8k -m dup -d dup
+do_test -n 16k -m single -d single
+do_test -n 16k -m single -d dup
+do_test -n 16k -m dup -d single
+do_test -n 16k -m dup -d dup
+# Temporary: disable the following tests as they fail inside travis but run
+# fine otherwise. This is probably caused by kernel version, 4.4 fails and 4.14
+# is ok.
+# root_helper mount -t btrfs -o loop /home/travis/build/kdave/btrfs-progs/tests/test.img /home/travis/build/kdave/btrfs-progs/tests/mnt
+# mount: No space left on device
+# failed: root_helper mount -t btrfs -o loop /home/travis/build/kdave/btrfs-progs/tests/test.img /home/travis/build/kdave/btrfs-progs/tests/mnt
+# test failed for case 010-minimal-size
+if [ "$TRAVIS" = true ]; then
+ exit 0
+do_test -n 32k -m single -d single
+do_test -n 32k -m single -d dup
+do_test -n 32k -m dup -d single
+do_test -n 32k -m dup -d dup
+do_test -n 64k -m single -d single
+do_test -n 64k -m single -d dup
+do_test -n 64k -m dup -d single
+do_test -n 64k -m dup -d dup