btrfs-progs: tests: add shell quotes to mkfs test scripts
[platform/upstream/btrfs-progs.git] / tests / mkfs-tests / 008-sectorsize-nodesize-combination / test.sh
1 #!/bin/bash
2 # test various sectorsize and node size combinations
3 # including valid and invalid ones
4 # only do mkfs and fsck check, no mounting as
5 # sub/multi-pagesize is not supported yet
6
7 source "$TEST_TOP/common"
8
9 check_prereq mkfs.btrfs
10 check_prereq btrfs
11
12 prepare_test_dev
13
14 # disable mixed bg to avoid sectorsize == nodesize check
15 features="^mixed-bg"
16
17 # caller need to check whether the combination is valid
18 do_test()
19 {
20         sectorsize=$1
21         nodesize=$2
22         run_mayfail "$TOP/mkfs.btrfs" -f -O "$features" -n "$nodesize" -s "$sectorsize" \
23                 "$TEST_DEV"
24         ret=$?
25         if [ "$ret" == 0 ]; then
26                 run_check "$TOP/btrfs" check "$TEST_DEV"
27         fi
28         return "$ret"
29 }
30
31 # Invalid: Unaligned sectorsize and nodesize
32 do_test 8191 8191 && _fail
33
34 # Invalid: Aligned sectorsize with unaligned nodesize
35 do_test 4k 16385 && _fail
36
37 # Invalid: Unaligned sectorsize with aligned nodesize
38 do_test 8191 16k && _fail
39
40 # Valid: Aligned sectorsize and nodesize
41 do_test 4k 16k || _fail
42
43 # Invalid: Sectorsize larger than nodesize
44 do_test 8k 4k && _fail
45
46 # Invalid: too large nodesize
47 do_test 16k 128k && _fail
48
49 # Valid: large sectorsize
50 do_test 64k 64k || _fail