[BACK]Return to 044 CVS log [TXT][DIR] Up to [Development] / xfs-cmds / xfstests

File: [Development] / xfs-cmds / xfstests / 044 (download)

Revision 1.19, Mon Sep 5 06:02:20 2005 UTC (12 years, 1 month ago) by nathans.longdrop.melbourne.sgi.com
Branch: MAIN
Changes since 1.18: +0 -2 lines

Dont write to /dev/console explicitly, its bad form.
Merge of master-melb:xfs-cmds:23723a by kenmcd.

#! /bin/sh
# FS QA Test No. 044
#
# external log uuid/format tests (TODO - version 2 log format)
#
#-----------------------------------------------------------------------
# Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
# 
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2 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.
# 
# Further, this software is distributed without any warranty that it is
# free of the rightful claim of any third person regarding infringement
# or the like.  Any license provided herein, whether implied or
# otherwise, applies only to this software file.  Patent licenses, if
# any, provided herein do not apply to combinations of this program with
# other software, or any other product whatsoever.
# 
# You should have received a copy of the GNU General Public License along
# with this program; if not, write the Free Software Foundation, Inc., 59
# Temple Place - Suite 330, Boston MA 02111-1307, USA.
# 
# Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
# Mountain View, CA  94043, or:
# 
# http://www.sgi.com 
# 
# For further information regarding this notice, see: 
# 
# http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
#-----------------------------------------------------------------------
#
# creator
owner=dxm@sgi.com

seq=`basename $0`
echo "QA output created by $seq"

here=`pwd`
tmp=/tmp/$$
status=1	# failure is the default!
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15

# get standard environment, filters and checks
. ./common.rc
. ./common.filter

# real QA test starts here
_supported_fs xfs
_supported_os Linux

_require_logdev

_filter_logprint()
{
	perl -ne '
	    s/data device: ([\w|\/.-]+)/data device: DDEV/;
	    s/log device: ([\w|\/.-]+) daddr: (\d+) length: (\d+)/log device: LDEV daddr: XXX length: XXX/;
	    s/log file: "([\w|\/.-]+)" daddr: (\d+) length: (\d+)/log device: LDEV daddr: XXX length: XXX/;
	    s/uuid: ([abcdef\d-]+)\s+format: (.+)/uuid: UUID format: FORMAT/;
	    s/skipped (\w+) zeroed blocks/skipped XXX zeroed blocks/;
	    print;
	'
}

_check_mount()
{
    echo "    *** mount (expect success)"
    if ! _scratch_mount
    then
        echo "        !!! mount failed (expecting success)"
        status=1
        exit
    fi

    echo "    *** umount"
    if ! umount $SCRATCH_DEV
    then
        echo "        !!! umount failed (expecting success)"
        status=1
        exit
    fi
}

_check_no_mount()
{
    echo "    *** mount (expect failure)"
    if _scratch_mount >$tmp.err 2>&1
    then
        cat $tmp.err
        echo "        !!! mount succeeded (expecting failure)"
        status=1
        exit
    fi
}

_check_require_logdev()
{
    echo "    *** mount without logdev (expect failure)"
    if mount -t xfs $SCRATCH_DEV $SCRATCH_MNT >$tmp.err 2>&1
    then
        cat $tmp.err
        echo "        !!! mount succeeded (expecting failure)"
        status=1
        exit
    fi
}

_unexpected()
{
    echo "        !!! unexpected XFS command failure"
    status=1
    exit
}


# real QA test starts here
# 
_require_scratch

echo "*** mkfs"

# this test only works for version 1 logs currently
lversion=1
lsize=16777216
_scratch_mkfs_xfs -lsize=$lsize,version=$lversion >$tmp.mkfs0 2>&1
[ $? -ne 0 ] && \
    _notrun "Cannot mkfs for this test using MKFS_OPTIONS specified"
_filter_mkfs <$tmp.mkfs0 2>$tmp.mkfs1
. $tmp.mkfs1
[ $lversion -ne 1 ] && \
    _notrun "Cannot run this test yet using MKFS_OPTIONS specified"

_check_mount
_check_require_logdev

echo "*** set uuid"
xfs_db -x $SCRATCH_DEV -l $SCRATCH_LOGDEV -c "uuid 02020202-0202-0202-0202-020202020202"
[ $? -ne 0 ] && _unexpected
_check_mount

echo "*** zero log"
$here/src/loggen -z 100 >$SCRATCH_LOGDEV
_check_mount

echo "*** write clean log"
$here/src/loggen -u 2 -f 1 -m 1 -z 100 >$SCRATCH_LOGDEV
_check_mount

echo "*** write clean log (different format)"
$here/src/loggen -u 2 -f 99 -m 1 -z 100 >$SCRATCH_LOGDEV
_check_mount

echo "*** write clean log (different uuid)"
$here/src/loggen -u 7 -m 1 -z 100 >$SCRATCH_LOGDEV
_check_no_mount

echo "*** write clean log (different uuid & format)"
$here/src/loggen -u 7 -f 99 -m 1 -z 100 >$SCRATCH_LOGDEV
_check_no_mount

echo "*** write dirty log"
$here/src/loggen -u 2 -e 1 -z 100 >$SCRATCH_LOGDEV
_check_mount

echo "*** write dirty log (different format)"
$here/src/loggen -u 2 -f 99 -e 1 -z 100 >$SCRATCH_LOGDEV
_check_no_mount

echo "*** write dirty log (irix style)"
$here/src/loggen -u 0 -f 0 -e 1 -z 100 >$SCRATCH_LOGDEV
_check_no_mount

echo "*** write large dirty log"
$here/src/loggen -u 2 -e 16000 -z 100 >$SCRATCH_LOGDEV
_check_mount

echo -e -n "\n\r*** XFS QA 044 - done\n\r\n\r" >/dev/console

status=0
# if error
exit