xfs: Add test for too-small device with stripe geometry
authorPavel Reichl <preichl@redhat.com>
Mon, 21 Sep 2020 08:55:11 +0000 (10:55 +0200)
committerEryu Guan <guaneryu@gmail.com>
Sun, 27 Sep 2020 09:36:46 +0000 (17:36 +0800)
Verify hat an attempt to create a too-small device with stripe geometry,
is handled gracefully instead of hitting an assert in align_ag_geometry()

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

diff --git a/tests/xfs/260 b/tests/xfs/260
new file mode 100755 (executable)
index 0000000..f4da030
--- /dev/null
@@ -0,0 +1,51 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2020 Red Hat, Inc.. All Rights Reserved.
+#
+# FS QA Test 260
+#
+# Verify that an attempt to create a too-small device with stripe geometry,
+# is handled gracefully instead of hitting an assert in align_ag_geometry()
+#
+# This test verifies the problem fixed in xfsprogs with commit
+# (mkfs.xfs: fix ASSERT on too-small device with stripe geometry)
+#
+
+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.*
+       rm -f $localfile
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+echo 'Silence is golden'
+
+_supported_fs xfs
+_require_test
+
+localfile=$TEST_DIR/$seq.$$
+
+$XFS_IO_PROG -f -c "truncate 10444800" $localfile
+
+$MKFS_XFS_PROG -dsu=65536,sw=1 $localfile >> $seqres.full 2>&1
+
+[ $? -ne 1 ] && echo "${MKFS_XFS_PROG} should fail gracefully"
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/260.out b/tests/xfs/260.out
new file mode 100644 (file)
index 0000000..18ca517
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 260
+Silence is golden
index b837435..c8713ca 100644 (file)
 257 auto quick clone
 258 auto quick clone
 259 auto quick
+260 auto quick mkfs
 261 auto quick quota
 262 dangerous_fuzzers dangerous_scrub dangerous_online_repair
 263 auto quick quota