Files
apfstests/tests/xfs/135
T
Darrick J. Wong c08ebd092d xfs: fix $XFS_DB_PROG usage
xfs_db requires us to pass in the log device, if any; this can be
accomplished via _scratch_xfs_db_options (if we're operating on the
scratch device, anyway).  However, many of the tests/xfs/ scripts
pass only $SCRATCH_DEV directly, so they'll fail if we test with an
external log.  Fix that by adding a new _scratch_xfs_db helper.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eryu Guan <eguan@redhat.com>
2016-10-07 17:18:53 +08:00

72 lines
2.0 KiB
Bash
Executable File

#! /bin/bash
# FS QA Test No. 135
#
# This test verifies that the xfsprogs log formatting infrastructure works
# correctly for various log stripe unit values. The log is formatted with xfs_db
# and verified with xfs_logprint.
#
#-----------------------------------------------------------------------
# Copyright (c) 2015 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.*
}
rm -f $seqres.full
# get standard environment, filters and checks
. ./common/rc
. ./common/log
# real QA test starts here
# Modify as appropriate.
_supported_fs xfs
_supported_os Linux
_require_scratch
_require_v2log
_require_xfs_db_command "logformat"
_scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
# Reformat the log with various log stripe unit sizes and see if logprint dumps
# any errors. Use a cycle value larger than 1 so the log is actually written
# (the log is zeroed when cycle == 1).
for i in 16 32 64 128 256; do
lsunit=$((i * 1024))
_scratch_xfs_db -x -c "logformat -c 3 -s $lsunit" | \
tee -a $seqres.full
# don't redirect error output so it causes test failure
$XFS_LOGPRINT_PROG $SCRATCH_DEV >> $seqres.full
done
# success, all done
status=0
exit