2 # SPDX-License-Identifier: GPL-2.0-or-later
3 # Copyright (c) 2020 Oracle. All Rights Reserved.
7 # Feed valid mkfs config files to the mkfs parser to ensure that they are
11 _begin_fstest auto quick mkfs
13 # Override the default cleanup function.
17 rm -f $tmp.* $def_cfgfile $fsimg
20 # Import common functions.
23 # real QA test starts here
25 # Modify as appropriate.
28 _require_scratch_nocheck
29 _require_xfs_mkfs_cfgfile
31 def_cfgfile=$TEST_DIR/a
33 rm -f $def_cfgfile $fsimg
34 $XFS_IO_PROG -c "truncate 20t" -f $fsimg
38 if [ -z "$cfgfile" ] || [ "$cfgfile" = "-" ]; then
42 $MKFS_XFS_PROG -c options=$cfgfile -f -N $fsimg >> $seqres.full 2> $tmp.err
43 cat $tmp.err | _filter_test_dir
46 echo Simplest config file
47 cat > $def_cfgfile << ENDL
51 test_mkfs_config $def_cfgfile
53 echo Piped-in config file
54 test_mkfs_config << ENDL
58 test_mkfs_config << ENDL
63 echo Full line comment
64 test_mkfs_config << ENDL
65 # This is a full line comment.
69 test_mkfs_config << ENDL
70 # This is a full line comment.
74 test_mkfs_config << ENDL
75 #This is a full line comment.
80 echo End of line comment
81 test_mkfs_config << ENDL
83 crc = 0 ; This is an eol comment.
85 test_mkfs_config << ENDL
87 crc = 0 ;This is an eol comment.
90 echo Multiple directives
91 test_mkfs_config << ENDL
97 echo Multiple sections
98 test_mkfs_config << ENDL
106 echo No directives at all
107 test_mkfs_config << ENDL
111 echo Space around the section name
112 test_mkfs_config << ENDL
116 test_mkfs_config << ENDL
120 test_mkfs_config << ENDL
125 echo Single space around the key/value directive
126 test_mkfs_config << ENDL
130 test_mkfs_config << ENDL
134 test_mkfs_config << ENDL
138 test_mkfs_config << ENDL
143 echo Two spaces around the key/value directive
144 test_mkfs_config << ENDL
148 test_mkfs_config << ENDL
152 test_mkfs_config << ENDL
156 test_mkfs_config << ENDL
160 test_mkfs_config << ENDL
164 test_mkfs_config << ENDL
169 echo Three spaces around the key/value directive
170 test_mkfs_config << ENDL
174 test_mkfs_config << ENDL
178 test_mkfs_config << ENDL
183 echo Four spaces around the key/value directive
184 test_mkfs_config << ENDL
189 echo Arbitrary spaces and tabs
190 test_mkfs_config << ENDL
195 echo ambiguous comment/section names
196 test_mkfs_config << ENDL
202 echo ambiguous comment/variable names
203 test_mkfs_config << ENDL
205 #foo = 0 ; is this a comment or a key '#foo' ?