xfs/288: test xfs_growfs to ensure rejection if target isn't mounted
PATCH 1/1 xfs/288: test xfs_growfs to ensure rejection if target isn't mounted
The manpage for xfs_growfs specifies that the file/dir to be grown must be mounted. This is a test to ensure that if the target isn't mounted, the command is rejected. The test covers absolute paths and relative paths, including symbolic links and bind mounts.
--- tests/xfs/288 | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/288.out | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/group | 1 + 3 files changed, 241 insertions(+) create mode 100755 tests/xfs/288 create mode 100644 tests/xfs/288.out
tests/xfs/288 new file +121 -0
@@ -0,0 +1,121 @@ +#! /bin/bash +# FS QA Test 288 +# +# Test to ensure xfs_growfs command rejects non-existent mount points +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +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() +{ + umount $tmpdir + umount $tmpbind + rmdir $tmpdir + rm -f $tmpsymlink + rmdir $tmpbind + rm -f $tmp + rm -f $tmpfile +} + +# 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 +_supported_os Linux +_require_test +_require_loop + +tmpfile=$TEST_DIR/fsfile +tmpdir=$TEST_DIR/tmpdir +tmpsymlink=$TEST_DIR/tmpsymlink.$$ +tmpbind=$TEST_DIR/tmpbind.$$ + +mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir" + +echo "=== mkfs.xfs ===" +mkfs.xfs -d file,name=$tmpfile,size=64m -f + +echo "=== truncate ===" +truncate --size=128m $tmpfile + +echo "=== xfs_growfs - unmounted, command should be rejected ===" +xfs_growfs $tmpdir + +echo "=== xfs_growfs - check relative path, unmounted ===" +cd $TEST_DIR +xfs_growfs ./tmpdir + +echo "=== xfs_growfs - no path, unmounted ===" +cd $TEST_DIR +xfs_growfs tmpdir + +echo "=== mount ===" +mount -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount" + +echo "=== xfs_growfs - mounted ===" +xfs_growfs $tmpdir + +echo "=== xfs_growfs - check relative path ===" +cd $TEST_DIR +xfs_growfs ./tmpdir + +echo "=== xfs_growfs - no path ===" +cd $TEST_DIR +xfs_growfs tmpdir + +echo "=== test symbolic link ===" +ln -s $tmpdir $tmpsymlink +xfs_growfs $tmpsymlink + +echo "=== test symbolic link using relative path ===" +xfs_growfs ./tmpsymlink.$$ + +echo "=== test symbolic link using no path ===" +xfs_growfs tmpsymlink.$$ + +echo "=== test bind mount ===" +mkdir $tmpbind +mount -o bind $tmpdir $tmpbind +xfs_growfs $tmpbind + +echo "=== test bind mount - relative path ===" + +xfs_growfs ./tmpbind.$$ + +echo "=== test bind mount - no path ===" +xfs_growfs tmpbind.$$ + +# success, all done +status=0 +exit
tests/xfs/288.out new file +119 -0
119 lines not on this page · raw message
tests/xfs/group +1 -0
@@ -285,6 +285,7 @@ 285 dangerous_fuzzers dangerous_scrub 286 dangerous_fuzzers dangerous_scrub dangerous_online_repair 287 auto dump quota quick +288 growfs auto quick 290 auto rw prealloc quick ioctl zero 291 auto repair 292 auto mkfs quick
Signature · 1 line
2.9.3
Quoted 78 lines · Bill O'Donnell
The manpage for
xfs_growfsspecifies that the file/dir to be grown must be mounted. This is a test to ensure that if the target isn't mounted, the command is rejected. The test covers absolute paths and relative paths, including symbolic links and bind mounts.Signed-off-by Bill O'Donnell <[email protected]>--- tests/xfs/288 | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/288.out | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/group | 1 + 3 files changed, 241 insertions(+) create mode 100755 tests/xfs/288 create mode 100644 tests/xfs/288.outtests/xfs/288 new file +57
-0@@ -0,0 +1,121 @@ +#! /bin/bash +# FS QA Test 288 +# +# Test to ensure xfs_growfs command rejects non-existent mount points +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +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() +{ + umount $tmpdir + umount $tmpbind + rmdir $tmpdir + rm -f $tmpsymlink + rmdir $tmpbind + rm -f $tmp + rm -f $tmpfile +} + +# 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 +_supported_os Linux +_require_test +_require_loop
tests/xfs/288 line 67
Quoted 10 lines
tests/xfs/288 new file +10
-0+ +tmpfile=$TEST_DIR/fsfile +tmpdir=$TEST_DIR/tmpdir +tmpsymlink=$TEST_DIR/tmpsymlink.$$ +tmpbind=$TEST_DIR/tmpbind.$$ + +mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir" + +echo "=== mkfs.xfs ===" +mkfs.xfs -d file,name=$tmpfile,size=64m -f
$MKFS_XFS_PROG -d file...
tests/xfs/288 line 73
Quoted 6 lines
tests/xfs/288 new file +6
-0+ +echo "=== truncate ===" +truncate --size=128m $tmpfile + +echo "=== xfs_growfs - unmounted, command should be rejected ===" +xfs_growfs $tmpdir
$XFS_GROWFS_PROG $tmpdir
Quoted 8 lines
tests/xfs/288 new file +8
-0+ +echo "=== xfs_growfs - check relative path, unmounted ===" +cd $TEST_DIR +xfs_growfs ./tmpdir + +echo "=== xfs_growfs - no path, unmounted ===" +cd $TEST_DIR +xfs_growfs tmpdir
tests/xfs/288 line 91
Quoted 10 lines
tests/xfs/288 new file +10
-0+ +echo "=== mount ===" +mount -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount" + +echo "=== xfs_growfs - mounted ===" +xfs_growfs $tmpdir + +echo "=== xfs_growfs - check relative path ===" +cd $TEST_DIR +xfs_growfs ./tmpdir
So this growfs invocation should succeed, correct? I see agcount doubling but $tmpfile doesn't get expanded... such that all the following growfses have no space to grow the fs, but they also don't spit out error messages.
(Just talking myself through this test...)
Also wondering if this test ought to keep expanding $testfile one AG at a time prior to every growfs test so that test success is keyed off of seeing a "data blocks changed from XXX to YYY" message, just in case the layout ever shifts...
Quoted 36 lines
tests/xfs/288 new file +30
-0+ +echo "=== xfs_growfs - no path ===" +cd $TEST_DIR +xfs_growfs tmpdir + +echo "=== test symbolic link ===" +ln -s $tmpdir $tmpsymlink +xfs_growfs $tmpsymlink + +echo "=== test symbolic link using relative path ===" +xfs_growfs ./tmpsymlink.$$ + +echo "=== test symbolic link using no path ===" +xfs_growfs tmpsymlink.$$ + +echo "=== test bind mount ===" +mkdir $tmpbind +mount -o bind $tmpdir $tmpbind +xfs_growfs $tmpbind + +echo "=== test bind mount - relative path ===" + +xfs_growfs ./tmpbind.$$ + +echo "=== test bind mount - no path ===" +xfs_growfs tmpbind.$$ + +# success, all done +status=0 +exittests/xfs/288.out new file +0
-0
tests/xfs/288.out line 5
Quoted 5 lines
tests/xfs/288.out new file +5
-0@@ -0,0 +1,119 @@ +QA output created by 288 +=== mkfs.xfs === +meta-data=/mnt/test/fsfile isize=512 agcount=4, agsize=4096 blks + = sectsz=512 attr=2, projid32bit=1 + = crc=1 finobt=1, sparse=0, rmapbt=0, reflink=0
Don't let mkfs/growfs output leak into the golden output, because as soon as anything changes the mkfs output (we turn on sparse inodes by default (or rmap, or reflink...) or someone runs this on a 4k sector disk, or...) the golden output will differ from the observed output and ./check will flag this test as failed even if the growfs behavior is exactly what you were looking for.
I think you're testing whether or not the growfs succeeded by comparing agcount, right? You might consider recording the growfs output to a file and importing that into the running shell, like some of the tests seem to do.
tests/xfs/288.out line 14
Quoted 9 lines
tests/xfs/288.out new file +9
-0+data = bsize=4096 blocks=16384, imaxpct=25 + = sunit=0 swidth=0 blks +naming =version 2 bsize=4096 ascii-ci=0 ftype=1 +log =internal log bsize=4096 blocks=855, version=2 + = sectsz=512 sunit=0 blks, lazy-count=1 +realtime =none extsz=4096 blocks=0, rtextents=0 +=== truncate === +=== xfs_growfs - unmounted, command should be rejected === +xfs_growfs: /mnt/test/tmpdir is not a mounted XFS filesystem
Please run the error messages through _filter_test_dir so that we don't hardcode TEST_DIR/SCRATCH_MNT pathnames in test output.
tests/xfs/288.out line 21
Quoted 7 lines
tests/xfs/288.out new file +7
-0+=== xfs_growfs - check relative path, unmounted === +xfs_growfs: ./tmpdir is not a mounted XFS filesystem +=== xfs_growfs - no path, unmounted === +xfs_growfs: tmpdir is not a mounted XFS filesystem +=== mount === +=== xfs_growfs - mounted === +meta-data=/dev/loop0 isize=512 agcount=4, agsize=4096 blks
FWIW mount -o loop doesn't guarantee you /dev/loop0. Imagine if an xfstest user set up TEST_DEV=/dev/loop0.
Quoted 117 lines
tests/xfs/288.out new file +98
-0+ = sectsz=512 attr=2, projid32bit=1 + = crc=1 finobt=1 spinodes=0 rmapbt=0 + = reflink=0 +data = bsize=4096 blocks=16384, imaxpct=25 + = sunit=0 swidth=0 blks +naming =version 2 bsize=4096 ascii-ci=0 ftype=1 +log =internal bsize=4096 blocks=855, version=2 + = sectsz=512 sunit=0 blks, lazy-count=1 +realtime =none extsz=4096 blocks=0, rtextents=0 +data blocks changed from 16384 to 32768 +=== xfs_growfs - check relative path === +meta-data=/dev/loop0 isize=512 agcount=8, agsize=4096 blks + = sectsz=512 attr=2, projid32bit=1 + = crc=1 finobt=1 spinodes=0 rmapbt=0 + = reflink=0 +data = bsize=4096 blocks=32768, imaxpct=25 + = sunit=0 swidth=0 blks +naming =version 2 bsize=4096 ascii-ci=0 ftype=1 +log =internal bsize=4096 blocks=855, version=2 + = sectsz=512 sunit=0 blks, lazy-count=1 +realtime =none extsz=4096 blocks=0, rtextents=0 +=== xfs_growfs - no path === +meta-data=/dev/loop0 isize=512 agcount=8, agsize=4096 blks + = sectsz=512 attr=2, projid32bit=1 + = crc=1 finobt=1 spinodes=0 rmapbt=0 + = reflink=0 +data = bsize=4096 blocks=32768, imaxpct=25 + = sunit=0 swidth=0 blks +naming =version 2 bsize=4096 ascii-ci=0 ftype=1 +log =internal bsize=4096 blocks=855, version=2 + = sectsz=512 sunit=0 blks, lazy-count=1 +realtime =none extsz=4096 blocks=0, rtextents=0 +=== test symbolic link === +meta-data=/dev/loop0 isize=512 agcount=8, agsize=4096 blks + = sectsz=512 attr=2, projid32bit=1 + = crc=1 finobt=1 spinodes=0 rmapbt=0 + = reflink=0 +data = bsize=4096 blocks=32768, imaxpct=25 + = sunit=0 swidth=0 blks +naming =version 2 bsize=4096 ascii-ci=0 ftype=1 +log =internal bsize=4096 blocks=855, version=2 + = sectsz=512 sunit=0 blks, lazy-count=1 +realtime =none extsz=4096 blocks=0, rtextents=0 +=== test symbolic link using relative path === +meta-data=/dev/loop0 isize=512 agcount=8, agsize=4096 blks + = sectsz=512 attr=2, projid32bit=1 + = crc=1 finobt=1 spinodes=0 rmapbt=0 + = reflink=0 +data = bsize=4096 blocks=32768, imaxpct=25 + = sunit=0 swidth=0 blks +naming =version 2 bsize=4096 ascii-ci=0 ftype=1 +log =internal bsize=4096 blocks=855, version=2 + = sectsz=512 sunit=0 blks, lazy-count=1 +realtime =none extsz=4096 blocks=0, rtextents=0 +=== test symbolic link using no path === +meta-data=/dev/loop0 isize=512 agcount=8, agsize=4096 blks + = sectsz=512 attr=2, projid32bit=1 + = crc=1 finobt=1 spinodes=0 rmapbt=0 + = reflink=0 +data = bsize=4096 blocks=32768, imaxpct=25 + = sunit=0 swidth=0 blks +naming =version 2 bsize=4096 ascii-ci=0 ftype=1 +log =internal bsize=4096 blocks=855, version=2 + = sectsz=512 sunit=0 blks, lazy-count=1 +realtime =none extsz=4096 blocks=0, rtextents=0 +=== test bind mount === +meta-data=/dev/loop0 isize=512 agcount=8, agsize=4096 blks + = sectsz=512 attr=2, projid32bit=1 + = crc=1 finobt=1 spinodes=0 rmapbt=0 + = reflink=0 +data = bsize=4096 blocks=32768, imaxpct=25 + = sunit=0 swidth=0 blks +naming =version 2 bsize=4096 ascii-ci=0 ftype=1 +log =internal bsize=4096 blocks=855, version=2 + = sectsz=512 sunit=0 blks, lazy-count=1 +realtime =none extsz=4096 blocks=0, rtextents=0 +=== test bind mount - relative path === +meta-data=/dev/loop0 isize=512 agcount=8, agsize=4096 blks + = sectsz=512 attr=2, projid32bit=1 + = crc=1 finobt=1 spinodes=0 rmapbt=0 + = reflink=0 +data = bsize=4096 blocks=32768, imaxpct=25 + = sunit=0 swidth=0 blks +naming =version 2 bsize=4096 ascii-ci=0 ftype=1 +log =internal bsize=4096 blocks=855, version=2 + = sectsz=512 sunit=0 blks, lazy-count=1 +realtime =none extsz=4096 blocks=0, rtextents=0 +=== test bind mount - no path === +meta-data=/dev/loop0 isize=512 agcount=8, agsize=4096 blks + = sectsz=512 attr=2, projid32bit=1 + = crc=1 finobt=1 spinodes=0 rmapbt=0 + = reflink=0 +data = bsize=4096 blocks=32768, imaxpct=25 + = sunit=0 swidth=0 blks +naming =version 2 bsize=4096 ascii-ci=0 ftype=1 +log =internal bsize=4096 blocks=855, version=2 + = sectsz=512 sunit=0 blks, lazy-count=1 +realtime =none extsz=4096 blocks=0, rtextents=0tests/xfs/group +1
-0@@ -285,6 +285,7 @@ 285 dangerous_fuzzers dangerous_scrub 286 dangerous_fuzzers dangerous_scrub dangerous_online_repair 287 auto dump quota quick +288 growfs auto quick 290 auto rw prealloc quick ioctl zero 291 auto repair 292 auto mkfs quickSignature · 6 lines
2.9.3 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 125 lines · Darrick J. Wong
Quoted 78 lines · Bill O'Donnell
The manpage for
xfs_growfsspecifies that the file/dir to be grown must be mounted. This is a test to ensure that if the target isn't mounted, the command is rejected. The test covers absolute paths and relative paths, including symbolic links and bind mounts.Signed-off-by Bill O'Donnell <[email protected]>--- tests/xfs/288 | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/288.out | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/group | 1 + 3 files changed, 241 insertions(+) create mode 100755 tests/xfs/288 create mode 100644 tests/xfs/288.outtests/xfs/288 new file +57
-0@@ -0,0 +1,121 @@ +#! /bin/bash +# FS QA Test 288 +# +# Test to ensure xfs_growfs command rejects non-existent mount points +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +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() +{ + umount $tmpdir + umount $tmpbind + rmdir $tmpdir + rm -f $tmpsymlink + rmdir $tmpbind + rm -f $tmp + rm -f $tmpfile +} + +# 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 +_supported_os Linux +_require_test +_require_looptests/xfs/288 line 67
Quoted 10 lines
tests/xfs/288 new file +10
-0+ +tmpfile=$TEST_DIR/fsfile +tmpdir=$TEST_DIR/tmpdir +tmpsymlink=$TEST_DIR/tmpsymlink.$$ +tmpbind=$TEST_DIR/tmpbind.$$ + +mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir" + +echo "=== mkfs.xfs ===" +mkfs.xfs -d file,name=$tmpfile,size=64m -f$MKFS_XFS_PROG -d file...
tests/xfs/288 line 73
Quoted 6 lines
tests/xfs/288 new file +6
-0+ +echo "=== truncate ===" +truncate --size=128m $tmpfile + +echo "=== xfs_growfs - unmounted, command should be rejected ===" +xfs_growfs $tmpdir$XFS_GROWFS_PROG $tmpdir
Quoted 8 lines
tests/xfs/288 new file +8
-0+ +echo "=== xfs_growfs - check relative path, unmounted ===" +cd $TEST_DIR +xfs_growfs ./tmpdir + +echo "=== xfs_growfs - no path, unmounted ===" +cd $TEST_DIR +xfs_growfs tmpdirtests/xfs/288 line 91
Quoted 10 lines
tests/xfs/288 new file +10
-0+ +echo "=== mount ===" +mount -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount" + +echo "=== xfs_growfs - mounted ===" +xfs_growfs $tmpdir + +echo "=== xfs_growfs - check relative path ===" +cd $TEST_DIR +xfs_growfs ./tmpdirSo this growfs invocation should succeed, correct? I see agcount doubling but $tmpfile doesn't get expanded... such that all the following growfses have no space to grow the fs, but they also don't spit out error messages.
Quoted 1 line
(Just talking myself through this test...)
There may be no need to actually grow the filesystem to test this behavior; nothing about this part of the tool differentiates between xfs_growfs -n (information on current filesystem, no change) and bare xfs_growfs (i.e. actually grow it ...) right? And same man page for both, specifying "shall be given a mount point to operate on."
Quoted 4 lines
Also wondering if this test ought to keep expanding $testfile one AG at a time prior to every growfs test so that test success is keyed off of seeing a "data blocks changed from XXX to YYY" message, just in case the layout ever shifts...
*shrug* using xfs_growfs -n will test the "does it pass or fail based on on whether it's given a mountpoint" and the actual geometry output won't really matter much...
Growing it is fine too, but it may not be needed. As long as it's consistent, I think.
-Eric
Quoted 139 lines · Eric Sandeen
Quoted 125 lines · Darrick J. Wong
Quoted 78 lines · Bill O'Donnell
The manpage for
xfs_growfsspecifies that the file/dir to be grown must be mounted. This is a test to ensure that if the target isn't mounted, the command is rejected. The test covers absolute paths and relative paths, including symbolic links and bind mounts.Signed-off-by Bill O'Donnell <[email protected]>--- tests/xfs/288 | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/288.out | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/group | 1 + 3 files changed, 241 insertions(+) create mode 100755 tests/xfs/288 create mode 100644 tests/xfs/288.outtests/xfs/288 new file +57
-0@@ -0,0 +1,121 @@ +#! /bin/bash +# FS QA Test 288 +# +# Test to ensure xfs_growfs command rejects non-existent mount points +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +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() +{ + umount $tmpdir + umount $tmpbind + rmdir $tmpdir + rm -f $tmpsymlink + rmdir $tmpbind + rm -f $tmp + rm -f $tmpfile +} + +# 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 +_supported_os Linux +_require_test +_require_looptests/xfs/288 line 67
Quoted 10 lines
tests/xfs/288 new file +10
-0+ +tmpfile=$TEST_DIR/fsfile +tmpdir=$TEST_DIR/tmpdir +tmpsymlink=$TEST_DIR/tmpsymlink.$$ +tmpbind=$TEST_DIR/tmpbind.$$ + +mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir" + +echo "=== mkfs.xfs ===" +mkfs.xfs -d file,name=$tmpfile,size=64m -f$MKFS_XFS_PROG -d file...
tests/xfs/288 line 73
Quoted 6 lines
tests/xfs/288 new file +6
-0+ +echo "=== truncate ===" +truncate --size=128m $tmpfile + +echo "=== xfs_growfs - unmounted, command should be rejected ===" +xfs_growfs $tmpdir$XFS_GROWFS_PROG $tmpdir
Quoted 8 lines
tests/xfs/288 new file +8
-0+ +echo "=== xfs_growfs - check relative path, unmounted ===" +cd $TEST_DIR +xfs_growfs ./tmpdir + +echo "=== xfs_growfs - no path, unmounted ===" +cd $TEST_DIR +xfs_growfs tmpdirtests/xfs/288 line 91
Quoted 10 lines
tests/xfs/288 new file +10
-0+ +echo "=== mount ===" +mount -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount" + +echo "=== xfs_growfs - mounted ===" +xfs_growfs $tmpdir + +echo "=== xfs_growfs - check relative path ===" +cd $TEST_DIR +xfs_growfs ./tmpdirSo this growfs invocation should succeed, correct? I see agcount doubling but $tmpfile doesn't get expanded... such that all the following growfses have no space to grow the fs, but they also don't spit out error messages.
Quoted 1 line
(Just talking myself through this test...)
There may be no need to actually grow the filesystem to test this behavior; nothing about this part of the tool differentiates between
xfs_growfs-n (information on current filesystem, no change) and barexfs_growfs(i.e. actually grow it ...) right? And same man page for both, specifying "shall be given a mount point to operate on."Quoted 4 lines
Also wondering if this test ought to keep expanding $testfile one AG at a time prior to every growfs test so that test success is keyed off of seeing a "data blocks changed from XXX to YYY" message, just in case the layout ever shifts...
Quoted 6 lines
*shrug* using
xfs_growfs-n will test the "does it pass or fail based on on whether it's given a mountpoint" and the actual geometry output won't really matter much...Growing it is fine too, but it may not be needed. As long as it's consistent, I think.
I could make it do that, but yeah, my goal was to merely test the command response behavior, not concerning the test wih the machinations of growfs under the hood.
Thanks-
Bill
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 144 lines · Bill O'Donnell
Quoted 143 lines · Eric Sandeen
Quoted 125 lines · Darrick J. Wong
Quoted 78 lines · Bill O'Donnell
The manpage for
xfs_growfsspecifies that the file/dir to be grown must be mounted. This is a test to ensure that if the target isn't mounted, the command is rejected. The test covers absolute paths and relative paths, including symbolic links and bind mounts.Signed-off-by Bill O'Donnell <[email protected]>--- tests/xfs/288 | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/288.out | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/group | 1 + 3 files changed, 241 insertions(+) create mode 100755 tests/xfs/288 create mode 100644 tests/xfs/288.outtests/xfs/288 new file +57
-0@@ -0,0 +1,121 @@ +#! /bin/bash +# FS QA Test 288 +# +# Test to ensure xfs_growfs command rejects non-existent mount points +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +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() +{ + umount $tmpdir + umount $tmpbind + rmdir $tmpdir + rm -f $tmpsymlink + rmdir $tmpbind + rm -f $tmp + rm -f $tmpfile +} + +# 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 +_supported_os Linux +_require_test +_require_looptests/xfs/288 line 67
Quoted 10 lines
tests/xfs/288 new file +10
-0+ +tmpfile=$TEST_DIR/fsfile +tmpdir=$TEST_DIR/tmpdir +tmpsymlink=$TEST_DIR/tmpsymlink.$$ +tmpbind=$TEST_DIR/tmpbind.$$ + +mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir" + +echo "=== mkfs.xfs ===" +mkfs.xfs -d file,name=$tmpfile,size=64m -f$MKFS_XFS_PROG -d file...
tests/xfs/288 line 73
Quoted 6 lines
tests/xfs/288 new file +6
-0+ +echo "=== truncate ===" +truncate --size=128m $tmpfile + +echo "=== xfs_growfs - unmounted, command should be rejected ===" +xfs_growfs $tmpdir$XFS_GROWFS_PROG $tmpdir
Quoted 8 lines
tests/xfs/288 new file +8
-0+ +echo "=== xfs_growfs - check relative path, unmounted ===" +cd $TEST_DIR +xfs_growfs ./tmpdir + +echo "=== xfs_growfs - no path, unmounted ===" +cd $TEST_DIR +xfs_growfs tmpdirtests/xfs/288 line 91
Quoted 10 lines
tests/xfs/288 new file +10
-0+ +echo "=== mount ===" +mount -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount" + +echo "=== xfs_growfs - mounted ===" +xfs_growfs $tmpdir + +echo "=== xfs_growfs - check relative path ===" +cd $TEST_DIR +xfs_growfs ./tmpdirSo this growfs invocation should succeed, correct? I see agcount doubling but $tmpfile doesn't get expanded... such that all the following growfses have no space to grow the fs, but they also don't spit out error messages.
Quoted 1 line
(Just talking myself through this test...)
There may be no need to actually grow the filesystem to test this behavior; nothing about this part of the tool differentiates between
xfs_growfs-n (information on current filesystem, no change) and barexfs_growfs(i.e. actually grow it ...) right? And same man page for both, specifying "shall be given a mount point to operate on."Quoted 4 lines
Also wondering if this test ought to keep expanding $testfile one AG at a time prior to every growfs test so that test success is keyed off of seeing a "data blocks changed from XXX to YYY" message, just in case the layout ever shifts...
*shrug* using
xfs_growfs-n will test the "does it pass or fail based on on whether it's given a mountpoint" and the actual geometry output won't really matter much...
Quoted 6 lines
Quoted 2 lines
Growing it is fine too, but it may not be needed. As long as it's consistent, I think.
I could make it do that, but yeah, my goal was to merely test the command response behavior, not concerning the test wih the machinations of growfs under the hood.
Ok, that's fine then. :)
--D
Quoted 8 lines
Thanks-
BillQuoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 145 lines · Darrick J. Wong
Quoted 144 lines · Bill O'Donnell
Quoted 143 lines · Eric Sandeen
Quoted 125 lines · Darrick J. Wong
Quoted 78 lines · Bill O'Donnell
The manpage for
xfs_growfsspecifies that the file/dir to be grown must be mounted. This is a test to ensure that if the target isn't mounted, the command is rejected. The test covers absolute paths and relative paths, including symbolic links and bind mounts.Signed-off-by Bill O'Donnell <[email protected]>--- tests/xfs/288 | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/288.out | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/group | 1 + 3 files changed, 241 insertions(+) create mode 100755 tests/xfs/288 create mode 100644 tests/xfs/288.outtests/xfs/288 new file +57
-0@@ -0,0 +1,121 @@ +#! /bin/bash +# FS QA Test 288 +# +# Test to ensure xfs_growfs command rejects non-existent mount points +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +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() +{ + umount $tmpdir + umount $tmpbind + rmdir $tmpdir + rm -f $tmpsymlink + rmdir $tmpbind + rm -f $tmp + rm -f $tmpfile +} + +# 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 +_supported_os Linux +_require_test +_require_looptests/xfs/288 line 67
Quoted 10 lines
tests/xfs/288 new file +10
-0+ +tmpfile=$TEST_DIR/fsfile +tmpdir=$TEST_DIR/tmpdir +tmpsymlink=$TEST_DIR/tmpsymlink.$$ +tmpbind=$TEST_DIR/tmpbind.$$ + +mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir" + +echo "=== mkfs.xfs ===" +mkfs.xfs -d file,name=$tmpfile,size=64m -f$MKFS_XFS_PROG -d file...
tests/xfs/288 line 73
Quoted 6 lines
tests/xfs/288 new file +6
-0+ +echo "=== truncate ===" +truncate --size=128m $tmpfile + +echo "=== xfs_growfs - unmounted, command should be rejected ===" +xfs_growfs $tmpdir$XFS_GROWFS_PROG $tmpdir
Quoted 8 lines
tests/xfs/288 new file +8
-0+ +echo "=== xfs_growfs - check relative path, unmounted ===" +cd $TEST_DIR +xfs_growfs ./tmpdir + +echo "=== xfs_growfs - no path, unmounted ===" +cd $TEST_DIR +xfs_growfs tmpdirtests/xfs/288 line 91
Quoted 10 lines
tests/xfs/288 new file +10
-0+ +echo "=== mount ===" +mount -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount" + +echo "=== xfs_growfs - mounted ===" +xfs_growfs $tmpdir + +echo "=== xfs_growfs - check relative path ===" +cd $TEST_DIR +xfs_growfs ./tmpdirSo this growfs invocation should succeed, correct? I see agcount doubling but $tmpfile doesn't get expanded... such that all the following growfses have no space to grow the fs, but they also don't spit out error messages.
Quoted 1 line
(Just talking myself through this test...)
There may be no need to actually grow the filesystem to test this behavior; nothing about this part of the tool differentiates between
xfs_growfs-n (information on current filesystem, no change) and barexfs_growfs(i.e. actually grow it ...) right? And same man page for both, specifying "shall be given a mount point to operate on."Quoted 4 lines
Also wondering if this test ought to keep expanding $testfile one AG at a time prior to every growfs test so that test success is keyed off of seeing a "data blocks changed from XXX to YYY" message, just in case the layout ever shifts...
*shrug* using
xfs_growfs-n will test the "does it pass or fail based on on whether it's given a mountpoint" and the actual geometry output won't really matter much...
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Growing it is fine too, but it may not be needed. As long as it's consistent, I think.
I could make it do that, but yeah, my goal was to merely test the command response behavior, not concerning the test wih the machinations of growfs under the hood.
Ok, that's fine then. :)
Thanks for reviewing. The test does need a bit of work. I'll post a v2. -Bill
Quoted 11 lines
--D
Quoted 8 lines
Thanks-
BillQuoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 144 lines · Bill O'Donnell
Quoted 143 lines · Eric Sandeen
Quoted 125 lines · Darrick J. Wong
Quoted 78 lines · Bill O'Donnell
The manpage for
xfs_growfsspecifies that the file/dir to be grown must be mounted. This is a test to ensure that if the target isn't mounted, the command is rejected. The test covers absolute paths and relative paths, including symbolic links and bind mounts.Signed-off-by Bill O'Donnell <[email protected]>--- tests/xfs/288 | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/288.out | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/group | 1 + 3 files changed, 241 insertions(+) create mode 100755 tests/xfs/288 create mode 100644 tests/xfs/288.outtests/xfs/288 new file +57
-0@@ -0,0 +1,121 @@ +#! /bin/bash +# FS QA Test 288 +# +# Test to ensure xfs_growfs command rejects non-existent mount points +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +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() +{ + umount $tmpdir + umount $tmpbind + rmdir $tmpdir + rm -f $tmpsymlink + rmdir $tmpbind + rm -f $tmp + rm -f $tmpfile +} + +# 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 +_supported_os Linux +_require_test +_require_looptests/xfs/288 line 67
Quoted 10 lines
tests/xfs/288 new file +10
-0+ +tmpfile=$TEST_DIR/fsfile +tmpdir=$TEST_DIR/tmpdir +tmpsymlink=$TEST_DIR/tmpsymlink.$$ +tmpbind=$TEST_DIR/tmpbind.$$ + +mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir" + +echo "=== mkfs.xfs ===" +mkfs.xfs -d file,name=$tmpfile,size=64m -f$MKFS_XFS_PROG -d file...
tests/xfs/288 line 73
Quoted 6 lines
tests/xfs/288 new file +6
-0+ +echo "=== truncate ===" +truncate --size=128m $tmpfile + +echo "=== xfs_growfs - unmounted, command should be rejected ===" +xfs_growfs $tmpdir$XFS_GROWFS_PROG $tmpdir
Quoted 8 lines
tests/xfs/288 new file +8
-0+ +echo "=== xfs_growfs - check relative path, unmounted ===" +cd $TEST_DIR +xfs_growfs ./tmpdir + +echo "=== xfs_growfs - no path, unmounted ===" +cd $TEST_DIR +xfs_growfs tmpdirtests/xfs/288 line 91
Quoted 10 lines
tests/xfs/288 new file +10
-0+ +echo "=== mount ===" +mount -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount" + +echo "=== xfs_growfs - mounted ===" +xfs_growfs $tmpdir + +echo "=== xfs_growfs - check relative path ===" +cd $TEST_DIR +xfs_growfs ./tmpdirSo this growfs invocation should succeed, correct? I see agcount doubling but $tmpfile doesn't get expanded... such that all the following growfses have no space to grow the fs, but they also don't spit out error messages.
Quoted 1 line
(Just talking myself through this test...)
There may be no need to actually grow the filesystem to test this behavior; nothing about this part of the tool differentiates between
xfs_growfs-n (information on current filesystem, no change) and barexfs_growfs(i.e. actually grow it ...) right? And same man page for both, specifying "shall be given a mount point to operate on."Quoted 4 lines
Also wondering if this test ought to keep expanding $testfile one AG at a time prior to every growfs test so that test success is keyed off of seeing a "data blocks changed from XXX to YYY" message, just in case the layout ever shifts...
*shrug* using
xfs_growfs-n will test the "does it pass or fail based on on whether it's given a mountpoint" and the actual geometry output won't really matter much...
Quoted 6 lines
Quoted 2 lines
Growing it is fine too, but it may not be needed. As long as it's consistent, I think.
I could make it do that, but yeah, my goal was to merely test the command response behavior, not concerning the test wih the machinations of growfs under the hood.
Some comments and/or commit log to clarify that might be good :)
Thanks,
Eryu
Quoted 91 lines · Bill O'Donnell
The manpage for
xfs_growfsspecifies that the file/dir to be grown must be mounted. This is a test to ensure that if the target isn't mounted, the command is rejected. The test covers absolute paths and relative paths, including symbolic links and bind mounts.Signed-off-by Bill O'Donnell <[email protected]>--- tests/xfs/288 | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/288.out | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/group | 1 + 3 files changed, 241 insertions(+) create mode 100755 tests/xfs/288 create mode 100644 tests/xfs/288.outtests/xfs/288 new file +70
-0@@ -0,0 +1,121 @@ +#! /bin/bash +# FS QA Test 288 +# +# Test to ensure xfs_growfs command rejects non-existent mount points +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +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() +{ + umount $tmpdir + umount $tmpbind + rmdir $tmpdir + rm -f $tmpsymlink + rmdir $tmpbind + rm -f $tmp + rm -f $tmpfile +} + +# 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 +_supported_os Linux +_require_test +_require_loop + +tmpfile=$TEST_DIR/fsfile +tmpdir=$TEST_DIR/tmpdir +tmpsymlink=$TEST_DIR/tmpsymlink.$$ +tmpbind=$TEST_DIR/tmpbind.$$ + +mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir" + +echo "=== mkfs.xfs ===" +mkfs.xfs -d file,name=$tmpfile,size=64m -f + +echo "=== truncate ===" +truncate --size=128m $tmpfile
tests/xfs/288 line 80
Quoted 10 lines
tests/xfs/288 new file +10
-0+ +echo "=== xfs_growfs - unmounted, command should be rejected ===" +xfs_growfs $tmpdir + +echo "=== xfs_growfs - check relative path, unmounted ===" +cd $TEST_DIR +xfs_growfs ./tmpdir + +echo "=== xfs_growfs - no path, unmounted ===" +cd $TEST_DIR
Is there a reason to keep cd'ing to the same dir? Here and below as well.
Quoted 27 lines
tests/xfs/288 new file +27
-0+xfs_growfs tmpdir + +echo "=== mount ===" +mount -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount" + +echo "=== xfs_growfs - mounted ===" +xfs_growfs $tmpdir + +echo "=== xfs_growfs - check relative path ===" +cd $TEST_DIR +xfs_growfs ./tmpdir + +echo "=== xfs_growfs - no path ===" +cd $TEST_DIR +xfs_growfs tmpdir + +echo "=== test symbolic link ===" +ln -s $tmpdir $tmpsymlink +xfs_growfs $tmpsymlink + +echo "=== test symbolic link using relative path ===" +xfs_growfs ./tmpsymlink.$$ + +echo "=== test symbolic link using no path ===" +xfs_growfs tmpsymlink.$$ + +echo "=== test bind mount ==="
tests/xfs/288 line 117
Quoted 10 lines
tests/xfs/288 new file +10
-0+mkdir $tmpbind +mount -o bind $tmpdir $tmpbind +xfs_growfs $tmpbind + +echo "=== test bind mount - relative path ===" + +xfs_growfs ./tmpbind.$$ + +echo "=== test bind mount - no path ===" +xfs_growfs tmpbind.$$
Testing a plain file as a target might be good too. The implementation shouldn't care, but one mistake I've seen is to do "xfs_info imagefile.img" and they get an answer about the host fs, not the image file. It'd be good to ensure that an argument of a regular file is also rejected.
You could just point xfs_growfs at the image file you create, before doing any of the other mount tests.
Quoted 21 lines
tests/xfs/288 new file +4
-0+ +# success, all done +status=0 +exittests/xfs/288.out new file +11
-0@@ -0,0 +1,119 @@ +QA output created by 288 +=== mkfs.xfs === +meta-data=/mnt/test/fsfile isize=512 agcount=4, agsize=4096 blks + = sectsz=512 attr=2, projid32bit=1 + = crc=1 finobt=1, sparse=0, rmapbt=0, reflink=0 +data = bsize=4096 blocks=16384, imaxpct=25 + = sunit=0 swidth=0 blks +naming =version 2 bsize=4096 ascii-ci=0 ftype=1 +log =internal log bsize=4096 blocks=855, version=2 + = sectsz=512 sunit=0 blks, lazy-count=1 +realtime =none extsz=4096 blocks=0, rtextents=0
tests/xfs/288.out line 21
Quoted 10 lines
tests/xfs/288.out new file +10
-0+=== truncate === +=== xfs_growfs - unmounted, command should be rejected === +xfs_growfs: /mnt/test/tmpdir is not a mounted XFS filesystem +=== xfs_growfs - check relative path, unmounted === +xfs_growfs: ./tmpdir is not a mounted XFS filesystem +=== xfs_growfs - no path, unmounted === +xfs_growfs: tmpdir is not a mounted XFS filesystem +=== mount === +=== xfs_growfs - mounted === +meta-data=/dev/loop0 isize=512 agcount=4, agsize=4096 blks
Hm, when I ran this I had a loop0 already set up, so got loop1, and this failed to match. That may be another argument against actually checking the output too carefully.
Quoted 11 lines
tests/xfs/288.out new file +11
-0+ = sectsz=512 attr=2, projid32bit=1 + = crc=1 finobt=1 spinodes=0 rmapbt=0 + = reflink=0 +data = bsize=4096 blocks=16384, imaxpct=25 + = sunit=0 swidth=0 blks +naming =version 2 bsize=4096 ascii-ci=0 ftype=1 +log =internal bsize=4096 blocks=855, version=2 + = sectsz=512 sunit=0 blks, lazy-count=1 +realtime =none extsz=4096 blocks=0, rtextents=0 +data blocks changed from 16384 to 32768 +=== xfs_growfs - check relative path ===
tests/xfs/288.out line 42
Quoted 10 lines
tests/xfs/288.out new file +10
-0+meta-data=/dev/loop0 isize=512 agcount=8, agsize=4096 blks + = sectsz=512 attr=2, projid32bit=1 + = crc=1 finobt=1 spinodes=0 rmapbt=0 + = reflink=0 +data = bsize=4096 blocks=32768, imaxpct=25 + = sunit=0 swidth=0 blks +naming =version 2 bsize=4096 ascii-ci=0 ftype=1 +log =internal bsize=4096 blocks=855, version=2 + = sectsz=512 sunit=0 blks, lazy-count=1 +realtime =none extsz=4096 blocks=0, rtextents=0
yeah, so as Darrick mentioned I'd make sure that it either grows each time, or that you don't care if it grows at all, just for consistency.
A little odd to have only the first one grow, but have all the subsequent ones still "succeed."
You'll need to filter all this output somehow - if anyone runs with different options in MKFS_OPTS, much of this output may fail to match - but things like fs features, block size, inode size, etc are not relevant to the test.
I think that _filter_mkfs might actually filter growfs just fine, not sure.
Thanks,
-Eric
Quoted 97 lines · Eric Sandeen
Quoted 96 lines · Bill O'Donnell
The manpage for
xfs_growfsspecifies that the file/dir to be grown must be mounted. This is a test to ensure that if the target isn't mounted, the command is rejected. The test covers absolute paths and relative paths, including symbolic links and bind mounts.Signed-off-by Bill O'Donnell <[email protected]>--- tests/xfs/288 | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/288.out | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/group | 1 + 3 files changed, 241 insertions(+) create mode 100755 tests/xfs/288 create mode 100644 tests/xfs/288.outtests/xfs/288 new file +75
-0@@ -0,0 +1,121 @@ +#! /bin/bash +# FS QA Test 288 +# +# Test to ensure xfs_growfs command rejects non-existent mount points +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +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() +{ + umount $tmpdir + umount $tmpbind + rmdir $tmpdir + rm -f $tmpsymlink + rmdir $tmpbind + rm -f $tmp + rm -f $tmpfile +} + +# 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 +_supported_os Linux +_require_test +_require_loop + +tmpfile=$TEST_DIR/fsfile +tmpdir=$TEST_DIR/tmpdir +tmpsymlink=$TEST_DIR/tmpsymlink.$$ +tmpbind=$TEST_DIR/tmpbind.$$ + +mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir" + +echo "=== mkfs.xfs ===" +mkfs.xfs -d file,name=$tmpfile,size=64m -f + +echo "=== truncate ===" +truncate --size=128m $tmpfile + +echo "=== xfs_growfs - unmounted, command should be rejected ===" +xfs_growfs $tmpdir + +echo "=== xfs_growfs - check relative path, unmounted ==="
Quoted 8 lines
tests/xfs/288 line 80
Quoted 5 lines
tests/xfs/288 new file +5
-0+cd $TEST_DIR +xfs_growfs ./tmpdir + +echo "=== xfs_growfs - no path, unmounted ===" +cd $TEST_DIRIs there a reason to keep cd'ing to the same dir? Here and below as well.
Nah, just a cut and paste oversight.
Quoted 44 lines
Quoted 28 lines
tests/xfs/288 new file +27
-0+xfs_growfs tmpdir + +echo "=== mount ===" +mount -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount" + +echo "=== xfs_growfs - mounted ===" +xfs_growfs $tmpdir + +echo "=== xfs_growfs - check relative path ===" +cd $TEST_DIR +xfs_growfs ./tmpdir + +echo "=== xfs_growfs - no path ===" +cd $TEST_DIR +xfs_growfs tmpdir + +echo "=== test symbolic link ===" +ln -s $tmpdir $tmpsymlink +xfs_growfs $tmpsymlink + +echo "=== test symbolic link using relative path ===" +xfs_growfs ./tmpsymlink.$$ + +echo "=== test symbolic link using no path ===" +xfs_growfs tmpsymlink.$$ + +echo "=== test bind mount ==="tests/xfs/288 line 117
Quoted 10 lines
tests/xfs/288 new file +10
-0+mkdir $tmpbind +mount -o bind $tmpdir $tmpbind +xfs_growfs $tmpbind + +echo "=== test bind mount - relative path ===" + +xfs_growfs ./tmpbind.$$ + +echo "=== test bind mount - no path ===" +xfs_growfs tmpbind.$$Testing a plain file as a target might be good too. The implementation shouldn't care, but one mistake I've seen is to do "
xfs_infoimagefile.img" and they get an answer about the host fs, not the image file. It'd be good to ensure that an argument of a regular file is also rejected.
Quoted 2 lines
You could just point
xfs_growfsat the image file you create, before doing any of the other mount tests.
check.
Quoted 28 lines
Quoted 28 lines
tests/xfs/288 new file +4
-0+ +# success, all done +status=0 +exittests/xfs/288.out new file +17
-0@@ -0,0 +1,119 @@ +QA output created by 288 +=== mkfs.xfs === +meta-data=/mnt/test/fsfile isize=512 agcount=4, agsize=4096 blks + = sectsz=512 attr=2, projid32bit=1 + = crc=1 finobt=1, sparse=0, rmapbt=0, reflink=0 +data = bsize=4096 blocks=16384, imaxpct=25 + = sunit=0 swidth=0 blks +naming =version 2 bsize=4096 ascii-ci=0 ftype=1 +log =internal log bsize=4096 blocks=855, version=2 + = sectsz=512 sunit=0 blks, lazy-count=1 +realtime =none extsz=4096 blocks=0, rtextents=0 +=== truncate === +=== xfs_growfs - unmounted, command should be rejected === +xfs_growfs: /mnt/test/tmpdir is not a mounted XFS filesystem +=== xfs_growfs - check relative path, unmounted === +xfs_growfs: ./tmpdir is not a mounted XFS filesystem +=== xfs_growfs - no path, unmounted ===
Quoted 8 lines
tests/xfs/288.out line 21
Quoted 4 lines
tests/xfs/288.out new file +4
-0+xfs_growfs: tmpdir is not a mounted XFS filesystem +=== mount === +=== xfs_growfs - mounted === +meta-data=/dev/loop0 isize=512 agcount=4, agsize=4096 blksHm, when I ran this I had a loop0 already set up, so got loop1, and this failed to match. That may be another argument against actually checking the output too carefully.
Agreed.
Quoted 26 lines
Quoted 12 lines
tests/xfs/288.out new file +11
-0+ = sectsz=512 attr=2, projid32bit=1 + = crc=1 finobt=1 spinodes=0 rmapbt=0 + = reflink=0 +data = bsize=4096 blocks=16384, imaxpct=25 + = sunit=0 swidth=0 blks +naming =version 2 bsize=4096 ascii-ci=0 ftype=1 +log =internal bsize=4096 blocks=855, version=2 + = sectsz=512 sunit=0 blks, lazy-count=1 +realtime =none extsz=4096 blocks=0, rtextents=0 +data blocks changed from 16384 to 32768 +=== xfs_growfs - check relative path ===tests/xfs/288.out line 42
Quoted 10 lines
tests/xfs/288.out new file +10
-0+meta-data=/dev/loop0 isize=512 agcount=8, agsize=4096 blks + = sectsz=512 attr=2, projid32bit=1 + = crc=1 finobt=1 spinodes=0 rmapbt=0 + = reflink=0 +data = bsize=4096 blocks=32768, imaxpct=25 + = sunit=0 swidth=0 blks +naming =version 2 bsize=4096 ascii-ci=0 ftype=1 +log =internal bsize=4096 blocks=855, version=2 + = sectsz=512 sunit=0 blks, lazy-count=1 +realtime =none extsz=4096 blocks=0, rtextents=0yeah, so as Darrick mentioned I'd make sure that it either grows each time, or that you don't care if it grows at all, just for consistency.
Quoted 2 lines
A little odd to have only the first one grow, but have all the subsequent ones still "succeed."
Agreed.
Quoted 10 lines
You'll need to filter all this output somehow - if anyone runs with different options in
MKFS_OPTS, much of this output may fail to match - but things like fs features, block size, inode size, etc are not relevant to the test.I think that
_filter_mkfsmight actually filter growfs just fine, not sure.Thanks,
-Eric
PATCH v2 1/1 xfs/288: test xfs_growfs to ensure rejection if target isn't mounted
In reply to Bill O'DonnellThe manpage for xfs_growfs specifies that the file/dir to be grown must be mounted. This is a test to ensure that if the target isn't mounted, the command is rejected. The intention is to test the command response, but not necessarily the functionality of xfs_growfs. Absolute paths and relative paths are covered, including symbolic links and bind mounts.
---
v2: acually grow the fs as test proceeds; add filter, preventing
superfluous stdio verbiage; add test for (unmounted) file; add description to commit message to clarify that this isn't a test for xfs_growfs functionality, but rather a test of command argument accepts and rejections.
tests/xfs/288 | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/288.out | 23 ++++++++++ tests/xfs/group | 1 + 3 files changed, 148 insertions(+) create mode 100755 tests/xfs/288 create mode 100644 tests/xfs/288.out
tests/xfs/288 new file +124 -0
@@ -0,0 +1,124 @@ +#! /bin/bash +# FS QA Test 288 +# +# Test to ensure xfs_growfs command rejects non-existent mount points +# and accepts mounted targets. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +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() +{ + umount $tmpdir + umount $tmpbind + rmdir $tmpdir + rm -f $tmpsymlink + rmdir $tmpbind + rm -f $tmp + rm -f $tmpfile +} + +# 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 +_supported_os Linux +_require_test +_require_loop + +tmpfile=$TEST_DIR/fsfile +tmpdir=$TEST_DIR/tmpdir +tmpsymlink=$TEST_DIR/tmpsymlink.$$ +tmpbind=$TEST_DIR/tmpbind.$$ + +mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir" + +echo "=== mkfs.xfs ===" +$MKFS_XFS_PROG -d file,name=$tmpfile,size=16m -f | _filter_mkfs 2>$tmp.mkfs >/dev/null + +echo "=== truncate ===" +truncate --size=256m $tmpfile + +echo "=== xfs_growfs - unmounted, command should be rejected ===" +$XFS_GROWFS_PROG $tmpdir + +echo "=== xfs_growfs - check relative path, unmounted ===" +cd $TEST_DIR +$XFS_GROWFS_PROG ./tmpdir + +echo "=== xfs_growfs - no path, unmounted ===" +$XFS_GROWFS_PROG tmpdir + +echo "=== xfs_growfs - plain file - should be rejected ===" +$XFS_GROWFS_PROG $tmpfile + +echo "=== mount ===" +mount -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount" + +echo "=== xfs_growfs - mounted - check absolute path ===" +$XFS_GROWFS_PROG -D 8192 $tmpdir | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - check relative path ===" +$XFS_GROWFS_PROG -D 12288 ./tmpdir | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - no path ===" +$XFS_GROWFS_PROG -D 16384 tmpdir | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - symbolic link ===" +ln -s $tmpdir $tmpsymlink +$XFS_GROWFS_PROG -D 20480 $tmpsymlink | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - symbolic link using relative path ===" +$XFS_GROWFS_PROG -D 24576 ./tmpsymlink.$$ | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - symbolic link using no path ===" +$XFS_GROWFS_PROG -D 28672 tmpsymlink.$$ | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - bind mount ===" +mkdir $tmpbind +mount -o bind $tmpdir $tmpbind +$XFS_GROWFS_PROG -D 32768 $tmpbind | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - bind mount - relative path ===" +$XFS_GROWFS_PROG -D 36864 ./tmpbind.$$ | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - bind mount - no path ===" +$XFS_GROWFS_PROG -D 40960 tmpbind.$$ | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - plain file - should be rejected ===" +$XFS_GROWFS_PROG $tmpfile + +# success, all done +status=0 +exit
tests/xfs/288.out new file +23 -0
@@ -0,0 +1,23 @@ +QA output created by 288 +=== mkfs.xfs === +=== truncate === +=== xfs_growfs - unmounted, command should be rejected === +xfs_growfs: /mnt/test/tmpdir is not a mounted XFS filesystem +=== xfs_growfs - check relative path, unmounted === +xfs_growfs: ./tmpdir is not a mounted XFS filesystem +=== xfs_growfs - no path, unmounted === +xfs_growfs: tmpdir is not a mounted XFS filesystem +=== xfs_growfs - plain file - should be rejected === +xfs_growfs: /mnt/test/fsfile is not a mounted XFS filesystem +=== mount === +=== xfs_growfs - mounted - check absolute path === +=== xfs_growfs - check relative path === +=== xfs_growfs - no path === +=== xfs_growfs - symbolic link === +=== xfs_growfs - symbolic link using relative path === +=== xfs_growfs - symbolic link using no path === +=== xfs_growfs - bind mount === +=== xfs_growfs - bind mount - relative path === +=== xfs_growfs - bind mount - no path === +=== xfs_growfs - plain file - should be rejected === +xfs_growfs: /mnt/test/fsfile is not a mounted XFS filesystem
tests/xfs/group +1 -0
@@ -285,6 +285,7 @@ 285 dangerous_fuzzers dangerous_scrub 286 dangerous_fuzzers dangerous_scrub dangerous_online_repair 287 auto dump quota quick +288 growfs auto quick 290 auto rw prealloc quick ioctl zero 291 auto repair 292 auto mkfs quick
Signature · 1 line
2.9.3
Quoted 158 lines · Bill O'Donnell
The manpage for
xfs_growfsspecifies that the file/dir to be grown must be mounted. This is a test to ensure that if the target isn't mounted, the command is rejected. The intention is to test the command response, but not necessarily the functionality ofxfs_growfs. Absolute paths and relative paths are covered, including symbolic links and bind mounts.Signed-off-by Bill O'Donnell <[email protected]>---
v2: acually grow the fs as test proceeds; add filter, preventing
superfluous stdio verbiage; add test for (unmounted) file; add description to commit message to clarify that this isn't a test forxfs_growfsfunctionality, but rather a test of command argument accepts and rejections.tests/xfs/288 | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/288.out | 23 ++++++++++ tests/xfs/group | 1 + 3 files changed, 148 insertions(+) create mode 100755 tests/xfs/288 create mode 100644 tests/xfs/288.outtests/xfs/288 new file +124
-0@@ -0,0 +1,124 @@ +#! /bin/bash +# FS QA Test 288 +# +# Test to ensure xfs_growfs command rejects non-existent mount points +# and accepts mounted targets. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +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() +{ + umount $tmpdir + umount $tmpbind + rmdir $tmpdir + rm -f $tmpsymlink + rmdir $tmpbind + rm -f $tmp + rm -f $tmpfile +} + +# 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 +_supported_os Linux +_require_test +_require_loop + +tmpfile=$TEST_DIR/fsfile +tmpdir=$TEST_DIR/tmpdir +tmpsymlink=$TEST_DIR/tmpsymlink.$$ +tmpbind=$TEST_DIR/tmpbind.$$ + +mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir" + +echo "=== mkfs.xfs ===" +$MKFS_XFS_PROG -d file,name=$tmpfile,size=16m -f | _filter_mkfs 2>$tmp.mkfs >/dev/null + +echo "=== truncate ===" +truncate --size=256m $tmpfile + +echo "=== xfs_growfs - unmounted, command should be rejected ===" +$XFS_GROWFS_PROG $tmpdir + +echo "=== xfs_growfs - check relative path, unmounted ===" +cd $TEST_DIR +$XFS_GROWFS_PROG ./tmpdir + +echo "=== xfs_growfs - no path, unmounted ===" +$XFS_GROWFS_PROG tmpdir + +echo "=== xfs_growfs - plain file - should be rejected ===" +$XFS_GROWFS_PROG $tmpfile + +echo "=== mount ===" +mount -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount" + +echo "=== xfs_growfs - mounted - check absolute path ===" +$XFS_GROWFS_PROG -D 8192 $tmpdir | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - check relative path ===" +$XFS_GROWFS_PROG -D 12288 ./tmpdir | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - no path ===" +$XFS_GROWFS_PROG -D 16384 tmpdir | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - symbolic link ===" +ln -s $tmpdir $tmpsymlink +$XFS_GROWFS_PROG -D 20480 $tmpsymlink | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - symbolic link using relative path ===" +$XFS_GROWFS_PROG -D 24576 ./tmpsymlink.$$ | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - symbolic link using no path ===" +$XFS_GROWFS_PROG -D 28672 tmpsymlink.$$ | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - bind mount ===" +mkdir $tmpbind +mount -o bind $tmpdir $tmpbind +$XFS_GROWFS_PROG -D 32768 $tmpbind | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - bind mount - relative path ===" +$XFS_GROWFS_PROG -D 36864 ./tmpbind.$$ | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - bind mount - no path ===" +$XFS_GROWFS_PROG -D 40960 tmpbind.$$ | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - plain file - should be rejected ===" +$XFS_GROWFS_PROG $tmpfile + +# success, all done +status=0 +exittests/xfs/288.out new file +0
-0
tests/xfs/288.out line 5
Quoted 5 lines
tests/xfs/288.out new file +5
-0@@ -0,0 +1,23 @@ +QA output created by 288 +=== mkfs.xfs === +=== truncate === +=== xfs_growfs - unmounted, command should be rejected === +xfs_growfs: /mnt/test/tmpdir is not a mounted XFS filesystem
This still needs _filter_test_dir...
--D
Quoted 37 lines
tests/xfs/288.out new file +18
-0+=== xfs_growfs - check relative path, unmounted === +xfs_growfs: ./tmpdir is not a mounted XFS filesystem +=== xfs_growfs - no path, unmounted === +xfs_growfs: tmpdir is not a mounted XFS filesystem +=== xfs_growfs - plain file - should be rejected === +xfs_growfs: /mnt/test/fsfile is not a mounted XFS filesystem +=== mount === +=== xfs_growfs - mounted - check absolute path === +=== xfs_growfs - check relative path === +=== xfs_growfs - no path === +=== xfs_growfs - symbolic link === +=== xfs_growfs - symbolic link using relative path === +=== xfs_growfs - symbolic link using no path === +=== xfs_growfs - bind mount === +=== xfs_growfs - bind mount - relative path === +=== xfs_growfs - bind mount - no path === +=== xfs_growfs - plain file - should be rejected === +xfs_growfs: /mnt/test/fsfile is not a mounted XFS filesystemtests/xfs/group +1
-0@@ -285,6 +285,7 @@ 285 dangerous_fuzzers dangerous_scrub 286 dangerous_fuzzers dangerous_scrub dangerous_online_repair 287 auto dump quota quick +288 growfs auto quick 290 auto rw prealloc quick ioctl zero 291 auto repair 292 auto mkfs quickSignature · 6 lines
2.9.3 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 28 lines · Bill O'Donnell
The manpage for
xfs_growfsspecifies that the file/dir to be grown must be mounted. This is a test to ensure that if the target isn't mounted, the command is rejected. The intention is to test the command response, but not necessarily the functionality ofxfs_growfs. Absolute paths and relative paths are covered, including symbolic links and bind mounts.Signed-off-by Bill O'Donnell <[email protected]>---
v2: acually grow the fs as test proceeds; add filter, preventing
superfluous stdio verbiage; add test for (unmounted) file; add description to commit message to clarify that this isn't a test forxfs_growfsfunctionality, but rather a test of command argument accepts and rejections.tests/xfs/288 | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/288.out | 23 ++++++++++ tests/xfs/group | 1 + 3 files changed, 148 insertions(+) create mode 100755 tests/xfs/288 create mode 100644 tests/xfs/288.outtests/xfs/288 new file +0
-0
tests/xfs/288 line 5
Quoted 5 lines
tests/xfs/288 new file +5
-0@@ -0,0 +1,124 @@ +#! /bin/bash +# FS QA Test 288 +# +# Test to ensure xfs_growfs command rejects non-existent mount points +# and accepts mounted targets.
I noticed Eric's comments to the v3 xfsprogs patch, I think this description and commit summary can be updated too :)
Quoted 22 lines
tests/xfs/288 new file +22
-0+# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq"
tests/xfs/288 line 37
Quoted 10 lines
tests/xfs/288 new file +10
-0+ +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + umount $tmpdir + umount $tmpbind
$UMOUNT_PROG
tests/xfs/288 line 41
Quoted 4 lines
tests/xfs/288 new file +4
-0+ rmdir $tmpdir + rm -f $tmpsymlink + rmdir $tmpbind + rm -f $tmp
rm -f $tmp.*
$tmp itself is not used.
Quoted 17 lines
tests/xfs/288 new file +17
-0+ rm -f $tmpfile +} + +# 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 +_supported_os Linux +_require_test +_require_loop
tests/xfs/288 line 68
Quoted 10 lines
tests/xfs/288 new file +10
-0+ +tmpfile=$TEST_DIR/fsfile +tmpdir=$TEST_DIR/tmpdir +tmpsymlink=$TEST_DIR/tmpsymlink.$$ +tmpbind=$TEST_DIR/tmpbind.$$ + +mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir" + +echo "=== mkfs.xfs ===" +$MKFS_XFS_PROG -d file,name=$tmpfile,size=16m -f | _filter_mkfs 2>$tmp.mkfs >/dev/null
I don't see how $tmp.mkfs was used in this test, seems we can discard mkfs output directly, the _filter_mkfs seems useless.
$MKFS_XFS_PROG -d file,name=$tmpfile,size=16m -f >/dev/null 2>&1
tests/xfs/288 line 71
Quoted 3 lines
tests/xfs/288 new file +3
-0+ +echo "=== truncate ===" +truncate --size=256m $tmpfile
$XFS_IO_PROG -fc "truncate 256m" $tmpfile
tests/xfs/288 line 74
Quoted 3 lines
tests/xfs/288 new file +3
-0+ +echo "=== xfs_growfs - unmounted, command should be rejected ===" +$XFS_GROWFS_PROG $tmpdir
As Darrick said, need _filter_test_dir here, and all other growfs calls using absolute path.
tests/xfs/288 line 87
Quoted 13 lines
tests/xfs/288 new file +13
-0+ +echo "=== xfs_growfs - check relative path, unmounted ===" +cd $TEST_DIR +$XFS_GROWFS_PROG ./tmpdir + +echo "=== xfs_growfs - no path, unmounted ===" +$XFS_GROWFS_PROG tmpdir + +echo "=== xfs_growfs - plain file - should be rejected ===" +$XFS_GROWFS_PROG $tmpfile + +echo "=== mount ===" +mount -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount"
$MOUNT_PROG
tests/xfs/288 line 90
Quoted 3 lines
tests/xfs/288 new file +3
-0+ +echo "=== xfs_growfs - mounted - check absolute path ===" +$XFS_GROWFS_PROG -D 8192 $tmpdir | _filter_growfs >$tmp.growfs
All these "$tmp.growfs"s are overwritten after each xfs_growfs command, and are not used at all. If the stdout is not important, we can just discard it, if stdout is useful for debug purpose, we can append stdout of each xfs_growfs to $seqres.full file.
Thanks,
Eryu
Quoted 82 lines
tests/xfs/288 new file +34
-0+ +echo "=== xfs_growfs - check relative path ===" +$XFS_GROWFS_PROG -D 12288 ./tmpdir | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - no path ===" +$XFS_GROWFS_PROG -D 16384 tmpdir | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - symbolic link ===" +ln -s $tmpdir $tmpsymlink +$XFS_GROWFS_PROG -D 20480 $tmpsymlink | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - symbolic link using relative path ===" +$XFS_GROWFS_PROG -D 24576 ./tmpsymlink.$$ | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - symbolic link using no path ===" +$XFS_GROWFS_PROG -D 28672 tmpsymlink.$$ | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - bind mount ===" +mkdir $tmpbind +mount -o bind $tmpdir $tmpbind +$XFS_GROWFS_PROG -D 32768 $tmpbind | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - bind mount - relative path ===" +$XFS_GROWFS_PROG -D 36864 ./tmpbind.$$ | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - bind mount - no path ===" +$XFS_GROWFS_PROG -D 40960 tmpbind.$$ | _filter_growfs >$tmp.growfs + +echo "=== xfs_growfs - plain file - should be rejected ===" +$XFS_GROWFS_PROG $tmpfile + +# success, all done +status=0 +exittests/xfs/288.out new file +23
-0@@ -0,0 +1,23 @@ +QA output created by 288 +=== mkfs.xfs === +=== truncate === +=== xfs_growfs - unmounted, command should be rejected === +xfs_growfs: /mnt/test/tmpdir is not a mounted XFS filesystem +=== xfs_growfs - check relative path, unmounted === +xfs_growfs: ./tmpdir is not a mounted XFS filesystem +=== xfs_growfs - no path, unmounted === +xfs_growfs: tmpdir is not a mounted XFS filesystem +=== xfs_growfs - plain file - should be rejected === +xfs_growfs: /mnt/test/fsfile is not a mounted XFS filesystem +=== mount === +=== xfs_growfs - mounted - check absolute path === +=== xfs_growfs - check relative path === +=== xfs_growfs - no path === +=== xfs_growfs - symbolic link === +=== xfs_growfs - symbolic link using relative path === +=== xfs_growfs - symbolic link using no path === +=== xfs_growfs - bind mount === +=== xfs_growfs - bind mount - relative path === +=== xfs_growfs - bind mount - no path === +=== xfs_growfs - plain file - should be rejected === +xfs_growfs: /mnt/test/fsfile is not a mounted XFS filesystemtests/xfs/group +1
-0@@ -285,6 +285,7 @@ 285 dangerous_fuzzers dangerous_scrub 286 dangerous_fuzzers dangerous_scrub dangerous_online_repair 287 auto dump quota quick +288 growfs auto quick 290 auto rw prealloc quick ioctl zero 291 auto repair 292 auto mkfs quickSignature · 6 lines
2.9.3 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 109 lines · Eryu Guan
Quoted 28 lines · Bill O'Donnell
The manpage for
xfs_growfsspecifies that the file/dir to be grown must be mounted. This is a test to ensure that if the target isn't mounted, the command is rejected. The intention is to test the command response, but not necessarily the functionality ofxfs_growfs. Absolute paths and relative paths are covered, including symbolic links and bind mounts.Signed-off-by Bill O'Donnell <[email protected]>---
v2: acually grow the fs as test proceeds; add filter, preventing
superfluous stdio verbiage; add test for (unmounted) file; add description to commit message to clarify that this isn't a test forxfs_growfsfunctionality, but rather a test of command argument accepts and rejections.tests/xfs/288 | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/288.out | 23 ++++++++++ tests/xfs/group | 1 + 3 files changed, 148 insertions(+) create mode 100755 tests/xfs/288 create mode 100644 tests/xfs/288.outtests/xfs/288 new file +0
-0tests/xfs/288 line 5
Quoted 5 lines
tests/xfs/288 new file +5
-0@@ -0,0 +1,124 @@ +#! /bin/bash +# FS QA Test 288 +# +# Test to ensure xfs_growfs command rejects non-existent mount points +# and accepts mounted targets.I noticed Eric's comments to the v3 xfsprogs patch, I think this description and commit summary can be updated too :)
Quoted 22 lines
tests/xfs/288 new file +22
-0+# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq"tests/xfs/288 line 37
Quoted 10 lines
tests/xfs/288 new file +10
-0+ +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + umount $tmpdir + umount $tmpbind$UMOUNT_PROG
tests/xfs/288 line 41
Quoted 4 lines
tests/xfs/288 new file +4
-0+ rmdir $tmpdir + rm -f $tmpsymlink + rmdir $tmpbind + rm -f $tmprm -f $tmp.*
$tmp itself is not used.
Quoted 17 lines
tests/xfs/288 new file +17
-0+ rm -f $tmpfile +} + +# 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 +_supported_os Linux +_require_test +_require_looptests/xfs/288 line 68
Quoted 10 lines
tests/xfs/288 new file +10
-0+ +tmpfile=$TEST_DIR/fsfile +tmpdir=$TEST_DIR/tmpdir +tmpsymlink=$TEST_DIR/tmpsymlink.$$ +tmpbind=$TEST_DIR/tmpbind.$$ + +mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir" + +echo "=== mkfs.xfs ===" +$MKFS_XFS_PROG -d file,name=$tmpfile,size=16m -f | _filter_mkfs 2>$tmp.mkfs >/dev/nullI don't see how $tmp.mkfs was used in this test, seems we can discard mkfs output directly, the
_filter_mkfsseems useless.
Quoted 1 line
$MKFS_XFS_PROG -d file,name=$tmpfile,size=16m -f >/dev/null 2>&1
I had suggested _filter_mkfs at one point but that was bad advice, sorry. Yes, by the time all of stdout gets eaten, there's no need for using the filter at all.
Thanks,
-Eric
PATCH v3 1/1 xfs/288: test xfs_growfs to ensure rejection if target path isn't an active xfs mountpoint
In reply to Bill O'Donnellxfs_growfs manpage clearly states that the target path must be an active xfs mountpoint. This is a test to ensure that if the target path isn't an active xfs mountpoint, the command is rejected. The purpose is to check the command response, but not necessarily the functionality of xfs_growfs. Test cases include absolute paths, relative paths, symbolic links, and bind mounts.
---
v3: improve commit message and subject line. Use _filter_test_dir
for absolute pathnames. Use env variable substitutions for common fs commands. Send xfs_growfs stdout to /dev/null. Remove the use of $tmp.*.
v2: acually grow the fs as test proceeds; add filter, preventing
superfluous stdio verbiage; add test for (unmounted) file; add description to commit message to clarify that this isn't a test for xfs_growfs functionality, but rather a test of command argument accepts and rejections.
tests/xfs/288 | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/288.out | 23 ++++++++++ tests/xfs/group | 1 + 3 files changed, 147 insertions(+) create mode 100755 tests/xfs/288 create mode 100644 tests/xfs/288.out
tests/xfs/288 new file +123 -0
@@ -0,0 +1,123 @@ +#! /bin/bash +# FS QA Test 288 +# +# Test to ensure xfs_growfs command rejects non-existent mount points +# and accepts mounted targets. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +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() +{ + $UMOUNT_PROG $tmpdir + $UMOUNT_PROG $tmpbind + rmdir $tmpdir + rm -f $tmpsymlink + rmdir $tmpbind + rm -f $tmpfile +} + +# 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 +_supported_os Linux +_require_test +_require_loop + +tmpfile=$TEST_DIR/fsfile +tmpdir=$TEST_DIR/tmpdir +tmpsymlink=$TEST_DIR/tmpsymlink.$$ +tmpbind=$TEST_DIR/tmpbind.$$ + +mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir" + +echo "=== mkfs.xfs ===" +$MKFS_XFS_PROG -d file,name=$tmpfile,size=16m -f >/dev/null 2>&1 + +echo "=== truncate ===" +$XFS_IO_PROG -fc "truncate 256m" $tmpfile + +echo "=== xfs_growfs - unmounted, command should be rejected ===" +$XFS_GROWFS_PROG $tmpdir 2>&1 | _filter_test_dir + +echo "=== xfs_growfs - check relative path, unmounted ===" +cd $TEST_DIR +$XFS_GROWFS_PROG ./tmpdir 2>&1 | _filter_test_dir + +echo "=== xfs_growfs - no path, unmounted ===" +$XFS_GROWFS_PROG tmpdir 2>&1 | _filter_test_dir + +echo "=== xfs_growfs - plain file - should be rejected ===" +$XFS_GROWFS_PROG $tmpfile 2>&1 | _filter_test_dir + +echo "=== mount ===" +$MOUNT_PROG -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount" + +echo "=== xfs_growfs - mounted - check absolute path ===" +$XFS_GROWFS_PROG -D 8192 $tmpdir | _filter_test_dir > /dev/null + +echo "=== xfs_growfs - check relative path ===" +$XFS_GROWFS_PROG -D 12288 ./tmpdir > /dev/null + +echo "=== xfs_growfs - no path ===" +$XFS_GROWFS_PROG -D 16384 tmpdir > /dev/null + +echo "=== xfs_growfs - symbolic link ===" +ln -s $tmpdir $tmpsymlink +$XFS_GROWFS_PROG -D 20480 $tmpsymlink | _filter_test_dir > /dev/null + +echo "=== xfs_growfs - symbolic link using relative path ===" +$XFS_GROWFS_PROG -D 24576 ./tmpsymlink.$$ > /dev/null + +echo "=== xfs_growfs - symbolic link using no path ===" +$XFS_GROWFS_PROG -D 28672 tmpsymlink.$$ > /dev/null + +echo "=== xfs_growfs - bind mount ===" +mkdir $tmpbind +$MOUNT_PROG -o bind $tmpdir $tmpbind +$XFS_GROWFS_PROG -D 32768 $tmpbind | _filter_test_dir > /dev/null + +echo "=== xfs_growfs - bind mount - relative path ===" +$XFS_GROWFS_PROG -D 36864 ./tmpbind.$$ > /dev/null + +echo "=== xfs_growfs - bind mount - no path ===" +$XFS_GROWFS_PROG -D 40960 tmpbind.$$ > /dev/null + +echo "=== xfs_growfs - plain file - should be rejected ===" +$XFS_GROWFS_PROG $tmpfile 2>&1 | _filter_test_dir + +# success, all done +status=0 +exit
tests/xfs/288.out new file +23 -0
@@ -0,0 +1,23 @@ +QA output created by 288 +=== mkfs.xfs === +=== truncate === +=== xfs_growfs - unmounted, command should be rejected === +xfs_growfs: TEST_DIR/tmpdir is not a mounted XFS filesystem +=== xfs_growfs - check relative path, unmounted === +xfs_growfs: ./tmpdir is not a mounted XFS filesystem +=== xfs_growfs - no path, unmounted === +xfs_growfs: tmpdir is not a mounted XFS filesystem +=== xfs_growfs - plain file - should be rejected === +xfs_growfs: TEST_DIR/fsfile is not a mounted XFS filesystem +=== mount === +=== xfs_growfs - mounted - check absolute path === +=== xfs_growfs - check relative path === +=== xfs_growfs - no path === +=== xfs_growfs - symbolic link === +=== xfs_growfs - symbolic link using relative path === +=== xfs_growfs - symbolic link using no path === +=== xfs_growfs - bind mount === +=== xfs_growfs - bind mount - relative path === +=== xfs_growfs - bind mount - no path === +=== xfs_growfs - plain file - should be rejected === +xfs_growfs: TEST_DIR/fsfile is not a mounted XFS filesystem
tests/xfs/group +1 -0
@@ -285,6 +285,7 @@ 285 dangerous_fuzzers dangerous_scrub 286 dangerous_fuzzers dangerous_scrub dangerous_online_repair 287 auto dump quota quick +288 growfs auto quick 290 auto rw prealloc quick ioctl zero 291 auto repair 292 auto mkfs quick
Signature · 1 line
2.9.3
Re: [PATCH v3] xfs/288: test xfs_growfs to ensure rejection if target path isn't an active xfs mountpoint
I noticed this dropped from the radar, and I'm wondering if I should resubmit it with a new test number, or is it a total NAK?
Thanks-
Bill
Quoted 205 lines · Bill O'Donnell
xfs_growfsmanpage clearly states that the target path must be an active xfs mountpoint. This is a test to ensure that if the target path isn't an active xfs mountpoint, the command is rejected. The purpose is to check the command response, but not necessarily the functionality ofxfs_growfs. Test cases include absolute paths, relative paths, symbolic links, and bind mounts.Signed-off-by Bill O'Donnell <[email protected]>---
v3: improve commit message and subject line. Use
_filter_test_dir
for absolute pathnames. Use env variable substitutions for common fs commands. Sendxfs_growfsstdout to/dev/null. Remove the use of $tmp.*.v2: acually grow the fs as test proceeds; add filter, preventing
superfluous stdio verbiage; add test for (unmounted) file; add description to commit message to clarify that this isn't a test forxfs_growfsfunctionality, but rather a test of command argument accepts and rejections.tests/xfs/288 | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/288.out | 23 ++++++++++ tests/xfs/group | 1 + 3 files changed, 147 insertions(+) create mode 100755 tests/xfs/288 create mode 100644 tests/xfs/288.outtests/xfs/288 new file +123
-0@@ -0,0 +1,123 @@ +#! /bin/bash +# FS QA Test 288 +# +# Test to ensure xfs_growfs command rejects non-existent mount points +# and accepts mounted targets. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +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() +{ + $UMOUNT_PROG $tmpdir + $UMOUNT_PROG $tmpbind + rmdir $tmpdir + rm -f $tmpsymlink + rmdir $tmpbind + rm -f $tmpfile +} + +# 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 +_supported_os Linux +_require_test +_require_loop + +tmpfile=$TEST_DIR/fsfile +tmpdir=$TEST_DIR/tmpdir +tmpsymlink=$TEST_DIR/tmpsymlink.$$ +tmpbind=$TEST_DIR/tmpbind.$$ + +mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir" + +echo "=== mkfs.xfs ===" +$MKFS_XFS_PROG -d file,name=$tmpfile,size=16m -f >/dev/null 2>&1 + +echo "=== truncate ===" +$XFS_IO_PROG -fc "truncate 256m" $tmpfile + +echo "=== xfs_growfs - unmounted, command should be rejected ===" +$XFS_GROWFS_PROG $tmpdir 2>&1 | _filter_test_dir + +echo "=== xfs_growfs - check relative path, unmounted ===" +cd $TEST_DIR +$XFS_GROWFS_PROG ./tmpdir 2>&1 | _filter_test_dir + +echo "=== xfs_growfs - no path, unmounted ===" +$XFS_GROWFS_PROG tmpdir 2>&1 | _filter_test_dir + +echo "=== xfs_growfs - plain file - should be rejected ===" +$XFS_GROWFS_PROG $tmpfile 2>&1 | _filter_test_dir + +echo "=== mount ===" +$MOUNT_PROG -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount" + +echo "=== xfs_growfs - mounted - check absolute path ===" +$XFS_GROWFS_PROG -D 8192 $tmpdir | _filter_test_dir > /dev/null + +echo "=== xfs_growfs - check relative path ===" +$XFS_GROWFS_PROG -D 12288 ./tmpdir > /dev/null + +echo "=== xfs_growfs - no path ===" +$XFS_GROWFS_PROG -D 16384 tmpdir > /dev/null + +echo "=== xfs_growfs - symbolic link ===" +ln -s $tmpdir $tmpsymlink +$XFS_GROWFS_PROG -D 20480 $tmpsymlink | _filter_test_dir > /dev/null + +echo "=== xfs_growfs - symbolic link using relative path ===" +$XFS_GROWFS_PROG -D 24576 ./tmpsymlink.$$ > /dev/null + +echo "=== xfs_growfs - symbolic link using no path ===" +$XFS_GROWFS_PROG -D 28672 tmpsymlink.$$ > /dev/null + +echo "=== xfs_growfs - bind mount ===" +mkdir $tmpbind +$MOUNT_PROG -o bind $tmpdir $tmpbind +$XFS_GROWFS_PROG -D 32768 $tmpbind | _filter_test_dir > /dev/null + +echo "=== xfs_growfs - bind mount - relative path ===" +$XFS_GROWFS_PROG -D 36864 ./tmpbind.$$ > /dev/null + +echo "=== xfs_growfs - bind mount - no path ===" +$XFS_GROWFS_PROG -D 40960 tmpbind.$$ > /dev/null + +echo "=== xfs_growfs - plain file - should be rejected ===" +$XFS_GROWFS_PROG $tmpfile 2>&1 | _filter_test_dir + +# success, all done +status=0 +exittests/xfs/288.out new file +23
-0@@ -0,0 +1,23 @@ +QA output created by 288 +=== mkfs.xfs === +=== truncate === +=== xfs_growfs - unmounted, command should be rejected === +xfs_growfs: TEST_DIR/tmpdir is not a mounted XFS filesystem +=== xfs_growfs - check relative path, unmounted === +xfs_growfs: ./tmpdir is not a mounted XFS filesystem +=== xfs_growfs - no path, unmounted === +xfs_growfs: tmpdir is not a mounted XFS filesystem +=== xfs_growfs - plain file - should be rejected === +xfs_growfs: TEST_DIR/fsfile is not a mounted XFS filesystem +=== mount === +=== xfs_growfs - mounted - check absolute path === +=== xfs_growfs - check relative path === +=== xfs_growfs - no path === +=== xfs_growfs - symbolic link === +=== xfs_growfs - symbolic link using relative path === +=== xfs_growfs - symbolic link using no path === +=== xfs_growfs - bind mount === +=== xfs_growfs - bind mount - relative path === +=== xfs_growfs - bind mount - no path === +=== xfs_growfs - plain file - should be rejected === +xfs_growfs: TEST_DIR/fsfile is not a mounted XFS filesystemtests/xfs/group +1
-0@@ -285,6 +285,7 @@ 285 dangerous_fuzzers dangerous_scrub 286 dangerous_fuzzers dangerous_scrub dangerous_online_repair 287 auto dump quota quick +288 growfs auto quick 290 auto rw prealloc quick ioctl zero 291 auto repair 292 auto mkfs quickSignature · 6 lines
2.9.3 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3] xfs/288: test xfs_growfs to ensure rejection if target path isn't an active xfs mountpoint
Quoted 2 lines · Bill O'Donnell
I noticed this dropped from the radar, and I'm wondering if I should resubmit it with a new test number, or is it a total NAK?
ecc7b5c xfs: xfs_growfs target path must be an active xfs mountpoint
It was merged, just got renumbered. It's xfs/289
-Eric
Quoted 214 lines
Thanks-
BillQuoted 205 lines · Bill O'Donnell
xfs_growfsmanpage clearly states that the target path must be an active xfs mountpoint. This is a test to ensure that if the target path isn't an active xfs mountpoint, the command is rejected. The purpose is to check the command response, but not necessarily the functionality ofxfs_growfs. Test cases include absolute paths, relative paths, symbolic links, and bind mounts.Signed-off-by Bill O'Donnell <[email protected]>---
v3: improve commit message and subject line. Use
_filter_test_dir
for absolute pathnames. Use env variable substitutions for common fs commands. Sendxfs_growfsstdout to/dev/null. Remove the use of $tmp.*.v2: acually grow the fs as test proceeds; add filter, preventing
superfluous stdio verbiage; add test for (unmounted) file; add description to commit message to clarify that this isn't a test forxfs_growfsfunctionality, but rather a test of command argument accepts and rejections.tests/xfs/288 | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/288.out | 23 ++++++++++ tests/xfs/group | 1 + 3 files changed, 147 insertions(+) create mode 100755 tests/xfs/288 create mode 100644 tests/xfs/288.outtests/xfs/288 new file +123
-0@@ -0,0 +1,123 @@ +#! /bin/bash +# FS QA Test 288 +# +# Test to ensure xfs_growfs command rejects non-existent mount points +# and accepts mounted targets. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +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() +{ + $UMOUNT_PROG $tmpdir + $UMOUNT_PROG $tmpbind + rmdir $tmpdir + rm -f $tmpsymlink + rmdir $tmpbind + rm -f $tmpfile +} + +# 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 +_supported_os Linux +_require_test +_require_loop + +tmpfile=$TEST_DIR/fsfile +tmpdir=$TEST_DIR/tmpdir +tmpsymlink=$TEST_DIR/tmpsymlink.$$ +tmpbind=$TEST_DIR/tmpbind.$$ + +mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir" + +echo "=== mkfs.xfs ===" +$MKFS_XFS_PROG -d file,name=$tmpfile,size=16m -f >/dev/null 2>&1 + +echo "=== truncate ===" +$XFS_IO_PROG -fc "truncate 256m" $tmpfile + +echo "=== xfs_growfs - unmounted, command should be rejected ===" +$XFS_GROWFS_PROG $tmpdir 2>&1 | _filter_test_dir + +echo "=== xfs_growfs - check relative path, unmounted ===" +cd $TEST_DIR +$XFS_GROWFS_PROG ./tmpdir 2>&1 | _filter_test_dir + +echo "=== xfs_growfs - no path, unmounted ===" +$XFS_GROWFS_PROG tmpdir 2>&1 | _filter_test_dir + +echo "=== xfs_growfs - plain file - should be rejected ===" +$XFS_GROWFS_PROG $tmpfile 2>&1 | _filter_test_dir + +echo "=== mount ===" +$MOUNT_PROG -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount" + +echo "=== xfs_growfs - mounted - check absolute path ===" +$XFS_GROWFS_PROG -D 8192 $tmpdir | _filter_test_dir > /dev/null + +echo "=== xfs_growfs - check relative path ===" +$XFS_GROWFS_PROG -D 12288 ./tmpdir > /dev/null + +echo "=== xfs_growfs - no path ===" +$XFS_GROWFS_PROG -D 16384 tmpdir > /dev/null + +echo "=== xfs_growfs - symbolic link ===" +ln -s $tmpdir $tmpsymlink +$XFS_GROWFS_PROG -D 20480 $tmpsymlink | _filter_test_dir > /dev/null + +echo "=== xfs_growfs - symbolic link using relative path ===" +$XFS_GROWFS_PROG -D 24576 ./tmpsymlink.$$ > /dev/null + +echo "=== xfs_growfs - symbolic link using no path ===" +$XFS_GROWFS_PROG -D 28672 tmpsymlink.$$ > /dev/null + +echo "=== xfs_growfs - bind mount ===" +mkdir $tmpbind +$MOUNT_PROG -o bind $tmpdir $tmpbind +$XFS_GROWFS_PROG -D 32768 $tmpbind | _filter_test_dir > /dev/null + +echo "=== xfs_growfs - bind mount - relative path ===" +$XFS_GROWFS_PROG -D 36864 ./tmpbind.$$ > /dev/null + +echo "=== xfs_growfs - bind mount - no path ===" +$XFS_GROWFS_PROG -D 40960 tmpbind.$$ > /dev/null + +echo "=== xfs_growfs - plain file - should be rejected ===" +$XFS_GROWFS_PROG $tmpfile 2>&1 | _filter_test_dir + +# success, all done +status=0 +exittests/xfs/288.out new file +23
-0@@ -0,0 +1,23 @@ +QA output created by 288 +=== mkfs.xfs === +=== truncate === +=== xfs_growfs - unmounted, command should be rejected === +xfs_growfs: TEST_DIR/tmpdir is not a mounted XFS filesystem +=== xfs_growfs - check relative path, unmounted === +xfs_growfs: ./tmpdir is not a mounted XFS filesystem +=== xfs_growfs - no path, unmounted === +xfs_growfs: tmpdir is not a mounted XFS filesystem +=== xfs_growfs - plain file - should be rejected === +xfs_growfs: TEST_DIR/fsfile is not a mounted XFS filesystem +=== mount === +=== xfs_growfs - mounted - check absolute path === +=== xfs_growfs - check relative path === +=== xfs_growfs - no path === +=== xfs_growfs - symbolic link === +=== xfs_growfs - symbolic link using relative path === +=== xfs_growfs - symbolic link using no path === +=== xfs_growfs - bind mount === +=== xfs_growfs - bind mount - relative path === +=== xfs_growfs - bind mount - no path === +=== xfs_growfs - plain file - should be rejected === +xfs_growfs: TEST_DIR/fsfile is not a mounted XFS filesystemtests/xfs/group +1
-0@@ -285,6 +285,7 @@ 285 dangerous_fuzzers dangerous_scrub 286 dangerous_fuzzers dangerous_scrub dangerous_online_repair 287 auto dump quota quick +288 growfs auto quick 290 auto rw prealloc quick ioctl zero 291 auto repair 292 auto mkfs quickSignature · 6 lines
2.9.3 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3] xfs/288: test xfs_growfs to ensure rejection if target path isn't an active xfs mountpoint
Quoted 7 lines · Eric Sandeen
Quoted 2 lines · Bill O'Donnell
I noticed this dropped from the radar, and I'm wondering if I should resubmit it with a new test number, or is it a total NAK?
ecc7b5c xfs:
xfs_growfstarget path must be an active xfs mountpointIt was merged, just got renumbered. It's xfs/289
ah. OK, thanks! Sorry for the noise.
-Bill
Quoted 218 lines
-Eric
Quoted 214 lines
Thanks-
BillQuoted 205 lines · Bill O'Donnell
xfs_growfsmanpage clearly states that the target path must be an active xfs mountpoint. This is a test to ensure that if the target path isn't an active xfs mountpoint, the command is rejected. The purpose is to check the command response, but not necessarily the functionality ofxfs_growfs. Test cases include absolute paths, relative paths, symbolic links, and bind mounts.Signed-off-by Bill O'Donnell <[email protected]>---
v3: improve commit message and subject line. Use
_filter_test_dir
for absolute pathnames. Use env variable substitutions for common fs commands. Sendxfs_growfsstdout to/dev/null. Remove the use of $tmp.*.v2: acually grow the fs as test proceeds; add filter, preventing
superfluous stdio verbiage; add test for (unmounted) file; add description to commit message to clarify that this isn't a test forxfs_growfsfunctionality, but rather a test of command argument accepts and rejections.tests/xfs/288 | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/288.out | 23 ++++++++++ tests/xfs/group | 1 + 3 files changed, 147 insertions(+) create mode 100755 tests/xfs/288 create mode 100644 tests/xfs/288.outtests/xfs/288 new file +123
-0@@ -0,0 +1,123 @@ +#! /bin/bash +# FS QA Test 288 +# +# Test to ensure xfs_growfs command rejects non-existent mount points +# and accepts mounted targets. +# +#----------------------------------------------------------------------- +# Copyright (c) 2017 Red Hat, Inc. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# + +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() +{ + $UMOUNT_PROG $tmpdir + $UMOUNT_PROG $tmpbind + rmdir $tmpdir + rm -f $tmpsymlink + rmdir $tmpbind + rm -f $tmpfile +} + +# 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 +_supported_os Linux +_require_test +_require_loop + +tmpfile=$TEST_DIR/fsfile +tmpdir=$TEST_DIR/tmpdir +tmpsymlink=$TEST_DIR/tmpsymlink.$$ +tmpbind=$TEST_DIR/tmpbind.$$ + +mkdir -p $tmpdir || _fail "!!! failed to create temp mount dir" + +echo "=== mkfs.xfs ===" +$MKFS_XFS_PROG -d file,name=$tmpfile,size=16m -f >/dev/null 2>&1 + +echo "=== truncate ===" +$XFS_IO_PROG -fc "truncate 256m" $tmpfile + +echo "=== xfs_growfs - unmounted, command should be rejected ===" +$XFS_GROWFS_PROG $tmpdir 2>&1 | _filter_test_dir + +echo "=== xfs_growfs - check relative path, unmounted ===" +cd $TEST_DIR +$XFS_GROWFS_PROG ./tmpdir 2>&1 | _filter_test_dir + +echo "=== xfs_growfs - no path, unmounted ===" +$XFS_GROWFS_PROG tmpdir 2>&1 | _filter_test_dir + +echo "=== xfs_growfs - plain file - should be rejected ===" +$XFS_GROWFS_PROG $tmpfile 2>&1 | _filter_test_dir + +echo "=== mount ===" +$MOUNT_PROG -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount" + +echo "=== xfs_growfs - mounted - check absolute path ===" +$XFS_GROWFS_PROG -D 8192 $tmpdir | _filter_test_dir > /dev/null + +echo "=== xfs_growfs - check relative path ===" +$XFS_GROWFS_PROG -D 12288 ./tmpdir > /dev/null + +echo "=== xfs_growfs - no path ===" +$XFS_GROWFS_PROG -D 16384 tmpdir > /dev/null + +echo "=== xfs_growfs - symbolic link ===" +ln -s $tmpdir $tmpsymlink +$XFS_GROWFS_PROG -D 20480 $tmpsymlink | _filter_test_dir > /dev/null + +echo "=== xfs_growfs - symbolic link using relative path ===" +$XFS_GROWFS_PROG -D 24576 ./tmpsymlink.$$ > /dev/null + +echo "=== xfs_growfs - symbolic link using no path ===" +$XFS_GROWFS_PROG -D 28672 tmpsymlink.$$ > /dev/null + +echo "=== xfs_growfs - bind mount ===" +mkdir $tmpbind +$MOUNT_PROG -o bind $tmpdir $tmpbind +$XFS_GROWFS_PROG -D 32768 $tmpbind | _filter_test_dir > /dev/null + +echo "=== xfs_growfs - bind mount - relative path ===" +$XFS_GROWFS_PROG -D 36864 ./tmpbind.$$ > /dev/null + +echo "=== xfs_growfs - bind mount - no path ===" +$XFS_GROWFS_PROG -D 40960 tmpbind.$$ > /dev/null + +echo "=== xfs_growfs - plain file - should be rejected ===" +$XFS_GROWFS_PROG $tmpfile 2>&1 | _filter_test_dir + +# success, all done +status=0 +exittests/xfs/288.out new file +23
-0@@ -0,0 +1,23 @@ +QA output created by 288 +=== mkfs.xfs === +=== truncate === +=== xfs_growfs - unmounted, command should be rejected === +xfs_growfs: TEST_DIR/tmpdir is not a mounted XFS filesystem +=== xfs_growfs - check relative path, unmounted === +xfs_growfs: ./tmpdir is not a mounted XFS filesystem +=== xfs_growfs - no path, unmounted === +xfs_growfs: tmpdir is not a mounted XFS filesystem +=== xfs_growfs - plain file - should be rejected === +xfs_growfs: TEST_DIR/fsfile is not a mounted XFS filesystem +=== mount === +=== xfs_growfs - mounted - check absolute path === +=== xfs_growfs - check relative path === +=== xfs_growfs - no path === +=== xfs_growfs - symbolic link === +=== xfs_growfs - symbolic link using relative path === +=== xfs_growfs - symbolic link using no path === +=== xfs_growfs - bind mount === +=== xfs_growfs - bind mount - relative path === +=== xfs_growfs - bind mount - no path === +=== xfs_growfs - plain file - should be rejected === +xfs_growfs: TEST_DIR/fsfile is not a mounted XFS filesystemtests/xfs/group +1
-0@@ -285,6 +285,7 @@ 285 dangerous_fuzzers dangerous_scrub 286 dangerous_fuzzers dangerous_scrub dangerous_online_repair 287 auto dump quota quick +288 growfs auto quick 290 auto rw prealloc quick ioctl zero 291 auto repair 292 auto mkfs quickSignature · 6 lines
2.9.3 -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html