diff options
author | Qu Wenruo <wqu@suse.com> | 2017-10-12 15:11:33 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-01-08 18:11:35 +0100 |
commit | 5d0783ad1430c9fa4621537224073b680d6ad6af (patch) | |
tree | ab7566fa67f1d3f614c3dd0e37fb0dfdfb21e416 /tests | |
parent | 8719161b4c2cefdf1bbb87800ee6fada57bcac9c (diff) |
btrfs-progs: test/mkfs: Test if the minimal device size is valid
New test case to test if the minimal device size given by "mkfs.btrfs"
failure case is valid.
Signed-off-by: Qu Wenruo <wqu@suse.com>
[ renamed script ]
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/mkfs-tests/010-minimal-size/test.sh | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/mkfs-tests/010-minimal-size/test.sh b/tests/mkfs-tests/010-minimal-size/test.sh new file mode 100755 index 00000000..f75a22d8 --- /dev/null +++ b/tests/mkfs-tests/010-minimal-size/test.sh @@ -0,0 +1,49 @@ +#!/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" + 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 |