All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Tulak <jtulak@redhat.com>
To: fstests@vger.kernel.org
Cc: xfs@oss.sgi.com
Subject: [RFC PATCH] xfstests: Add mkfs input validation tests
Date: Thu, 28 Apr 2016 10:29:09 +0200	[thread overview]
Message-ID: <1461832149-18276-1-git-send-email-jtulak@redhat.com> (raw)
In-Reply-To: <1461231593-31294-1-git-send-email-jtulak@redhat.com>

Test inputs for my mkfs-cleaning patchset. This test will fail with the old sphageti code mkfs, among others because the old code accepts incorrect values.



Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Jan Tulak <jtulak@redhat.com>
---

Hi guys,

I'm sending this patch although the mentioned patchset is not yet merged.
It might help you a bit with checking if there are any issues with
the patchset, as here it is clear, what options works and what not.

But because this test fails with how mkfs currently validates values
(and some other things), maybe the merging of this patch should wait
for the patchset.

Cheers,
Jan

 tests/xfs/400-input-validation     | 226 +++++++++++++++++++++++++++++++++++++
 tests/xfs/400-input-validation.out |   2 +
 tests/xfs/group                    |   1 +
 3 files changed, 229 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..4ded2ef
--- /dev/null
+++ b/tests/xfs/400-input-validation
@@ -0,0 +1,226 @@
+#! /bin/bash
+# FS QA Test No. xfs/401
+#
+# mkfs.xfs input validation test. Designed to break mkfs.xfs if it doesn't
+# filter garbage input or invalid option combinations correctly.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2014 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
+
+echo silence is golden
+
+# clear out any options to mkfs first. We want to test realtime and external log
+# devices if we can, but we also want to control them ourselves.
+logdev=$SCRATCH_LOGDEV
+rtdev=$SCRATCH_RTDEV
+
+MKFS_OPTIONS=
+SCRATCH_LOGDEV=
+SCRATCH_RTDEV=
+
+# limit the image size of the filesystem being created to something small
+fssize=$((4 * 1024 * 1024 * 1024))
+fsimg=$TEST_DIR/$seq.img
+
+do_mkfs_pass()
+{
+        echo >> $seqres.full
+        echo "pass expected $*" >> $seqres.full
+        $MKFS_XFS_PROG -f -N $* >> $seqres.full 2>&1
+        [ $? -ne 0 ] && echo "fail $*"
+}
+
+do_mkfs_fail()
+{
+        echo >> $seqres.full
+        echo "fail expected $*" >> $seqres.full
+        $MKFS_XFS_PROG -f -N $* >> $seqres.full 2>&1
+        [ $? -eq 0 ] && echo "pass $*"
+}
+
+do_mkfs_pass $SCRATCH_DEV
+
+# basic "should fail" options
+# logarithm based options are no longer valid
+# NOTE: umm, when it got invalid? It seems to be still supported...
+#do_mkfs_fail -s log=10 $SCRATCH_DEV
+#do_mkfs_fail -b log=10 $SCRATCH_DEV
+#do_mkfs_fail -n log=10 $SCRATCH_DEV
+#do_mkfs_fail -i log=10 $SCRATCH_DEV
+#do_mkfs_fail -d sectlog=10 $SCRATCH_DEV
+#do_mkfs_fail -l sectlog=10 $SCRATCH_DEV
+
+# specifying sector sizes in sectors or blocks or garbage
+do_mkfs_fail -s size=2s $SCRATCH_DEV
+do_mkfs_fail -d sectsize=2s $SCRATCH_DEV
+do_mkfs_fail -l sectsize=2s $SCRATCH_DEV
+do_mkfs_fail -s size=2b $SCRATCH_DEV
+do_mkfs_fail -d sectsize=2b $SCRATCH_DEV
+do_mkfs_fail -l sectsize=2b $SCRATCH_DEV
+
+do_mkfs_fail -s size=grot $SCRATCH_DEV
+do_mkfs_fail -s size=2yerk $SCRATCH_DEV
+do_mkfs_fail -d sectsize=blah $SCRATCH_DEV
+do_mkfs_fail -d sectsize=2foo $SCRATCH_DEV
+do_mkfs_fail -l sectsize=nggh $SCRATCH_DEV
+do_mkfs_fail -l sectsize=2nggh $SCRATCH_DEV
+
+# conflicting sector/block sizes
+do_mkfs_fail -s size=512 -d sectsize=1024 $SCRATCH_DEV
+do_mkfs_fail -s size=512 -l sectsize=1024 $SCRATCH_DEV
+do_mkfs_fail -d sectsize=2048 -l sectsize=1024 $SCRATCH_DEV
+
+do_mkfs_fail -b size=512 -s size=1024 $SCRATCH_DEV
+do_mkfs_fail -b size=512 -d sectsize=1024 $SCRATCH_DEV
+do_mkfs_fail -b size=512 -l sectsize=1024 $SCRATCH_DEV
+
+# specifying block sizes in sectors without specifying sector size
+# or in blocks or garbage
+do_mkfs_fail -b size=2s $SCRATCH_DEV
+do_mkfs_fail -b size=2b $SCRATCH_DEV
+do_mkfs_fail -b size=nfi $SCRATCH_DEV
+do_mkfs_fail -b size=4096nfi $SCRATCH_DEV
+do_mkfs_fail -n size=2s $SCRATCH_DEV
+do_mkfs_fail -n size=2b $SCRATCH_DEV
+do_mkfs_fail -n size=nfi $SCRATCH_DEV
+do_mkfs_fail -n size=4096nfi $SCRATCH_DEV
+
+# bad label length
+do_mkfs_fail -L thisiswaytoolong $SCRATCH_DEV
+
+# basic "should pass" data section tests
+do_mkfs_pass $SCRATCH_DEV
+do_mkfs_pass -d name=$SCRATCH_DEV
+do_mkfs_pass -d size=$fssize $SCRATCH_DEV
+do_mkfs_pass -d agcount=32 $SCRATCH_DEV
+do_mkfs_pass -d agsize=32m $SCRATCH_DEV
+do_mkfs_pass -d agsize=32M $SCRATCH_DEV
+do_mkfs_pass -d agsize=1g $SCRATCH_DEV
+do_mkfs_pass -d agsize=$((32 * 1024 * 1024)) $SCRATCH_DEV
+do_mkfs_pass -b size=4096 -d agsize=8192b $SCRATCH_DEV
+do_mkfs_pass -d sectsize=512,agsize=65536s $SCRATCH_DEV
+do_mkfs_pass -s size=512 -d agsize=65536s $SCRATCH_DEV
+do_mkfs_pass -d noalign $SCRATCH_DEV
+do_mkfs_pass -d sunit=0,swidth=0 $SCRATCH_DEV
+do_mkfs_pass -d sunit=8,swidth=8 $SCRATCH_DEV
+do_mkfs_pass -d sunit=8,swidth=64 $SCRATCH_DEV
+do_mkfs_pass -d su=0,sw=0 $SCRATCH_DEV
+do_mkfs_pass -d su=4096,sw=1 $SCRATCH_DEV
+do_mkfs_pass -d su=4k,sw=1 $SCRATCH_DEV
+do_mkfs_pass -d su=4K,sw=8 $SCRATCH_DEV
+do_mkfs_pass -b size=4096 -d su=1b,sw=8 $SCRATCH_DEV
+do_mkfs_pass -d sectsize=512,su=8s,sw=8 $SCRATCH_DEV
+do_mkfs_pass -s size=512 -d su=8s,sw=8 $SCRATCH_DEV
+
+# invalid data section tests
+do_mkfs_fail -d size=${fssize}b $SCRATCH_DEV
+do_mkfs_fail -d size=${fssize}s $SCRATCH_DEV
+do_mkfs_fail -d size=${fssize}yerk $SCRATCH_DEV
+do_mkfs_fail -d agsize=8192b $SCRATCH_DEV
+do_mkfs_fail -d agsize=65536s $SCRATCH_DEV
+do_mkfs_fail -d agsize=32Mbsdfsdo $SCRATCH_DEV
+do_mkfs_fail -d agsize=1GB $SCRATCH_DEV
+do_mkfs_fail -d agcount=1k $SCRATCH_DEV
+do_mkfs_fail -d agcount=6b $SCRATCH_DEV
+do_mkfs_fail -d agcount=32,agsize=32m $SCRATCH_DEV
+do_mkfs_fail -d sunit=0,swidth=64 $SCRATCH_DEV
+do_mkfs_fail -d sunit=64,swidth=0 $SCRATCH_DEV
+do_mkfs_fail -d sunit=64,swidth=64,noalign $SCRATCH_DEV
+do_mkfs_fail -d sunit=64k,swidth=64 $SCRATCH_DEV
+do_mkfs_fail -d sunit=64,swidth=64m $SCRATCH_DEV
+do_mkfs_fail -d su=0,sw=64 $SCRATCH_DEV
+do_mkfs_fail -d su=4096,sw=0 $SCRATCH_DEV
+do_mkfs_fail -d su=4096,sw=64,noalign $SCRATCH_DEV
+do_mkfs_fail -d su=4096,sw=64s $SCRATCH_DEV
+do_mkfs_fail -d su=4096s,sw=64 $SCRATCH_DEV
+do_mkfs_fail -d su=4096b,sw=64 $SCRATCH_DEV
+do_mkfs_fail -d su=4096garabge,sw=64 $SCRATCH_DEV
+do_mkfs_fail -d su=4096,sw=64,sunit=64,swidth=64 $SCRATCH_DEV
+
+# file section, should pass
+rm -f $fsimg
+$XFS_IO_PROG -f -c "truncate $fssize" $fsimg
+do_mkfs_pass -d size=$fssize,file,name=$fsimg
+do_mkfs_pass -d size=$fssize,file $fsimg
+do_mkfs_pass $fsimg
+do_mkfs_pass -d size=$((fssize)) $fsimg
+do_mkfs_pass -d size=$((fssize)),name=$fsimg
+do_mkfs_pass -d size=$((fssize/2)) $fsimg
+# again this one, to check that we didn't truncated the file
+do_mkfs_pass -d size=$((fssize)) $fsimg
+
+# invalid file section tests
+rm -f $fsimg
+$XFS_IO_PROG -f -c "truncate $fssize" $fsimg
+do_mkfs_fail -d file $fsimg
+do_mkfs_fail -d file,name=$fsimg
+
+# naming section tests
+do_mkfs_pass -n size=65536 $SCRATCH_DEV
+
+# boolean options
+$XFS_IO_PROG -f -c "truncate $fssize" $fsimg
+do_mkfs_pass -d file=1,size=$fssize $fsimg
+do_mkfs_pass -d file=0 $SCRATCH_DEV
+do_mkfs_fail -d file=1 $SCRATCH_DEV
+
+# Specific flag combinations where some bug appeared during development,
+# to catch the same issue if it re-appears. If there are multiple similar
+# checks, move them to a standalone block.
+
+
+do_mkfs_pass -m crc=1,finobt=1 $SCRATCH_DEV
+
+do_mkfs_pass -m crc=1 -n ftype=1 $SCRATCH_DEV
+do_mkfs_pass -m crc=0 -n ftype=1 $SCRATCH_DEV
+do_mkfs_fail -m crc=1 -n ftype=0 $SCRATCH_DEV
+do_mkfs_pass -m crc=0 -n ftype=0 $SCRATCH_DEV
+do_mkfs_pass -n ftype=1 -m crc=0 $SCRATCH_DEV
+
+
+# if user states crc=0,finobt=1, fail instead of warning
+do_mkfs_fail -m crc=0,finobt=1 $SCRATCH_DEV
+
+status=0
+exit
diff --git a/tests/xfs/400-input-validation.out b/tests/xfs/400-input-validation.out
new file mode 100644
index 0000000..7080553
--- /dev/null
+++ b/tests/xfs/400-input-validation.out
@@ -0,0 +1,2 @@
+QA output created by 400-input-validation
+silence is golden
diff --git a/tests/xfs/group b/tests/xfs/group
index f4c6816..b51ef2e 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -285,3 +285,4 @@
 303 auto quick quota
 304 auto quick quota
 305 auto quota
+400-input-validation auto quick mkfs
-- 
2.5.0


WARNING: multiple messages have this Message-ID (diff)
From: Jan Tulak <jtulak@redhat.com>
To: fstests@vger.kernel.org
Cc: xfs@oss.sgi.com
Subject: [RFC PATCH] xfstests: Add mkfs input validation tests
Date: Thu, 28 Apr 2016 10:29:09 +0200	[thread overview]
Message-ID: <1461832149-18276-1-git-send-email-jtulak@redhat.com> (raw)
In-Reply-To: <1461231593-31294-1-git-send-email-jtulak@redhat.com>

Test inputs for my mkfs-cleaning patchset. This test will fail with the old sphageti code mkfs, among others because the old code accepts incorrect values.



Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Jan Tulak <jtulak@redhat.com>
---

Hi guys,

I'm sending this patch although the mentioned patchset is not yet merged.
It might help you a bit with checking if there are any issues with
the patchset, as here it is clear, what options works and what not.

But because this test fails with how mkfs currently validates values
(and some other things), maybe the merging of this patch should wait
for the patchset.

Cheers,
Jan

 tests/xfs/400-input-validation     | 226 +++++++++++++++++++++++++++++++++++++
 tests/xfs/400-input-validation.out |   2 +
 tests/xfs/group                    |   1 +
 3 files changed, 229 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..4ded2ef
--- /dev/null
+++ b/tests/xfs/400-input-validation
@@ -0,0 +1,226 @@
+#! /bin/bash
+# FS QA Test No. xfs/401
+#
+# mkfs.xfs input validation test. Designed to break mkfs.xfs if it doesn't
+# filter garbage input or invalid option combinations correctly.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2014 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
+
+echo silence is golden
+
+# clear out any options to mkfs first. We want to test realtime and external log
+# devices if we can, but we also want to control them ourselves.
+logdev=$SCRATCH_LOGDEV
+rtdev=$SCRATCH_RTDEV
+
+MKFS_OPTIONS=
+SCRATCH_LOGDEV=
+SCRATCH_RTDEV=
+
+# limit the image size of the filesystem being created to something small
+fssize=$((4 * 1024 * 1024 * 1024))
+fsimg=$TEST_DIR/$seq.img
+
+do_mkfs_pass()
+{
+        echo >> $seqres.full
+        echo "pass expected $*" >> $seqres.full
+        $MKFS_XFS_PROG -f -N $* >> $seqres.full 2>&1
+        [ $? -ne 0 ] && echo "fail $*"
+}
+
+do_mkfs_fail()
+{
+        echo >> $seqres.full
+        echo "fail expected $*" >> $seqres.full
+        $MKFS_XFS_PROG -f -N $* >> $seqres.full 2>&1
+        [ $? -eq 0 ] && echo "pass $*"
+}
+
+do_mkfs_pass $SCRATCH_DEV
+
+# basic "should fail" options
+# logarithm based options are no longer valid
+# NOTE: umm, when it got invalid? It seems to be still supported...
+#do_mkfs_fail -s log=10 $SCRATCH_DEV
+#do_mkfs_fail -b log=10 $SCRATCH_DEV
+#do_mkfs_fail -n log=10 $SCRATCH_DEV
+#do_mkfs_fail -i log=10 $SCRATCH_DEV
+#do_mkfs_fail -d sectlog=10 $SCRATCH_DEV
+#do_mkfs_fail -l sectlog=10 $SCRATCH_DEV
+
+# specifying sector sizes in sectors or blocks or garbage
+do_mkfs_fail -s size=2s $SCRATCH_DEV
+do_mkfs_fail -d sectsize=2s $SCRATCH_DEV
+do_mkfs_fail -l sectsize=2s $SCRATCH_DEV
+do_mkfs_fail -s size=2b $SCRATCH_DEV
+do_mkfs_fail -d sectsize=2b $SCRATCH_DEV
+do_mkfs_fail -l sectsize=2b $SCRATCH_DEV
+
+do_mkfs_fail -s size=grot $SCRATCH_DEV
+do_mkfs_fail -s size=2yerk $SCRATCH_DEV
+do_mkfs_fail -d sectsize=blah $SCRATCH_DEV
+do_mkfs_fail -d sectsize=2foo $SCRATCH_DEV
+do_mkfs_fail -l sectsize=nggh $SCRATCH_DEV
+do_mkfs_fail -l sectsize=2nggh $SCRATCH_DEV
+
+# conflicting sector/block sizes
+do_mkfs_fail -s size=512 -d sectsize=1024 $SCRATCH_DEV
+do_mkfs_fail -s size=512 -l sectsize=1024 $SCRATCH_DEV
+do_mkfs_fail -d sectsize=2048 -l sectsize=1024 $SCRATCH_DEV
+
+do_mkfs_fail -b size=512 -s size=1024 $SCRATCH_DEV
+do_mkfs_fail -b size=512 -d sectsize=1024 $SCRATCH_DEV
+do_mkfs_fail -b size=512 -l sectsize=1024 $SCRATCH_DEV
+
+# specifying block sizes in sectors without specifying sector size
+# or in blocks or garbage
+do_mkfs_fail -b size=2s $SCRATCH_DEV
+do_mkfs_fail -b size=2b $SCRATCH_DEV
+do_mkfs_fail -b size=nfi $SCRATCH_DEV
+do_mkfs_fail -b size=4096nfi $SCRATCH_DEV
+do_mkfs_fail -n size=2s $SCRATCH_DEV
+do_mkfs_fail -n size=2b $SCRATCH_DEV
+do_mkfs_fail -n size=nfi $SCRATCH_DEV
+do_mkfs_fail -n size=4096nfi $SCRATCH_DEV
+
+# bad label length
+do_mkfs_fail -L thisiswaytoolong $SCRATCH_DEV
+
+# basic "should pass" data section tests
+do_mkfs_pass $SCRATCH_DEV
+do_mkfs_pass -d name=$SCRATCH_DEV
+do_mkfs_pass -d size=$fssize $SCRATCH_DEV
+do_mkfs_pass -d agcount=32 $SCRATCH_DEV
+do_mkfs_pass -d agsize=32m $SCRATCH_DEV
+do_mkfs_pass -d agsize=32M $SCRATCH_DEV
+do_mkfs_pass -d agsize=1g $SCRATCH_DEV
+do_mkfs_pass -d agsize=$((32 * 1024 * 1024)) $SCRATCH_DEV
+do_mkfs_pass -b size=4096 -d agsize=8192b $SCRATCH_DEV
+do_mkfs_pass -d sectsize=512,agsize=65536s $SCRATCH_DEV
+do_mkfs_pass -s size=512 -d agsize=65536s $SCRATCH_DEV
+do_mkfs_pass -d noalign $SCRATCH_DEV
+do_mkfs_pass -d sunit=0,swidth=0 $SCRATCH_DEV
+do_mkfs_pass -d sunit=8,swidth=8 $SCRATCH_DEV
+do_mkfs_pass -d sunit=8,swidth=64 $SCRATCH_DEV
+do_mkfs_pass -d su=0,sw=0 $SCRATCH_DEV
+do_mkfs_pass -d su=4096,sw=1 $SCRATCH_DEV
+do_mkfs_pass -d su=4k,sw=1 $SCRATCH_DEV
+do_mkfs_pass -d su=4K,sw=8 $SCRATCH_DEV
+do_mkfs_pass -b size=4096 -d su=1b,sw=8 $SCRATCH_DEV
+do_mkfs_pass -d sectsize=512,su=8s,sw=8 $SCRATCH_DEV
+do_mkfs_pass -s size=512 -d su=8s,sw=8 $SCRATCH_DEV
+
+# invalid data section tests
+do_mkfs_fail -d size=${fssize}b $SCRATCH_DEV
+do_mkfs_fail -d size=${fssize}s $SCRATCH_DEV
+do_mkfs_fail -d size=${fssize}yerk $SCRATCH_DEV
+do_mkfs_fail -d agsize=8192b $SCRATCH_DEV
+do_mkfs_fail -d agsize=65536s $SCRATCH_DEV
+do_mkfs_fail -d agsize=32Mbsdfsdo $SCRATCH_DEV
+do_mkfs_fail -d agsize=1GB $SCRATCH_DEV
+do_mkfs_fail -d agcount=1k $SCRATCH_DEV
+do_mkfs_fail -d agcount=6b $SCRATCH_DEV
+do_mkfs_fail -d agcount=32,agsize=32m $SCRATCH_DEV
+do_mkfs_fail -d sunit=0,swidth=64 $SCRATCH_DEV
+do_mkfs_fail -d sunit=64,swidth=0 $SCRATCH_DEV
+do_mkfs_fail -d sunit=64,swidth=64,noalign $SCRATCH_DEV
+do_mkfs_fail -d sunit=64k,swidth=64 $SCRATCH_DEV
+do_mkfs_fail -d sunit=64,swidth=64m $SCRATCH_DEV
+do_mkfs_fail -d su=0,sw=64 $SCRATCH_DEV
+do_mkfs_fail -d su=4096,sw=0 $SCRATCH_DEV
+do_mkfs_fail -d su=4096,sw=64,noalign $SCRATCH_DEV
+do_mkfs_fail -d su=4096,sw=64s $SCRATCH_DEV
+do_mkfs_fail -d su=4096s,sw=64 $SCRATCH_DEV
+do_mkfs_fail -d su=4096b,sw=64 $SCRATCH_DEV
+do_mkfs_fail -d su=4096garabge,sw=64 $SCRATCH_DEV
+do_mkfs_fail -d su=4096,sw=64,sunit=64,swidth=64 $SCRATCH_DEV
+
+# file section, should pass
+rm -f $fsimg
+$XFS_IO_PROG -f -c "truncate $fssize" $fsimg
+do_mkfs_pass -d size=$fssize,file,name=$fsimg
+do_mkfs_pass -d size=$fssize,file $fsimg
+do_mkfs_pass $fsimg
+do_mkfs_pass -d size=$((fssize)) $fsimg
+do_mkfs_pass -d size=$((fssize)),name=$fsimg
+do_mkfs_pass -d size=$((fssize/2)) $fsimg
+# again this one, to check that we didn't truncated the file
+do_mkfs_pass -d size=$((fssize)) $fsimg
+
+# invalid file section tests
+rm -f $fsimg
+$XFS_IO_PROG -f -c "truncate $fssize" $fsimg
+do_mkfs_fail -d file $fsimg
+do_mkfs_fail -d file,name=$fsimg
+
+# naming section tests
+do_mkfs_pass -n size=65536 $SCRATCH_DEV
+
+# boolean options
+$XFS_IO_PROG -f -c "truncate $fssize" $fsimg
+do_mkfs_pass -d file=1,size=$fssize $fsimg
+do_mkfs_pass -d file=0 $SCRATCH_DEV
+do_mkfs_fail -d file=1 $SCRATCH_DEV
+
+# Specific flag combinations where some bug appeared during development,
+# to catch the same issue if it re-appears. If there are multiple similar
+# checks, move them to a standalone block.
+
+
+do_mkfs_pass -m crc=1,finobt=1 $SCRATCH_DEV
+
+do_mkfs_pass -m crc=1 -n ftype=1 $SCRATCH_DEV
+do_mkfs_pass -m crc=0 -n ftype=1 $SCRATCH_DEV
+do_mkfs_fail -m crc=1 -n ftype=0 $SCRATCH_DEV
+do_mkfs_pass -m crc=0 -n ftype=0 $SCRATCH_DEV
+do_mkfs_pass -n ftype=1 -m crc=0 $SCRATCH_DEV
+
+
+# if user states crc=0,finobt=1, fail instead of warning
+do_mkfs_fail -m crc=0,finobt=1 $SCRATCH_DEV
+
+status=0
+exit
diff --git a/tests/xfs/400-input-validation.out b/tests/xfs/400-input-validation.out
new file mode 100644
index 0000000..7080553
--- /dev/null
+++ b/tests/xfs/400-input-validation.out
@@ -0,0 +1,2 @@
+QA output created by 400-input-validation
+silence is golden
diff --git a/tests/xfs/group b/tests/xfs/group
index f4c6816..b51ef2e 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -285,3 +285,4 @@
 303 auto quick quota
 304 auto quick quota
 305 auto quota
+400-input-validation auto quick mkfs
-- 
2.5.0

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2016-04-28  8:29 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-21  9:39 [PATCH 00/19 v2] mkfs cleaning Jan Tulak
2016-04-21  9:39 ` [PATCH 01/19] xfsprogs: use common code for multi-disk detection Jan Tulak
2016-04-21  9:39 ` [PATCH 02/19] mkfs: sanitise ftype parameter values Jan Tulak
2016-04-21  9:39 ` [PATCH 03/19] mkfs: Sanitise the superblock feature macros Jan Tulak
2016-05-02 23:06   ` Eric Sandeen
2016-05-04  0:48     ` Eric Sandeen
2016-04-21  9:39 ` [PATCH 04/19] mkfs: validate all input values Jan Tulak
2016-04-21  9:39 ` [PATCH 05/19] mkfs: factor boolean option parsing Jan Tulak
2016-04-21  9:39 ` [PATCH 06/19] mkfs: validate logarithmic parameters sanely Jan Tulak
2016-04-21  9:39 ` [PATCH 07/19] mkfs: structify input parameter passing Jan Tulak
2016-04-21  9:39 ` [PATCH 08/19] mkfs: getbool is redundant Jan Tulak
2016-05-02 23:08   ` Eric Sandeen
2016-04-21  9:39 ` [PATCH 09/19] mkfs: use getnum_checked for all ranged parameters Jan Tulak
2016-04-21  9:39 ` [PATCH 10/19] mkfs: add respecification detection to generic parsing Jan Tulak
2016-04-21  9:39 ` [PATCH 11/19] mkfs: table based parsing for converted parameters Jan Tulak
2016-05-02 23:09   ` Eric Sandeen
2016-04-21  9:39 ` [PATCH 12/19] mkfs: merge getnum Jan Tulak
2016-04-21  9:39 ` [PATCH 13/19] mkfs: encode conflicts into parsing table Jan Tulak
2016-05-02 23:11   ` Eric Sandeen
2016-05-03 23:39   ` Eric Sandeen
2016-05-04  0:47     ` Eric Sandeen
2016-04-21  9:39 ` [PATCH 14/19] mkfs: add string options to generic parsing Jan Tulak
2016-05-02 23:11   ` Eric Sandeen
2016-04-21  9:39 ` [PATCH 15/19] mkfs: don't treat files as though they are block devices Jan Tulak
2016-04-21 12:43   ` Jan Tulak
2016-04-21 20:13     ` Eric Sandeen
2016-04-22  7:46       ` Jan Tulak
2016-04-22  7:49   ` [PATCH 15/19 v2] " Jan Tulak
2016-04-29 14:47     ` [PATCH 15/19 v3] " Jan Tulak
2016-04-29 19:11       ` Eric Sandeen
2016-05-03  9:59         ` Jan Tulak
2016-05-02 23:13   ` [PATCH 15/19] " Eric Sandeen
2016-04-21  9:39 ` [PATCH 16/19] mkfs: move spinodes crc check Jan Tulak
2016-04-21  9:39 ` [PATCH 17/19] mkfs: unit conversions are case insensitive Jan Tulak
2016-04-21  9:39 ` [PATCH 18/19] mkfs: add optional 'reason' for illegal_option Jan Tulak
2016-04-21  9:39 ` [PATCH 19/19] mkfs: conflicting values with disabled crc should fail Jan Tulak
2016-04-28  8:29 ` Jan Tulak [this message]
2016-04-28  8:29   ` [RFC PATCH] xfstests: Add mkfs input validation tests Jan Tulak
2016-04-29  1:59   ` Dave Chinner
2016-04-29  1:59     ` Dave Chinner
2016-04-29 14:42     ` Jan Tulak
2016-05-02 23:05 ` [PATCH 00/19 v2] mkfs cleaning Eric Sandeen
2016-05-10  6:10 ` Dave Chinner
2016-06-01 13:19   ` Jan Tulak
2016-06-03  0:53     ` Dave Chinner
2016-06-03  9:20       ` Jan Tulak
2016-06-03 12:09         ` Jan Tulak
2016-06-04  0:32           ` Dave Chinner
2016-06-06  7:42             ` 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=1461832149-18276-1-git-send-email-jtulak@redhat.com \
    --to=jtulak@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=xfs@oss.sgi.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.