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

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

Revision 1.1, Tue Jan 16 02:58:21 2007 UTC (10 years, 9 months ago) by allanr.longdrop.melbourne.sgi.com
Branch: MAIN

Integrate dmapi suite 1 into xfsqa infrastructure
Merge of master-melb:xfs-cmds:27924a by kenmcd.

  Create three DMAPI sessions,
  verify they have been created,
  then distroy first session

#! /bin/sh
# FSQA Test No. 151
#
# Create three DMAPI sessions,
# verify they have been created,
# then distroy first session
#
#-----------------------------------------------------------------------
#  Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
#-----------------------------------------------------------------------
#
# creator
owner=allanr@sgi.com

seq=`basename $0`
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()
{
    _cleanup_testdir
}

_dm_create_session()
{
    eval `${DMAPI_QASUITE1_DIR}../simple/dm_create_session`
    echo "RET=$ret NEWSID=NUM"
}

_filter_sid_list()
{
    $SED_PROG -e "s/sids=\"[0-9| ]*\"/sids=NUMS/"
}

_check_sids()
{
    ${DMAPI_QASUITE1_DIR}../simple/dm_getall_sessions | grep "$@" > /dev/null
    if [ $? -ne 0 ] ; then
        echo "ERROR: SID(s) not created"
        ${DMAPI_QASUITE1_DIR}../simple/dm_getall_sessions >>$seq.full
    fi
}

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

# real QA test starts here
_supported_fs xfs
_supported_os Linux IRIX

_require_scratch
_scratch_mkfs_xfs >/dev/null 2>&1
_dmapi_scratch_mount

echo "*** create 3 sessions"
_dm_create_session
sid1=$newsid
_dm_create_session
sid2=$newsid
_dm_create_session
sid3=$newsid

echo "*** check 3 sessions exist"
_check_sids "$sid1 $sid2 $sid3"

echo "*** destroy first session"
${DMAPI_QASUITE1_DIR}../simple/dm_destroy_session -s $sid1

#should fail
echo "*** check first session no longer exists"
_check_sids "$sid1"

#should still remain
echo "*** check last 2 session exist"
_check_sids "$sid2 $sid3"

echo "*** query"
${DMAPI_QASUITE1_DIR}../simple/dm_query_session -s $sid2

echo "*** remove remaining sessions"
${DMAPI_QASUITE1_DIR}../simple/dm_destroy_session -s $sid2
${DMAPI_QASUITE1_DIR}../simple/dm_destroy_session -s $sid3

echo "*** check second session no longer exists"
_check_sids "$sid2"

echo "*** check third session no longer exists"
_check_sids "$sid3"

status=0
exit