]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfs: make sure pretty printed geometry output matches
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 5 Jun 2018 16:43:33 +0000 (09:43 -0700)
committerEryu Guan <guaneryu@gmail.com>
Fri, 8 Jun 2018 06:12:25 +0000 (14:12 +0800)
Make sure that all of our commands that can print geometry
information all print the /same/ information.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/xfs
tests/xfs/449 [new file with mode: 0755]
tests/xfs/449.out [new file with mode: 0644]
tests/xfs/group

index 5b3fb28cabf035db6e733495c46d3e7e89776728..55cfa943125368abe8b7c4571cf6bd61884b90a9 100644 (file)
@@ -720,3 +720,43 @@ _require_xfs_db_write_array()
        rm -f $TEST_DIR/$seq.img
        [ $supported -eq 0 ] && _notrun "xfs_db write can't support array"
 }
+
+_require_xfs_spaceman_command()
+{
+       if [ -z "$1" ]; then
+               echo "Usage: _require_xfs_spaceman_command command [switch]" 1>&2
+               exit 1
+       fi
+       local command=$1
+       shift
+       local param="$*"
+       local param_checked=0
+       local opts=""
+
+       _require_command "$XFS_SPACEMAN_PROG" "xfs_spaceman"
+
+       testfile=$TEST_DIR/$$.xfs_spaceman
+       case $command in
+       *)
+               testio=`$XFS_SPACEMAN_PROG -c "help $command" $TEST_DIR 2>&1`
+       esac
+
+       rm -f $testfile 2>&1 > /dev/null
+       echo $testio | grep -q "not found" && \
+               _notrun "xfs_spaceman $command support is missing"
+       echo $testio | grep -q "Operation not supported" && \
+               _notrun "xfs_spaceman $command failed (old kernel/wrong fs?)"
+       echo $testio | grep -q "Invalid" && \
+               _notrun "xfs_spaceman $command failed (old kernel/wrong fs/bad args?)"
+       echo $testio | grep -q "foreign file active" && \
+               _notrun "xfs_spaceman $command not supported on $FSTYP"
+       echo $testio | grep -q "Function not implemented" && \
+               _notrun "xfs_spaceman $command support is missing (missing syscall?)"
+
+       [ -n "$param" ] || return
+
+       if [ $param_checked -eq 0 ]; then
+               $XFS_SPACEMAN_PROG -c "help $command" | grep -q "^ $param --" || \
+                       _notrun "xfs_spaceman $command doesn't support $param"
+       fi
+}
diff --git a/tests/xfs/449 b/tests/xfs/449
new file mode 100755 (executable)
index 0000000..f12fffa
--- /dev/null
@@ -0,0 +1,86 @@
+#! /bin/bash
+# FS QA Test No. 449
+#
+# Make sure pretty printed XFS geometry is the same across all programs.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2018 Oracle, Inc.
+#
+# 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
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+       cd /
+       rm -f $tmp.*
+}
+
+rm -f $seqres.full
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+
+_require_scratch_nocheck
+
+# Geometry printing wasn't unified until xfs_spaceman grew an 'info'
+# command, so skip this test if there is no spaceman or it doesn't
+# know what 'info' is.
+_require_xfs_spaceman_command "info"
+_require_command "$XFS_GROWFS_PROG" xfs_growfs
+
+_scratch_mkfs > $tmp.mkfs
+echo MKFS >> $seqres.full
+cat $tmp.mkfs >> $seqres.full
+
+_scratch_xfs_db -c "info" > $tmp.dbinfo
+echo DB >> $seqres.full
+cat $tmp.dbinfo >> $seqres.full
+diff -u $tmp.mkfs $tmp.dbinfo
+
+_scratch_mount
+
+$XFS_SPACEMAN_PROG -c "info" $SCRATCH_MNT > $tmp.spaceman
+echo SPACEMAN >> $seqres.full
+cat $tmp.spaceman >> $seqres.full
+diff -u $tmp.mkfs $tmp.spaceman
+
+$XFS_GROWFS_PROG -n $SCRATCH_MNT > $tmp.growfs
+echo GROWFS >> $seqres.full
+cat $tmp.growfs >> $seqres.full
+diff -u $tmp.mkfs $tmp.growfs
+
+$XFS_INFO_PROG $SCRATCH_MNT > $tmp.info
+echo INFO >> $seqres.full
+cat $tmp.info >> $seqres.full
+diff -u $tmp.mkfs $tmp.info
+
+echo "Silence is golden."
+status=0
+exit 0
diff --git a/tests/xfs/449.out b/tests/xfs/449.out
new file mode 100644 (file)
index 0000000..6da1414
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 449
+Silence is golden.
index 4b564ded82645c6505a89e99e5ea09d19e89cfdc..932ab9092419ca1dabb1fd445cb4c2df3c3fe41e 100644 (file)
 446 auto quick
 447 auto mount
 448 auto quick fuzzers
+449 auto quick