summaryrefslogtreecommitdiff
path: root/tests/mkfs-tests/010-minimal-size/test.sh
blob: f33b8aa399f44f61b82c03eb5c1f6e51851dcdef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# test if the reported minimal size of mkfs.btrfs is valid

source "$TOP/tests/common"

check_prereq mkfs.btrfs
check_prereq btrfs

setup_root_helper

do_test()
{
	# 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

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