2 # SPDX-License-Identifier: GPL-2.0-or-later
3 # Copyright (c) 2020 Oracle. All Rights Reserved.
7 # Feed invalid mkfs config files to the mkfs parser to ensure that they are
8 # recognized as invalid.
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
44 echo "Test passed, should have failed! Config file parameters:"
49 echo Spaces in a section name
50 test_mkfs_config << ENDL
54 test_mkfs_config << ENDL
58 test_mkfs_config << ENDL
62 test_mkfs_config << ENDL
66 test_mkfs_config << ENDL
70 test_mkfs_config << ENDL
74 test_mkfs_config << ENDL
78 test_mkfs_config << ENDL
82 test_mkfs_config << ENDL
86 test_mkfs_config << ENDL
90 test_mkfs_config << ENDL
94 test_mkfs_config << ENDL
98 test_mkfs_config << ENDL
103 echo Spaces in the middle of a key name
104 test_mkfs_config << ENDL
110 test_mkfs_config << ENDL
115 echo Nonexistent sections
116 test_mkfs_config << ENDL
121 echo Nonexistent keys
122 test_mkfs_config << ENDL
127 echo Only zero or one
128 test_mkfs_config << ENDL
132 test_mkfs_config << ENDL
137 echo sysctl style files
138 test_mkfs_config << ENDL
143 test_mkfs_config $MKFS_XFS_PROG 2>&1 | sed -e "s#$MKFS_XFS_PROG#MKFS_XFS_PROG#g"
145 echo respecified options
146 test_mkfs_config << ENDL
152 echo respecified sections
153 test_mkfs_config << ENDL
160 echo ambiguous comment/section names
161 test_mkfs_config << ENDL
166 echo ambiguous comment/variable names
167 test_mkfs_config << ENDL
171 test_mkfs_config << ENDL
175 test_mkfs_config << ENDL
179 test_mkfs_config << ENDL
181 crc = 0;This is an eol comment.