mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
7e98d41a6e
Refactor every test in the entire test suite to use the new boilerplate functions. This also migrates all the test group information into the test files. This patch has been autogenerated via the command: ./tools/convert-group btrfs ceph cifs ext4 f2fs generic nfs ocfs2 overlay perf shared udf xfs Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
187 lines
2.8 KiB
Bash
Executable File
187 lines
2.8 KiB
Bash
Executable File
#! /bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
# Copyright (c) 2020 Oracle. All Rights Reserved.
|
|
#
|
|
# FS QA Test No. 523
|
|
#
|
|
# Feed invalid mkfs config files to the mkfs parser to ensure that they are
|
|
# recognized as invalid.
|
|
#
|
|
. ./common/preamble
|
|
_begin_fstest auto quick mkfs
|
|
|
|
# Override the default cleanup function.
|
|
_cleanup()
|
|
{
|
|
cd /
|
|
rm -f $tmp.* $def_cfgfile $fsimg
|
|
}
|
|
|
|
# Import common functions.
|
|
. ./common/filter
|
|
|
|
# real QA test starts here
|
|
|
|
# Modify as appropriate.
|
|
_supported_fs xfs
|
|
_require_test
|
|
_require_scratch_nocheck
|
|
_require_xfs_mkfs_cfgfile
|
|
|
|
def_cfgfile=$TEST_DIR/a
|
|
fsimg=$TEST_DIR/a.img
|
|
rm -f $def_cfgfile $fsimg
|
|
$XFS_IO_PROG -c "truncate 20t" -f $fsimg
|
|
|
|
test_mkfs_config() {
|
|
local cfgfile="$1"
|
|
if [ -z "$cfgfile" ] || [ "$cfgfile" = "-" ]; then
|
|
cfgfile=$def_cfgfile
|
|
cat > $cfgfile
|
|
fi
|
|
$MKFS_XFS_PROG -c options=$cfgfile -f -N $fsimg >> $seqres.full 2> $tmp.err
|
|
if [ $? -eq 0 ]; then
|
|
echo "Test passed, should have failed! Config file parameters:"
|
|
cat $cfgfile
|
|
fi
|
|
}
|
|
|
|
echo Spaces in a section name
|
|
test_mkfs_config << ENDL
|
|
[meta data]
|
|
crc = 0
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
[meta data]
|
|
crc = 0
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
[ metadata]
|
|
crc = 0
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
[metadata ]
|
|
crc = 0
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
[ metadata ]
|
|
crc = 0
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
[ metadata]
|
|
crc = 0
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
[metadata ]
|
|
crc = 0
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
[ metadata]
|
|
crc = 0
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
[metadata ]
|
|
crc = 0
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
[ metadata ]
|
|
crc = 0
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
[metadata ]
|
|
crc = 0
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
[ metadata ]
|
|
crc = 0
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
[ metadata ]
|
|
crc = 0
|
|
ENDL
|
|
|
|
echo Spaces in the middle of a key name
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
c rc = 0
|
|
ENDL
|
|
|
|
echo Invalid value
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
crc = waffles
|
|
ENDL
|
|
|
|
echo Nonexistent sections
|
|
test_mkfs_config << ENDL
|
|
[goober]
|
|
crc = 0
|
|
ENDL
|
|
|
|
echo Nonexistent keys
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
goober = 0
|
|
ENDL
|
|
|
|
echo Only zero or one
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
crc = 50
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
crc = -1
|
|
ENDL
|
|
|
|
echo sysctl style files
|
|
test_mkfs_config << ENDL
|
|
metadata.crc = 1
|
|
ENDL
|
|
|
|
echo binaries
|
|
test_mkfs_config $MKFS_XFS_PROG 2>&1 | sed -e "s#$MKFS_XFS_PROG#MKFS_XFS_PROG#g"
|
|
|
|
echo respecified options
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
crc = 0
|
|
crc = 1
|
|
ENDL
|
|
|
|
echo respecified sections
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
crc = 0
|
|
[metadata]
|
|
crc = 1
|
|
ENDL
|
|
|
|
echo ambiguous comment/section names
|
|
test_mkfs_config << ENDL
|
|
[meta#data]
|
|
crc = 0
|
|
ENDL
|
|
|
|
echo ambiguous comment/variable names
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
fo#o = 0
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
foo#=# 0
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
foo =# 0
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
crc = 0;This is an eol comment.
|
|
ENDL
|
|
|
|
# success, all done
|
|
status=0
|
|
exit
|