Re: [PATCH v2] xfstests: xfs mount option sanity test

Darrick J. Wong
2020-01-13T18:24:20Z

On Mon, Jan 13, 2020 at 10:00:36AM -0800, Darrick J. Wong wrote:
> On Wed, Oct 30, 2019 at 06:34:10PM +0800, Zorro Lang wrote:
> > XFS is changing to suit the new mount API, so add this case to make
> > sure the changing won't bring in regression issue on xfs mount option
> > parse phase, and won't change some default behaviors either.
>
> This testcase examines the intersection of some mkfs options and a large
> number of mount options, but it doesn't log any breadcrumbs of which
> scenario it's testing at any given time. When something goes wrong,
> it's /very/ difficult to map that back to the do_mkfs/do_test call.
>
> (FWIW I added this test as xfs/997 and attached the diff I needed to

HAH I lied. Here's the patch.

--D

From: Darrick J. Wong <darrick.wong@oracle.com>
Subject: [PATCH] xfs/997: fix problems with test

Fix problems with Zorro Lang's new mount options test.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
tests/xfs/997 | 19 ++++++-----
tests/xfs/997.out | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 105 insertions(+), 8 deletions(-)

diff --git a/tests/xfs/997 b/tests/xfs/997
index a662f6f7..9d59b4f4 100755
--- a/tests/xfs/997
+++ b/tests/xfs/997
@@ -65,7 +65,8 @@ mkdir -p $LOOP_MNT || _fail "cannot create loopback mount point"
MKFS_OPTIONS=""
do_mkfs()
{
- $MKFS_XFS_PROG -f $* $LOOP_DEV | _filter_mkfs >$seqres.full 2>$tmp.mkfs
+ echo "FORMAT: $@" | tee -a $seqres.full
+ $MKFS_XFS_PROG -f $* $LOOP_DEV | _filter_mkfs >>$seqres.full 2>$tmp.mkfs
if [ "${PIPESTATUS[0]}" -ne 0 ]; then
_fail "Fails on _mkfs_dev $* $LOOP_DEV"
fi
@@ -99,12 +100,12 @@ _do_test()
local info

# mount test
- _mount $LOOP_DEV $LOOP_MNT $opts 2>/dev/null
+ _mount $LOOP_DEV $LOOP_MNT $opts 2>>$seqres.full
rc=$?
if [ $rc -eq 0 ];then
if [ "${mounted}" = "fail" ];then
echo "[FAILED]: mount $LOOP_DEV $LOOP_MNT $opts"
- echo "ERROR: expect ${mounted}, but pass"
+ echo "ERROR: expect mount to fail, but it succeeded"
return 1
fi
is_dev_mounted
@@ -114,9 +115,9 @@ _do_test()
return 1
fi
else
- if [ "${mount_ret}" = "pass" ];then
+ if [ "${mounted}" = "pass" ];then
echo "[FAILED]: mount $LOOP_DEV $LOOP_MNT $opts"
- echo "ERROR: expect ${mounted}, but fail"
+ echo "ERROR: expect mount to succeed, but it failed"
return 1
fi
is_dev_mounted
@@ -133,18 +134,18 @@ _do_test()
fi
# Check the mount options after fs mounted.
info=`get_mount_info`
- echo $info | grep -q "${key}"
+ echo "${info}" | grep -q "${key}"
rc=$?
if [ $rc -eq 0 ];then
if [ "$found" != "true" ];then
echo "[FAILED]: mount $LOOP_DEV $LOOP_MNT $opts"
- echo "ERROR: expect there's not $key in $info, but not found"
+ echo "ERROR: expected to find \"$key\" in mount info \"$info\""
return 1
fi
else
if [ "$found" != "false" ];then
echo "[FAILED]: mount $LOOP_DEV $LOOP_MNT $opts"
- echo "ERROR: expect there's $key in $info, but found"
+ echo "ERROR: did not expect to find \"$key\" in \"$info\""
return 1
fi
fi
@@ -154,6 +155,8 @@ _do_test()

do_test()
{
+ echo "TEST: $@" | tee -a $seqres.full
+
# force unmount before testing
force_unmount
_do_test "$@"
diff --git a/tests/xfs/997.out b/tests/xfs/997.out
index f2fc684f..c6624925 100644
--- a/tests/xfs/997.out
+++ b/tests/xfs/997.out
@@ -3,4 +3,98 @@ QA output created by 997
** create loop log device
** create loop mount point
** start xfs mount testing ...
+FORMAT:
+TEST: pass allocsize false
+TEST: -o allocsize=4k pass allocsize=4k true
+TEST: -o allocsize=1048576k pass allocsize=1048576k true
+TEST: -o allocsize=2048 fail
+TEST: -o allocsize=2g fail
+FORMAT: -m crc=1
+TEST: pass attr2 true
+TEST: -o attr2 pass attr2 true
+TEST: -o noattr2 fail
+FORMAT: -m crc=0
+TEST: pass attr2 true
+TEST: -o attr2 pass attr2 true
+TEST: -o noattr2 pass attr2 false
+FORMAT:
+TEST: pass discard false
+TEST: -o discard pass discard true
+TEST: -o nodiscard pass discard false
+TEST: pass grpid false
+TEST: -o grpid pass grpid true
+TEST: -o bsdgroups pass grpid true
+TEST: -o nogrpid pass grpid false
+TEST: -o sysvgroups pass grpid false
+TEST: pass filestreams false
+TEST: -o filestreams pass filestreams true
+TEST: pass ikeep false
+TEST: -o ikeep pass ikeep true
+TEST: -o noikeep pass ikeep false
+TEST: pass inode64 true
+TEST: -o inode32 pass inode32 true
+TEST: -o inode64 pass inode64 true
+TEST: pass largeio false
+TEST: -o largeio pass largeio true
+TEST: -o nolargeio pass largeio false
+TEST: -o logbufs=8 pass logbufs=8 true
+TEST: -o logbufs=2 pass logbufs=2 true
+TEST: -o logbufs=1 fail
+TEST: -o logbufs=9 fail
+TEST: -o logbufs=99999999999999 fail
+FORMAT: -m crc=1 -l version=2
+TEST: -o logbsize=16384 pass logbsize=16k true
+TEST: -o logbsize=16k pass logbsize=16k true
+TEST: -o logbsize=32k pass logbsize=32k true
+TEST: -o logbsize=64k pass logbsize=64k true
+TEST: -o logbsize=128k pass logbsize=128k true
+TEST: -o logbsize=256k pass logbsize=256k true
+TEST: -o logbsize=8k fail
+TEST: -o logbsize=512k fail
+FORMAT: -m crc=0 -l version=1
+TEST: -o logbsize=16384 pass logbsize=16k true
+TEST: -o logbsize=16k pass logbsize=16k true
+TEST: -o logbsize=32k pass logbsize=32k true
+TEST: -o logbsize=64k fail
+FORMAT:
+TEST: pass logdev false
+TEST: -o logdev=/dev/loop1 fail
+FORMAT: -l logdev=/dev/loop1
+TEST: -o logdev=/dev/loop1 pass logdev=/dev/loop1 true
+TEST: fail
+FORMAT:
+TEST: pass noalign false
+TEST: -o noalign pass noalign true
+TEST: pass norecovery false
+TEST: -o norecovery,ro pass norecovery true
+TEST: -o norecovery fail
+TEST: pass nouuid false
+TEST: -o nouuid pass nouuid true
+TEST: pass noquota true
+TEST: -o noquota pass noquota true
+TEST: pass usrquota false
+TEST: -o uquota pass usrquota true
+TEST: -o usrquota pass usrquota true
+TEST: -o quota pass usrquota true
+TEST: -o uqnoenforce pass usrquota true
+TEST: -o qnoenforce pass usrquota true
+TEST: pass grpquota false
+TEST: -o gquota pass grpquota true
+TEST: -o grpquota pass grpquota true
+TEST: -o gqnoenforce pass gqnoenforce true
+TEST: pass prjquota false
+TEST: -o pquota pass prjquota true
+TEST: -o prjquota pass prjquota true
+TEST: -o pqnoenforce pass pqnoenforce true
+FORMAT: -d sunit=128,swidth=128
+TEST: -o sunit=8,swidth=8 pass sunit=8,swidth=8 true
+TEST: -o sunit=8,swidth=64 pass sunit=8,swidth=64 true
+TEST: -o sunit=128,swidth=128 pass sunit=128,swidth=128 true
+TEST: -o sunit=256,swidth=256 pass sunit=256,swidth=256 true
+TEST: -o sunit=2,swidth=2 fail
+FORMAT:
+TEST: pass swalloc false
+TEST: -o swalloc pass swalloc true
+TEST: pass wsync false
+TEST: -o wsync pass wsync true
** end of testing