* Re: [PATCH] xfs/288: test xfs_growfs to ensure rejection if target isn't mounted
2017-04-24 15:09 [PATCH] xfs/288: test xfs_growfs to ensure rejection if target isn't mounted Bill O'Donnell
@ 2017-04-24 16:34 ` Darrick J. Wong
2017-04-24 19:38 ` Eric Sandeen
2017-04-24 19:54 ` Eric Sandeen
` (2 subsequent siblings)
3 siblings, 1 reply; 17+ messages in thread
From: Darrick J. Wong @ 2017-04-24 16:34 UTC (permalink / raw)
To: Bill O'Donnell; +Cc: fstests
On Mon, Apr 24, 2017 at 10:09:35AM -0500, Bill O'Donnell wrote:
> 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.
>
> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> ---
> 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
>
> diff --git a/tests/xfs/288 b/tests/xfs/288
> new file mode 100755
> index 0000000..628f753
> --- /dev/null
> +++ b/tests/xfs/288
> @@ -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
$MKFS_XFS_PROG -d file...
> +
> +echo "=== truncate ==="
> +truncate --size=128m $tmpfile
> +
> +echo "=== xfs_growfs - unmounted, command should be rejected ==="
> +xfs_growfs $tmpdir
$XFS_GROWFS_PROG $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
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...
> +
> +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
> diff --git a/tests/xfs/288.out b/tests/xfs/288.out
> new file mode 100644
> index 0000000..a526048
> --- /dev/null
> +++ b/tests/xfs/288.out
> @@ -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.
> +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.
> +=== 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.
> + = 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=0
> diff --git a/tests/xfs/group b/tests/xfs/group
> index 75769f9..0dcb8e0 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -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
> --
> 2.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH] xfs/288: test xfs_growfs to ensure rejection if target isn't mounted
2017-04-24 16:34 ` Darrick J. Wong
@ 2017-04-24 19:38 ` Eric Sandeen
2017-04-24 19:53 ` Bill O'Donnell
0 siblings, 1 reply; 17+ messages in thread
From: Eric Sandeen @ 2017-04-24 19:38 UTC (permalink / raw)
To: Darrick J. Wong, Bill O'Donnell; +Cc: fstests
On 4/24/17 11:34 AM, Darrick J. Wong wrote:
> On Mon, Apr 24, 2017 at 10:09:35AM -0500, Bill O'Donnell wrote:
>> 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.
>>
>> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
>> ---
>> 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
>>
>> diff --git a/tests/xfs/288 b/tests/xfs/288
>> new file mode 100755
>> index 0000000..628f753
>> --- /dev/null
>> +++ b/tests/xfs/288
>> @@ -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
>
> $MKFS_XFS_PROG -d file...
>
>> +
>> +echo "=== truncate ==="
>> +truncate --size=128m $tmpfile
>> +
>> +echo "=== xfs_growfs - unmounted, command should be rejected ==="
>> +xfs_growfs $tmpdir
>
> $XFS_GROWFS_PROG $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
>
> 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...)
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."
> 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
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH] xfs/288: test xfs_growfs to ensure rejection if target isn't mounted
2017-04-24 19:38 ` Eric Sandeen
@ 2017-04-24 19:53 ` Bill O'Donnell
2017-04-24 21:01 ` Darrick J. Wong
2017-04-25 3:52 ` Eryu Guan
0 siblings, 2 replies; 17+ messages in thread
From: Bill O'Donnell @ 2017-04-24 19:53 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Darrick J. Wong, fstests
On Mon, Apr 24, 2017 at 02:38:02PM -0500, Eric Sandeen wrote:
> On 4/24/17 11:34 AM, Darrick J. Wong wrote:
> > On Mon, Apr 24, 2017 at 10:09:35AM -0500, Bill O'Donnell wrote:
> >> 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.
> >>
> >> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> >> ---
> >> 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
> >>
> >> diff --git a/tests/xfs/288 b/tests/xfs/288
> >> new file mode 100755
> >> index 0000000..628f753
> >> --- /dev/null
> >> +++ b/tests/xfs/288
> >> @@ -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
> >
> > $MKFS_XFS_PROG -d file...
> >
> >> +
> >> +echo "=== truncate ==="
> >> +truncate --size=128m $tmpfile
> >> +
> >> +echo "=== xfs_growfs - unmounted, command should be rejected ==="
> >> +xfs_growfs $tmpdir
> >
> > $XFS_GROWFS_PROG $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
> >
> > 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...)
>
> 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."
>
> > 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.
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
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH] xfs/288: test xfs_growfs to ensure rejection if target isn't mounted
2017-04-24 19:53 ` Bill O'Donnell
@ 2017-04-24 21:01 ` Darrick J. Wong
2017-04-24 21:23 ` Bill O'Donnell
2017-04-25 3:52 ` Eryu Guan
1 sibling, 1 reply; 17+ messages in thread
From: Darrick J. Wong @ 2017-04-24 21:01 UTC (permalink / raw)
To: Bill O'Donnell; +Cc: Eric Sandeen, fstests
On Mon, Apr 24, 2017 at 02:53:14PM -0500, Bill O'Donnell wrote:
> On Mon, Apr 24, 2017 at 02:38:02PM -0500, Eric Sandeen wrote:
> > On 4/24/17 11:34 AM, Darrick J. Wong wrote:
> > > On Mon, Apr 24, 2017 at 10:09:35AM -0500, Bill O'Donnell wrote:
> > >> 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.
> > >>
> > >> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> > >> ---
> > >> 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
> > >>
> > >> diff --git a/tests/xfs/288 b/tests/xfs/288
> > >> new file mode 100755
> > >> index 0000000..628f753
> > >> --- /dev/null
> > >> +++ b/tests/xfs/288
> > >> @@ -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
> > >
> > > $MKFS_XFS_PROG -d file...
> > >
> > >> +
> > >> +echo "=== truncate ==="
> > >> +truncate --size=128m $tmpfile
> > >> +
> > >> +echo "=== xfs_growfs - unmounted, command should be rejected ==="
> > >> +xfs_growfs $tmpdir
> > >
> > > $XFS_GROWFS_PROG $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
> > >
> > > 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...)
> >
> > 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."
> >
> > > 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.
>
> 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
>
> Thanks-
> Bill
>
> > --
> > To unsubscribe from this list: send the line "unsubscribe fstests" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH] xfs/288: test xfs_growfs to ensure rejection if target isn't mounted
2017-04-24 21:01 ` Darrick J. Wong
@ 2017-04-24 21:23 ` Bill O'Donnell
0 siblings, 0 replies; 17+ messages in thread
From: Bill O'Donnell @ 2017-04-24 21:23 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Eric Sandeen, fstests
On Mon, Apr 24, 2017 at 02:01:20PM -0700, Darrick J. Wong wrote:
> On Mon, Apr 24, 2017 at 02:53:14PM -0500, Bill O'Donnell wrote:
> > On Mon, Apr 24, 2017 at 02:38:02PM -0500, Eric Sandeen wrote:
> > > On 4/24/17 11:34 AM, Darrick J. Wong wrote:
> > > > On Mon, Apr 24, 2017 at 10:09:35AM -0500, Bill O'Donnell wrote:
> > > >> 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.
> > > >>
> > > >> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> > > >> ---
> > > >> 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
> > > >>
> > > >> diff --git a/tests/xfs/288 b/tests/xfs/288
> > > >> new file mode 100755
> > > >> index 0000000..628f753
> > > >> --- /dev/null
> > > >> +++ b/tests/xfs/288
> > > >> @@ -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
> > > >
> > > > $MKFS_XFS_PROG -d file...
> > > >
> > > >> +
> > > >> +echo "=== truncate ==="
> > > >> +truncate --size=128m $tmpfile
> > > >> +
> > > >> +echo "=== xfs_growfs - unmounted, command should be rejected ==="
> > > >> +xfs_growfs $tmpdir
> > > >
> > > > $XFS_GROWFS_PROG $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
> > > >
> > > > 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...)
> > >
> > > 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."
> > >
> > > > 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.
> >
> > 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
>
> --D
>
> >
> > Thanks-
> > Bill
> >
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe fstests" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] xfs/288: test xfs_growfs to ensure rejection if target isn't mounted
2017-04-24 19:53 ` Bill O'Donnell
2017-04-24 21:01 ` Darrick J. Wong
@ 2017-04-25 3:52 ` Eryu Guan
1 sibling, 0 replies; 17+ messages in thread
From: Eryu Guan @ 2017-04-25 3:52 UTC (permalink / raw)
To: Bill O'Donnell; +Cc: Eric Sandeen, Darrick J. Wong, fstests
On Mon, Apr 24, 2017 at 02:53:14PM -0500, Bill O'Donnell wrote:
> On Mon, Apr 24, 2017 at 02:38:02PM -0500, Eric Sandeen wrote:
> > On 4/24/17 11:34 AM, Darrick J. Wong wrote:
> > > On Mon, Apr 24, 2017 at 10:09:35AM -0500, Bill O'Donnell wrote:
> > >> 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.
> > >>
> > >> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> > >> ---
> > >> 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
> > >>
> > >> diff --git a/tests/xfs/288 b/tests/xfs/288
> > >> new file mode 100755
> > >> index 0000000..628f753
> > >> --- /dev/null
> > >> +++ b/tests/xfs/288
> > >> @@ -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
> > >
> > > $MKFS_XFS_PROG -d file...
> > >
> > >> +
> > >> +echo "=== truncate ==="
> > >> +truncate --size=128m $tmpfile
> > >> +
> > >> +echo "=== xfs_growfs - unmounted, command should be rejected ==="
> > >> +xfs_growfs $tmpdir
> > >
> > > $XFS_GROWFS_PROG $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
> > >
> > > 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...)
> >
> > 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."
> >
> > > 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.
>
> 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
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH] xfs/288: test xfs_growfs to ensure rejection if target isn't mounted
2017-04-24 15:09 [PATCH] xfs/288: test xfs_growfs to ensure rejection if target isn't mounted Bill O'Donnell
2017-04-24 16:34 ` Darrick J. Wong
@ 2017-04-24 19:54 ` Eric Sandeen
2017-04-24 19:59 ` Bill O'Donnell
2017-04-26 22:05 ` [PATCH v2] " Bill O'Donnell
2017-04-27 18:31 ` [PATCH v3] xfs/288: test xfs_growfs to ensure rejection if target path isn't an active xfs mountpoint Bill O'Donnell
3 siblings, 1 reply; 17+ messages in thread
From: Eric Sandeen @ 2017-04-24 19:54 UTC (permalink / raw)
To: Bill O'Donnell, fstests
On 4/24/17 10:09 AM, Bill O'Donnell wrote:
> 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.
>
> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> ---
> 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
>
> diff --git a/tests/xfs/288 b/tests/xfs/288
> new file mode 100755
> index 0000000..628f753
> --- /dev/null
> +++ b/tests/xfs/288
> @@ -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
Is there a reason to keep cd'ing to the same dir? Here and below
as well.
> +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.$$
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.
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/288.out b/tests/xfs/288.out
> new file mode 100644
> index 0000000..a526048
> --- /dev/null
> +++ b/tests/xfs/288.out
> @@ -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 ===
> +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.
> + = 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
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
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH] xfs/288: test xfs_growfs to ensure rejection if target isn't mounted
2017-04-24 19:54 ` Eric Sandeen
@ 2017-04-24 19:59 ` Bill O'Donnell
0 siblings, 0 replies; 17+ messages in thread
From: Bill O'Donnell @ 2017-04-24 19:59 UTC (permalink / raw)
To: Eric Sandeen; +Cc: fstests
On Mon, Apr 24, 2017 at 02:54:59PM -0500, Eric Sandeen wrote:
> On 4/24/17 10:09 AM, Bill O'Donnell wrote:
> > 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.
> >
> > Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> > ---
> > 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
> >
> > diff --git a/tests/xfs/288 b/tests/xfs/288
> > new file mode 100755
> > index 0000000..628f753
> > --- /dev/null
> > +++ b/tests/xfs/288
> > @@ -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
>
> Is there a reason to keep cd'ing to the same dir? Here and below
> as well.
Nah, just a cut and paste oversight.
>
> > +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.$$
>
> 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.
check.
>
> > +
> > +# success, all done
> > +status=0
> > +exit
> > diff --git a/tests/xfs/288.out b/tests/xfs/288.out
> > new file mode 100644
> > index 0000000..a526048
> > --- /dev/null
> > +++ b/tests/xfs/288.out
> > @@ -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 ===
> > +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.
Agreed.
>
> > + = 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
>
> 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."
Agreed.
>
> 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
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2] xfs/288: test xfs_growfs to ensure rejection if target isn't mounted
2017-04-24 15:09 [PATCH] xfs/288: test xfs_growfs to ensure rejection if target isn't mounted Bill O'Donnell
2017-04-24 16:34 ` Darrick J. Wong
2017-04-24 19:54 ` Eric Sandeen
@ 2017-04-26 22:05 ` Bill O'Donnell
2017-04-26 22:41 ` Darrick J. Wong
2017-04-27 12:09 ` Eryu Guan
2017-04-27 18:31 ` [PATCH v3] xfs/288: test xfs_growfs to ensure rejection if target path isn't an active xfs mountpoint Bill O'Donnell
3 siblings, 2 replies; 17+ messages in thread
From: Bill O'Donnell @ 2017-04-26 22:05 UTC (permalink / raw)
To: fstests
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 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.
Signed-off-by: Bill O'Donnell <billodo@redhat.com>
---
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
diff --git a/tests/xfs/288 b/tests/xfs/288
new file mode 100755
index 0000000..51f5c32
--- /dev/null
+++ b/tests/xfs/288
@@ -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
diff --git a/tests/xfs/288.out b/tests/xfs/288.out
new file mode 100644
index 0000000..318aa8c
--- /dev/null
+++ b/tests/xfs/288.out
@@ -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
diff --git a/tests/xfs/group b/tests/xfs/group
index 75769f9..0dcb8e0 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -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
--
2.9.3
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH v2] xfs/288: test xfs_growfs to ensure rejection if target isn't mounted
2017-04-26 22:05 ` [PATCH v2] " Bill O'Donnell
@ 2017-04-26 22:41 ` Darrick J. Wong
2017-04-27 12:09 ` Eryu Guan
1 sibling, 0 replies; 17+ messages in thread
From: Darrick J. Wong @ 2017-04-26 22:41 UTC (permalink / raw)
To: Bill O'Donnell; +Cc: fstests
On Wed, Apr 26, 2017 at 05:05:47PM -0500, Bill O'Donnell wrote:
> 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 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.
>
> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> ---
> 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
>
> diff --git a/tests/xfs/288 b/tests/xfs/288
> new file mode 100755
> index 0000000..51f5c32
> --- /dev/null
> +++ b/tests/xfs/288
> @@ -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
> diff --git a/tests/xfs/288.out b/tests/xfs/288.out
> new file mode 100644
> index 0000000..318aa8c
> --- /dev/null
> +++ b/tests/xfs/288.out
> @@ -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
> +=== 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
> diff --git a/tests/xfs/group b/tests/xfs/group
> index 75769f9..0dcb8e0 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -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
> --
> 2.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH v2] xfs/288: test xfs_growfs to ensure rejection if target isn't mounted
2017-04-26 22:05 ` [PATCH v2] " Bill O'Donnell
2017-04-26 22:41 ` Darrick J. Wong
@ 2017-04-27 12:09 ` Eryu Guan
2017-04-27 12:18 ` Eric Sandeen
1 sibling, 1 reply; 17+ messages in thread
From: Eryu Guan @ 2017-04-27 12:09 UTC (permalink / raw)
To: Bill O'Donnell; +Cc: fstests
On Wed, Apr 26, 2017 at 05:05:47PM -0500, Bill O'Donnell wrote:
> 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 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.
>
> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> ---
> 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
>
> diff --git a/tests/xfs/288 b/tests/xfs/288
> new file mode 100755
> index 0000000..51f5c32
> --- /dev/null
> +++ b/tests/xfs/288
> @@ -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 :)
> +#
> +#-----------------------------------------------------------------------
> +# 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
$UMOUNT_PROG
> + rmdir $tmpdir
> + rm -f $tmpsymlink
> + rmdir $tmpbind
> + rm -f $tmp
rm -f $tmp.*
$tmp itself is not used.
> + 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
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
> +
> +echo "=== truncate ==="
> +truncate --size=256m $tmpfile
$XFS_IO_PROG -fc "truncate 256m" $tmpfile
> +
> +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.
> +
> +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
> +
> +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
> +
> +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
> diff --git a/tests/xfs/288.out b/tests/xfs/288.out
> new file mode 100644
> index 0000000..318aa8c
> --- /dev/null
> +++ b/tests/xfs/288.out
> @@ -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
> diff --git a/tests/xfs/group b/tests/xfs/group
> index 75769f9..0dcb8e0 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -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
> --
> 2.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH v2] xfs/288: test xfs_growfs to ensure rejection if target isn't mounted
2017-04-27 12:09 ` Eryu Guan
@ 2017-04-27 12:18 ` Eric Sandeen
0 siblings, 0 replies; 17+ messages in thread
From: Eric Sandeen @ 2017-04-27 12:18 UTC (permalink / raw)
To: Eryu Guan, Bill O'Donnell; +Cc: fstests
On 4/27/17 7:09 AM, Eryu Guan wrote:
> On Wed, Apr 26, 2017 at 05:05:47PM -0500, Bill O'Donnell wrote:
>> 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 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.
>>
>> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
>> ---
>> 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
>>
>> diff --git a/tests/xfs/288 b/tests/xfs/288
>> new file mode 100755
>> index 0000000..51f5c32
>> --- /dev/null
>> +++ b/tests/xfs/288
>> @@ -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 :)
>
>> +#
>> +#-----------------------------------------------------------------------
>> +# 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
> $UMOUNT_PROG
>
>> + rmdir $tmpdir
>> + rm -f $tmpsymlink
>> + rmdir $tmpbind
>> + rm -f $tmp
> rm -f $tmp.*
>
> $tmp itself is not used.
>
>> + 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
> 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
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
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v3] xfs/288: test xfs_growfs to ensure rejection if target path isn't an active xfs mountpoint
2017-04-24 15:09 [PATCH] xfs/288: test xfs_growfs to ensure rejection if target isn't mounted Bill O'Donnell
` (2 preceding siblings ...)
2017-04-26 22:05 ` [PATCH v2] " Bill O'Donnell
@ 2017-04-27 18:31 ` Bill O'Donnell
2017-06-26 16:49 ` Bill O'Donnell
3 siblings, 1 reply; 17+ messages in thread
From: Bill O'Donnell @ 2017-04-27 18:31 UTC (permalink / raw)
To: fstests
xfs_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.
Signed-off-by: Bill O'Donnell <billodo@redhat.com>
---
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
diff --git a/tests/xfs/288 b/tests/xfs/288
new file mode 100755
index 0000000..da4c639
--- /dev/null
+++ b/tests/xfs/288
@@ -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
diff --git a/tests/xfs/288.out b/tests/xfs/288.out
new file mode 100644
index 0000000..f7c2362
--- /dev/null
+++ b/tests/xfs/288.out
@@ -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
diff --git a/tests/xfs/group b/tests/xfs/group
index 75769f9..0dcb8e0 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -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
--
2.9.3
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH v3] xfs/288: test xfs_growfs to ensure rejection if target path isn't an active xfs mountpoint
2017-04-27 18:31 ` [PATCH v3] xfs/288: test xfs_growfs to ensure rejection if target path isn't an active xfs mountpoint Bill O'Donnell
@ 2017-06-26 16:49 ` Bill O'Donnell
2017-06-26 17:00 ` Eric Sandeen
0 siblings, 1 reply; 17+ messages in thread
From: Bill O'Donnell @ 2017-06-26 16:49 UTC (permalink / raw)
To: fstests; +Cc: guaneryu, Eric Sandeen
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
On Thu, Apr 27, 2017 at 01:31:10PM -0500, Bill O'Donnell wrote:
> xfs_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.
>
> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> ---
>
> 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
>
> diff --git a/tests/xfs/288 b/tests/xfs/288
> new file mode 100755
> index 0000000..da4c639
> --- /dev/null
> +++ b/tests/xfs/288
> @@ -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
> diff --git a/tests/xfs/288.out b/tests/xfs/288.out
> new file mode 100644
> index 0000000..f7c2362
> --- /dev/null
> +++ b/tests/xfs/288.out
> @@ -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
> diff --git a/tests/xfs/group b/tests/xfs/group
> index 75769f9..0dcb8e0 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -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
> --
> 2.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH v3] xfs/288: test xfs_growfs to ensure rejection if target path isn't an active xfs mountpoint
2017-06-26 16:49 ` Bill O'Donnell
@ 2017-06-26 17:00 ` Eric Sandeen
2017-06-26 17:04 ` Bill O'Donnell
0 siblings, 1 reply; 17+ messages in thread
From: Eric Sandeen @ 2017-06-26 17:00 UTC (permalink / raw)
To: Bill O'Donnell, fstests; +Cc: guaneryu, Eric Sandeen
On 6/26/17 11:49 AM, Bill O'Donnell wrote:
> 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
> Thanks-
> Bill
>
> On Thu, Apr 27, 2017 at 01:31:10PM -0500, Bill O'Donnell wrote:
>> xfs_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.
>>
>> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
>> ---
>>
>> 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
>>
>> diff --git a/tests/xfs/288 b/tests/xfs/288
>> new file mode 100755
>> index 0000000..da4c639
>> --- /dev/null
>> +++ b/tests/xfs/288
>> @@ -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
>> diff --git a/tests/xfs/288.out b/tests/xfs/288.out
>> new file mode 100644
>> index 0000000..f7c2362
>> --- /dev/null
>> +++ b/tests/xfs/288.out
>> @@ -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
>> diff --git a/tests/xfs/group b/tests/xfs/group
>> index 75769f9..0dcb8e0 100644
>> --- a/tests/xfs/group
>> +++ b/tests/xfs/group
>> @@ -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
>> --
>> 2.9.3
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe fstests" in
>> the body of a message to majordomo@vger.kernel.org
>> 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 majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH v3] xfs/288: test xfs_growfs to ensure rejection if target path isn't an active xfs mountpoint
2017-06-26 17:00 ` Eric Sandeen
@ 2017-06-26 17:04 ` Bill O'Donnell
0 siblings, 0 replies; 17+ messages in thread
From: Bill O'Donnell @ 2017-06-26 17:04 UTC (permalink / raw)
To: Eric Sandeen; +Cc: fstests, guaneryu, Eric Sandeen
On Mon, Jun 26, 2017 at 12:00:54PM -0500, Eric Sandeen wrote:
> On 6/26/17 11:49 AM, Bill O'Donnell wrote:
> > 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
ah. OK, thanks! Sorry for the noise.
-Bill
>
> -Eric
>
>
> > Thanks-
> > Bill
> >
> > On Thu, Apr 27, 2017 at 01:31:10PM -0500, Bill O'Donnell wrote:
> >> xfs_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.
> >>
> >> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> >> ---
> >>
> >> 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
> >>
> >> diff --git a/tests/xfs/288 b/tests/xfs/288
> >> new file mode 100755
> >> index 0000000..da4c639
> >> --- /dev/null
> >> +++ b/tests/xfs/288
> >> @@ -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
> >> diff --git a/tests/xfs/288.out b/tests/xfs/288.out
> >> new file mode 100644
> >> index 0000000..f7c2362
> >> --- /dev/null
> >> +++ b/tests/xfs/288.out
> >> @@ -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
> >> diff --git a/tests/xfs/group b/tests/xfs/group
> >> index 75769f9..0dcb8e0 100644
> >> --- a/tests/xfs/group
> >> +++ b/tests/xfs/group
> >> @@ -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
> >> --
> >> 2.9.3
> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe fstests" in
> >> the body of a message to majordomo@vger.kernel.org
> >> 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 majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> >
^ permalink raw reply [flat|nested] 17+ messages in thread