From: Eryu Guan <eguan@redhat.com>
To: Jan Tulak <jtulak@redhat.com>
Cc: fstests@vger.kernel.org, Dave Chinner <dchinner@redhat.com>
Subject: Re: [PATCH v3] xfstests: Add mkfs input validation tests
Date: Wed, 13 Jul 2016 18:46:41 +0800 [thread overview]
Message-ID: <20160713104641.GT2432@eguan.usersys.redhat.com> (raw)
In-Reply-To: <1467389557-4360-1-git-send-email-jtulak@redhat.com>
On Fri, Jul 01, 2016 at 06:12:37PM +0200, Jan Tulak wrote:
> mkfs.xfs does not do a very good job of input validation. This test
> is designed to exercise the input validation and test good/bad
> combinations of options being set. It will not pass on an old
> mkfs.xfs binary - it is designed to be the test case for an input
> validation cleanup (merged in spring/summer 2016).
>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> Signed-off-by: Jan Tulak <jtulak@redhat.com>
>
> ---
> CHANGES:
> * Skip this test on older binaries, detected by a few feature checks
>
> Cheers,
> Jan
>
> Signed-off-by: Jan Tulak <jtulak@redhat.com>
> ---
> tests/xfs/400-input-validation | 350 +++++++++++++++++++++++++++++++++++++
> tests/xfs/400-input-validation.out | 2 +
> tests/xfs/group | 1 +
> 3 files changed, 353 insertions(+)
> create mode 100755 tests/xfs/400-input-validation
> create mode 100644 tests/xfs/400-input-validation.out
>
> diff --git a/tests/xfs/400-input-validation b/tests/xfs/400-input-validation
> new file mode 100755
> index 0000000..d6f9110
> --- /dev/null
> +++ b/tests/xfs/400-input-validation
> @@ -0,0 +1,350 @@
> +#! /bin/bash
> +# FS QA Test No. xfs/400
> +#
> +# mkfs.xfs input validation test. Designed to break mkfs.xfs if it doesn't
> +# filter garbage input or invalid option combinations correctly.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016 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()
> +{
> + cd /
> + rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +
> +# Modify as appropriate.
> +_supported_fs xfs
> +_supported_os Linux
> +_require_scratch
> +
> +# Skip if we are running an older binary without the stricter input checks.
> +# Make multiple checks to be sure that there is no regression on the one
> +# selected feature check, which would skew the result.
> +$MKFS_XFS_PROG -f -N -s size=2s $SCRATCH_DEV >/dev/null 2>&1
> +sum=$?
> +$MKFS_XFS_PROG -f -N -l version=2,su=$((256 * 1024 + 4096)) $SCRATCH_DEV >/dev/null 2>&1
> +sum=`expr $sum + $?`
> +
> +if [ "$sum" -eq 0 ]; then
> + _notrun "Requires newer mkfs with stricter input checks."
> +fi
I think this can be put into a new _require rule in common/rc, as Dave
suggested in his previous review:
"
... a "_require_xfs_mkfs_validation" rule should be
written to determine the version of mkfs being. e.g. by testing one
of the failure cases that the unfixed binary says is ok.
"
Thanks,
Eryu
next prev parent reply other threads:[~2016-07-13 10:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-14 8:31 [PATCH] xfstests: Add mkfs input validation tests Jan Tulak
2016-06-23 11:04 ` Eryu Guan
2016-06-23 11:10 ` Jan Tulak
2016-06-29 10:38 ` [PATCH v2] " Jan Tulak
2016-06-29 12:52 ` Eryu Guan
2016-06-29 13:03 ` Jan Tulak
2016-07-01 16:12 ` [PATCH v3] " Jan Tulak
2016-07-13 10:46 ` Eryu Guan [this message]
2016-07-14 10:20 ` Jan Tulak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160713104641.GT2432@eguan.usersys.redhat.com \
--to=eguan@redhat.com \
--cc=dchinner@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=jtulak@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.