xfs: test mkfs.xfs config files
PATCH 1/1 xfs: test mkfs.xfs config files
From: "Darrick J. Wong" <[email protected]>
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.]
--- common/xfs | 10 +++ tests/xfs/716 | 219 ++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/716.out | 16 ++++ tests/xfs/717 | 195 +++++++++++++++++++++++++++++++++++++++++ tests/xfs/717.out | 13 +++ tests/xfs/718 | 65 ++++++++++++++ tests/xfs/718.out | 2 + tests/xfs/719 | 62 +++++++++++++ tests/xfs/719.out | 2 + tests/xfs/720 | 64 ++++++++++++++ tests/xfs/720.out | 3 + tests/xfs/group | 5 ++ 12 files changed, 656 insertions(+) create mode 100755 tests/xfs/716 create mode 100644 tests/xfs/716.out create mode 100755 tests/xfs/717 create mode 100644 tests/xfs/717.out create mode 100755 tests/xfs/718 create mode 100644 tests/xfs/718.out create mode 100755 tests/xfs/719 create mode 100644 tests/xfs/719.out create mode 100755 tests/xfs/720 create mode 100644 tests/xfs/720.out
common/xfs +10 -0
@@ -700,6 +700,16 @@ _require_xfs_mkfs_ciname() || _notrun "need case-insensitive naming support in mkfs.xfs" } +# this test requires mkfs.xfs have configuration file support +_require_xfs_mkfs_cfgfile() +{ + echo > /tmp/a + _scratch_mkfs_xfs_supported -c options=/tmp/a >/dev/null 2>&1 + res=$? + rm -rf /tmp/a + test $res -eq 0 || _notrun "need configuration file support in mkfs.xfs" +} + # XFS_DEBUG requirements _require_xfs_debug() {
tests/xfs/716 new file +219 -0
219 lines not on this page · raw message
tests/xfs/716.out new file +16 -0
@@ -0,0 +1,16 @@ +QA output created by 716 +Simplest config file +Piped-in config file +Full line comment +End of line comment +Multiple directives +Multiple sections +No directives at all +Space around the section name +Single space around the key/value directive +Two spaces around the key/value directive +Three spaces around the key/value directive +Four spaces around the key/value directive +Arbitrary spaces and tabs +ambiguous comment/section names +ambiguous comment/variable names
tests/xfs/717 new file +195 -0
195 lines not on this page · raw message
tests/xfs/717.out new file +13 -0
@@ -0,0 +1,13 @@ +QA output created by 717 +Spaces in a section name +Spaces in the middle of a key name +Invalid value +Nonexistent sections +Nonexistent keys +Only zero or one +sysctl style files +binaries +respecified options +respecified sections +ambiguous comment/section names +ambiguous comment/variable names
tests/xfs/718 new file +65 -0
65 lines not on this page · raw message
tests/xfs/718.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 718 +Silence is golden
tests/xfs/719 new file +62 -0
62 lines not on this page · raw message
tests/xfs/719.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 719 +Silence is golden
tests/xfs/720 new file +64 -0
64 lines not on this page · raw message
tests/xfs/720.out new file +3 -0
@@ -0,0 +1,3 @@ +QA output created by 720 +rmapbt not supported without CRC support +rmapbt not supported without CRC support
tests/xfs/group +5 -0
@@ -519,3 +519,8 @@ 519 auto quick reflink 520 auto quick reflink 521 auto quick realtime growfs +716 auto quick mkfs +717 auto quick mkfs +718 auto quick mkfs +719 auto quick mkfs +720 auto quick mkfs
Signature · 1 line
2.28.0
Quoted 145 lines · Dave Chinner
From: "Darrick J. Wong" <[email protected]>
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 <[email protected]>Signed-off-by Dave Chinner <[email protected]>--- common/xfs | 10 +++ tests/xfs/716 | 219 ++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/716.out | 16 ++++ tests/xfs/717 | 195 +++++++++++++++++++++++++++++++++++++++++ tests/xfs/717.out | 13 +++ tests/xfs/718 | 65 ++++++++++++++ tests/xfs/718.out | 2 + tests/xfs/719 | 62 +++++++++++++ tests/xfs/719.out | 2 + tests/xfs/720 | 64 ++++++++++++++ tests/xfs/720.out | 3 + tests/xfs/group | 5 ++ 12 files changed, 656 insertions(+) create mode 100755 tests/xfs/716 create mode 100644 tests/xfs/716.out create mode 100755 tests/xfs/717 create mode 100644 tests/xfs/717.out create mode 100755 tests/xfs/718 create mode 100644 tests/xfs/718.out create mode 100755 tests/xfs/719 create mode 100644 tests/xfs/719.out create mode 100755 tests/xfs/720 create mode 100644 tests/xfs/720.outcommon/xfs +10
-0@@ -700,6 +700,16 @@ _require_xfs_mkfs_ciname() || _notrun "need case-insensitive naming support in mkfs.xfs" } +# this test requires mkfs.xfs have configuration file support +_require_xfs_mkfs_cfgfile() +{ + echo > /tmp/a + _scratch_mkfs_xfs_supported -c options=/tmp/a >/dev/null 2>&1 + res=$? + rm -rf /tmp/a + test $res -eq 0 || _notrun "need configuration file support in mkfs.xfs" +} + # XFS_DEBUG requirements _require_xfs_debug() {tests/xfs/716 new file +82
-0@@ -0,0 +1,219 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020 Oracle. All Rights Reserved. +# +# FS QA Test 716 +# +# 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 generic +_require_test +_require_scratch_nocheck +_require_xfs_mkfs_cfgfile + +def_cfgfile=$TEST_DIR/a +fsimg=$TEST_DIR/a.img +rm -rf $def_cfgfile $fsimg +truncate -s 20t $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
tests/xfs/716 line 92
Quoted 10 lines
tests/xfs/716 new file +10
-0+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.
Hey, wait a minute, the manpage didn't say I could use semicolon comments! :)
The libinih page https://github.com/benhoyt/inih says you can though.
Would you mind making a note of that in patch 5 above, please?
--D
Quoted 619 lines
tests/xfs/716 new file +127
-0+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 +exittests/xfs/716.out new file +16
-0@@ -0,0 +1,16 @@ +QA output created by 716 +Simplest config file +Piped-in config file +Full line comment +End of line comment +Multiple directives +Multiple sections +No directives at all +Space around the section name +Single space around the key/value directive +Two spaces around the key/value directive +Three spaces around the key/value directive +Four spaces around the key/value directive +Arbitrary spaces and tabs +ambiguous comment/section names +ambiguous comment/variable namestests/xfs/717 new file +195
-0@@ -0,0 +1,195 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020 Oracle. All Rights Reserved. +# +# FS QA Test 717 +# +# Feed invalid mkfs config files to the mkfs parser to ensure that they are +# recognized as invalid. +# +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 generic +_require_test +_require_scratch_nocheck +_require_xfs_mkfs_cfgfile + +def_cfgfile=$TEST_DIR/a +fsimg=$TEST_DIR/a.img +rm -rf $def_cfgfile $fsimg +truncate -s 20t $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 +exittests/xfs/717.out new file +13
-0@@ -0,0 +1,13 @@ +QA output created by 717 +Spaces in a section name +Spaces in the middle of a key name +Invalid value +Nonexistent sections +Nonexistent keys +Only zero or one +sysctl style files +binaries +respecified options +respecified sections +ambiguous comment/section names +ambiguous comment/variable namestests/xfs/718 new file +65
-0@@ -0,0 +1,65 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020 Oracle. All Rights Reserved. +# +# FS QA Test 718 +# +# Test formatting with a well known config file. +# +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 generic +_require_test +_require_scratch_nocheck +_require_xfs_mkfs_cfgfile + +echo "Silence is golden" + +def_cfgfile=$TEST_DIR/a +fsimg=$TEST_DIR/a.img +rm -rf $def_cfgfile $fsimg +truncate -s 20t $fsimg + +cat > $def_cfgfile << ENDL +[metadata] +crc = 1 +rmapbt = 1 +reflink = 1 + +[inode] +sparse = 1 +ENDL + +$MKFS_XFS_PROG -c options=$def_cfgfile -f $SCRATCH_DEV > $tmp.mkfs +cat $tmp.mkfs >> $seqres.full +grep -q 'crc=1' $tmp.mkfs || echo 'v5 not enabled' +grep -q 'rmapbt=1' $tmp.mkfs || echo 'rmap not enabled' +grep -q 'reflink=1' $tmp.mkfs || echo 'reflink not enabled' +grep -q 'sparse=1' $tmp.mkfs || echo 'sparse inodes not enabled' + +# success, all done +status=0 +exittests/xfs/718.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 718 +Silence is goldentests/xfs/719 new file +62
-0@@ -0,0 +1,62 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020 Oracle. All Rights Reserved. +# +# FS QA Test 719 +# +# Test formatting with a config file that contains conflicting options. +# +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 +} + +# 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 generic +_require_test +_require_scratch_nocheck +_require_xfs_mkfs_cfgfile + +echo "Silence is golden" + +def_cfgfile=$TEST_DIR/a +rm -rf $def_cfgfile + +cat > $def_cfgfile << ENDL +[metadata] +crc = 0 +rmapbt = 1 +reflink = 1 + +[inode] +sparse = 1 +ENDL + +$MKFS_XFS_PROG -c options=$def_cfgfile -f $SCRATCH_DEV > $tmp.mkfs 2>&1 +if [ $? -eq 0 ]; then + echo "mkfs.xfs did not fail!" + cat $tmp.mkfs +fi + +# success, all done +status=0 +exittests/xfs/719.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 719 +Silence is goldentests/xfs/720 new file +64
-0@@ -0,0 +1,64 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020 Oracle. All Rights Reserved. +# +# FS QA Test 720 +# +# Test formatting with conflicts between the config file and the cli. +# +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 +} + +# 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 generic +_require_test +_require_scratch_nocheck +_require_xfs_mkfs_cfgfile + +cfgfile=$TEST_DIR/a +rm -rf $cfgfile + +# disable crc in config file, enable rmapbt (which requires crc=1) in cli +cat > $cfgfile << ENDL +[metadata] +crc = 0 +ENDL + +$MKFS_XFS_PROG -c options=$cfgfile -f -m rmapbt=1 $SCRATCH_DEV > $tmp.mkfs 2>&1 +cat $tmp.mkfs >> $seqres.full +grep 'rmapbt not supported without CRC support' $tmp.mkfs + +# enable rmapbt (which requires crc=1) in config file, disable crc in cli +cat > $cfgfile << ENDL +[metadata] +rmapbt = 1 +ENDL + +$MKFS_XFS_PROG -c options=$cfgfile -f -m crc=0 $SCRATCH_DEV > $tmp.mkfs 2>&1 +cat $tmp.mkfs >> $seqres.full +grep 'rmapbt not supported without CRC support' $tmp.mkfs + +# success, all done +status=0 +exittests/xfs/720.out new file +3
-0@@ -0,0 +1,3 @@ +QA output created by 720 +rmapbt not supported without CRC support +rmapbt not supported without CRC supporttests/xfs/group +5
-0@@ -519,3 +519,8 @@ 519 auto quick reflink 520 auto quick reflink 521 auto quick realtime growfs +716 auto quick mkfs +717 auto quick mkfs +718 auto quick mkfs +719 auto quick mkfs +720 auto quick mkfsSignature · 1 line
2.28.0
Quoted 160 lines · Darrick J. Wong
Quoted 145 lines · Dave Chinner
From: "Darrick J. Wong" <[email protected]>
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 <[email protected]>Signed-off-by Dave Chinner <[email protected]>--- common/xfs | 10 +++ tests/xfs/716 | 219 ++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/716.out | 16 ++++ tests/xfs/717 | 195 +++++++++++++++++++++++++++++++++++++++++ tests/xfs/717.out | 13 +++ tests/xfs/718 | 65 ++++++++++++++ tests/xfs/718.out | 2 + tests/xfs/719 | 62 +++++++++++++ tests/xfs/719.out | 2 + tests/xfs/720 | 64 ++++++++++++++ tests/xfs/720.out | 3 + tests/xfs/group | 5 ++ 12 files changed, 656 insertions(+) create mode 100755 tests/xfs/716 create mode 100644 tests/xfs/716.out create mode 100755 tests/xfs/717 create mode 100644 tests/xfs/717.out create mode 100755 tests/xfs/718 create mode 100644 tests/xfs/718.out create mode 100755 tests/xfs/719 create mode 100644 tests/xfs/719.out create mode 100755 tests/xfs/720 create mode 100644 tests/xfs/720.outcommon/xfs +10
-0@@ -700,6 +700,16 @@ _require_xfs_mkfs_ciname() || _notrun "need case-insensitive naming support in mkfs.xfs" } +# this test requires mkfs.xfs have configuration file support +_require_xfs_mkfs_cfgfile() +{ + echo > /tmp/a + _scratch_mkfs_xfs_supported -c options=/tmp/a >/dev/null 2>&1 + res=$? + rm -rf /tmp/a + test $res -eq 0 || _notrun "need configuration file support in mkfs.xfs" +} + # XFS_DEBUG requirements _require_xfs_debug() {tests/xfs/716 new file +82
-0@@ -0,0 +1,219 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020 Oracle. All Rights Reserved. +# +# FS QA Test 716 +# +# 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 generic +_require_test +_require_scratch_nocheck +_require_xfs_mkfs_cfgfile + +def_cfgfile=$TEST_DIR/a +fsimg=$TEST_DIR/a.img +rm -rf $def_cfgfile $fsimg +truncate -s 20t $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 +ENDLtests/xfs/716 line 92
Quoted 10 lines
tests/xfs/716 new file +10
-0+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.Hey, wait a minute, the manpage didn't say I could use semicolon comments! :)
Quoted 3 lines
The libinih page https://github.com/benhoyt/inih says you can though.
Would you mind making a note of that in patch 5 above, please?
Ping? The mkfs code has been merged upstream; we ought to land the functionality tests.
--D
Quoted 621 lines
--D
Quoted 619 lines
tests/xfs/716 new file +127
-0+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 +exittests/xfs/716.out new file +16
-0@@ -0,0 +1,16 @@ +QA output created by 716 +Simplest config file +Piped-in config file +Full line comment +End of line comment +Multiple directives +Multiple sections +No directives at all +Space around the section name +Single space around the key/value directive +Two spaces around the key/value directive +Three spaces around the key/value directive +Four spaces around the key/value directive +Arbitrary spaces and tabs +ambiguous comment/section names +ambiguous comment/variable namestests/xfs/717 new file +195
-0@@ -0,0 +1,195 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020 Oracle. All Rights Reserved. +# +# FS QA Test 717 +# +# Feed invalid mkfs config files to the mkfs parser to ensure that they are +# recognized as invalid. +# +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 generic +_require_test +_require_scratch_nocheck +_require_xfs_mkfs_cfgfile + +def_cfgfile=$TEST_DIR/a +fsimg=$TEST_DIR/a.img +rm -rf $def_cfgfile $fsimg +truncate -s 20t $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 +exittests/xfs/717.out new file +13
-0@@ -0,0 +1,13 @@ +QA output created by 717 +Spaces in a section name +Spaces in the middle of a key name +Invalid value +Nonexistent sections +Nonexistent keys +Only zero or one +sysctl style files +binaries +respecified options +respecified sections +ambiguous comment/section names +ambiguous comment/variable namestests/xfs/718 new file +65
-0@@ -0,0 +1,65 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020 Oracle. All Rights Reserved. +# +# FS QA Test 718 +# +# Test formatting with a well known config file. +# +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 generic +_require_test +_require_scratch_nocheck +_require_xfs_mkfs_cfgfile + +echo "Silence is golden" + +def_cfgfile=$TEST_DIR/a +fsimg=$TEST_DIR/a.img +rm -rf $def_cfgfile $fsimg +truncate -s 20t $fsimg + +cat > $def_cfgfile << ENDL +[metadata] +crc = 1 +rmapbt = 1 +reflink = 1 + +[inode] +sparse = 1 +ENDL + +$MKFS_XFS_PROG -c options=$def_cfgfile -f $SCRATCH_DEV > $tmp.mkfs +cat $tmp.mkfs >> $seqres.full +grep -q 'crc=1' $tmp.mkfs || echo 'v5 not enabled' +grep -q 'rmapbt=1' $tmp.mkfs || echo 'rmap not enabled' +grep -q 'reflink=1' $tmp.mkfs || echo 'reflink not enabled' +grep -q 'sparse=1' $tmp.mkfs || echo 'sparse inodes not enabled' + +# success, all done +status=0 +exittests/xfs/718.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 718 +Silence is goldentests/xfs/719 new file +62
-0@@ -0,0 +1,62 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020 Oracle. All Rights Reserved. +# +# FS QA Test 719 +# +# Test formatting with a config file that contains conflicting options. +# +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 +} + +# 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 generic +_require_test +_require_scratch_nocheck +_require_xfs_mkfs_cfgfile + +echo "Silence is golden" + +def_cfgfile=$TEST_DIR/a +rm -rf $def_cfgfile + +cat > $def_cfgfile << ENDL +[metadata] +crc = 0 +rmapbt = 1 +reflink = 1 + +[inode] +sparse = 1 +ENDL + +$MKFS_XFS_PROG -c options=$def_cfgfile -f $SCRATCH_DEV > $tmp.mkfs 2>&1 +if [ $? -eq 0 ]; then + echo "mkfs.xfs did not fail!" + cat $tmp.mkfs +fi + +# success, all done +status=0 +exittests/xfs/719.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 719 +Silence is goldentests/xfs/720 new file +64
-0@@ -0,0 +1,64 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2020 Oracle. All Rights Reserved. +# +# FS QA Test 720 +# +# Test formatting with conflicts between the config file and the cli. +# +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 +} + +# 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 generic +_require_test +_require_scratch_nocheck +_require_xfs_mkfs_cfgfile + +cfgfile=$TEST_DIR/a +rm -rf $cfgfile + +# disable crc in config file, enable rmapbt (which requires crc=1) in cli +cat > $cfgfile << ENDL +[metadata] +crc = 0 +ENDL + +$MKFS_XFS_PROG -c options=$cfgfile -f -m rmapbt=1 $SCRATCH_DEV > $tmp.mkfs 2>&1 +cat $tmp.mkfs >> $seqres.full +grep 'rmapbt not supported without CRC support' $tmp.mkfs + +# enable rmapbt (which requires crc=1) in config file, disable crc in cli +cat > $cfgfile << ENDL +[metadata] +rmapbt = 1 +ENDL + +$MKFS_XFS_PROG -c options=$cfgfile -f -m crc=0 $SCRATCH_DEV > $tmp.mkfs 2>&1 +cat $tmp.mkfs >> $seqres.full +grep 'rmapbt not supported without CRC support' $tmp.mkfs + +# success, all done +status=0 +exittests/xfs/720.out new file +3
-0@@ -0,0 +1,3 @@ +QA output created by 720 +rmapbt not supported without CRC support +rmapbt not supported without CRC supporttests/xfs/group +5
-0@@ -519,3 +519,8 @@ 519 auto quick reflink 520 auto quick reflink 521 auto quick realtime growfs +716 auto quick mkfs +717 auto quick mkfs +718 auto quick mkfs +719 auto quick mkfs +720 auto quick mkfsSignature · 1 line
2.28.0
Quoted 10 lines · Darrick J. Wong
Quoted 9 lines · Darrick J. Wong
tests/xfs/716 line 92
Quoted 4 lines · Dave Chinner
tests/xfs/716 new file +4
-0+echo End of line comment +test_mkfs_config << ENDL +[metadata] +crc = 0 ; This is an eol comment.Hey, wait a minute, the manpage didn't say I could use semicolon comments! :)
Quoted 6 lines
Quoted 3 lines
The libinih page https://github.com/benhoyt/inih says you can though.
Would you mind making a note of that in patch 5 above, please?
Ping? The mkfs code has been merged upstream; we ought to land the functionality tests.
Nothing in this patch needs to change, AFAIA, because you were referring to the xfsprogs mkfs patchset in your comment. So this is really only waiting on review, right? Do I need to repost it?
-Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 13 lines · Dave Chinner
Quoted 12 lines · Darrick J. Wong
Quoted 11 lines · Darrick J. Wong
tests/xfs/716 line 92
Quoted 4 lines · Dave Chinner
tests/xfs/716 new file +4
-0+echo End of line comment +test_mkfs_config << ENDL +[metadata] +crc = 0 ; This is an eol comment.Hey, wait a minute, the manpage didn't say I could use semicolon comments! :)
The libinih page https://github.com/benhoyt/inih says you can though.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Would you mind making a note of that in patch 5 above, please?
Ping? The mkfs code has been merged upstream; we ought to land the functionality tests.
Nothing in this patch needs to change, AFAIA, because you were referring to the xfsprogs mkfs patchset in your comment. So this is really only waiting on review, right? Do I need to repost it?
Probably, as it's entirely possible that it's gotten lost in Eryu's mail stream.
--D
Quoted 4 lines
-Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 19 lines · Darrick J. Wong
Quoted 18 lines · Dave Chinner
Quoted 16 lines · Darrick J. Wong
Quoted 9 lines · Darrick J. Wong
tests/xfs/716 line 92
Quoted 4 lines · Dave Chinner
tests/xfs/716 new file +4
-0+echo End of line comment +test_mkfs_config << ENDL +[metadata] +crc = 0 ; This is an eol comment.Hey, wait a minute, the manpage didn't say I could use semicolon comments! :)
Quoted 3 lines
The libinih page https://github.com/benhoyt/inih says you can though.
Would you mind making a note of that in patch 5 above, please?
Ping? The mkfs code has been merged upstream; we ought to land the functionality tests.
Quoted 6 lines
Quoted 3 lines
Nothing in this patch needs to change, AFAIA, because you were referring to the xfsprogs mkfs patchset in your comment. So this is really only waiting on review, right? Do I need to repost it?
Probably, as it's entirely possible that it's gotten lost in Eryu's mail stream.
You were right, it's lost in my 'to-review' queue.. Thanks for the reminder!
I did some minor modifications to the patches, such as update supported fs from 'generic' to 'xfs', and change truncate command to $XFS_IO_PROG -c "truncate".
Thanks,
Eryu
Quoted 7 lines
--D
Quoted 4 lines
-Dave.
Signature · 2 lines
Dave Chinner [email protected]