mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
3ba859629d
Simple tests of the upcoming mkfs.xfs config file feature. First we have some simple tests of properly formatted config files, then improperly formatted config files, and finally we try to spot conflicts between config file options and the cli. [dchinner: updated for new libinih-based implementation.] Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
220 lines
3.4 KiB
Bash
Executable File
220 lines
3.4 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. 522
|
|
#
|
|
# Feed valid mkfs config files to the mkfs parser to ensure that they are
|
|
# recognized as valid.
|
|
#
|
|
seq=`basename $0`
|
|
seqres=$RESULT_DIR/$seq
|
|
echo "QA output created by $seq"
|
|
|
|
here=`pwd`
|
|
tmp=/tmp/$$
|
|
status=1 # failure is the default!
|
|
trap '_cleanup; exit $status' 0 1 2 3 15
|
|
|
|
_cleanup()
|
|
{
|
|
cd /
|
|
rm -f $tmp.* $def_cfgfile $fsimg
|
|
}
|
|
|
|
# get standard environment, filters and checks
|
|
. ./common/rc
|
|
. ./common/filter
|
|
|
|
# remove previous $seqres.full before test
|
|
rm -f $seqres.full
|
|
|
|
# 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
|
|
cat $tmp.err | _filter_test_dir
|
|
}
|
|
|
|
echo Simplest config file
|
|
cat > $def_cfgfile << ENDL
|
|
[metadata]
|
|
crc = 0
|
|
ENDL
|
|
test_mkfs_config $def_cfgfile
|
|
|
|
echo Piped-in config file
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
crc = 0
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
crc = 1
|
|
ENDL
|
|
|
|
echo Full line comment
|
|
test_mkfs_config << ENDL
|
|
# This is a full line comment.
|
|
[metadata]
|
|
crc = 0
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
# This is a full line comment.
|
|
[metadata]
|
|
crc = 0
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
#This is a full line comment.
|
|
[metadata]
|
|
crc = 0
|
|
ENDL
|
|
|
|
echo End of line comment
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
crc = 0 ; This is an eol comment.
|
|
ENDL
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
crc = 0 ;This is an eol comment.
|
|
ENDL
|
|
|
|
echo Multiple directives
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
crc = 0
|
|
finobt = 0
|
|
ENDL
|
|
|
|
echo Multiple sections
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
crc = 0
|
|
|
|
[inode]
|
|
sparse = 0
|
|
ENDL
|
|
|
|
echo No directives at all
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
ENDL
|
|
|
|
echo Space around the section name
|
|
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 Single space around the key/value directive
|
|
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 Two spaces around the key/value directive
|
|
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 Three spaces around the key/value directive
|
|
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 Four spaces around the key/value directive
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
crc = 0
|
|
ENDL
|
|
|
|
echo Arbitrary spaces and tabs
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
crc = 0
|
|
ENDL
|
|
|
|
echo ambiguous comment/section names
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
#[data]
|
|
crc = 0
|
|
ENDL
|
|
|
|
echo ambiguous comment/variable names
|
|
test_mkfs_config << ENDL
|
|
[metadata]
|
|
#foo = 0 ; is this a comment or a key '#foo' ?
|
|
ENDL
|
|
|
|
# success, all done
|
|
status=0
|
|
exit
|