xfstests: kill useless test owner fields
[xfstests-dev.git] / 151
1 #! /bin/bash
2 # FSQA Test No. 151
3 #
4 # Create three DMAPI sessions,
5 # verify they have been created,
6 # then distroy first session
7 #
8 #-----------------------------------------------------------------------
9 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
10 #
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation.
14 #
15 # This program is distributed in the hope that it would be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 # GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write the Free Software Foundation,
22 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
23 #
24 #-----------------------------------------------------------------------
25 #
26
27 seq=`basename $0`
28 echo "QA output created by $seq"
29
30 here=`pwd`
31 tmp=/tmp/$$
32 status=1    # failure is the default!
33 trap "_cleanup; exit \$status" 0 1 2 3 15
34
35 _cleanup()
36 {
37     _cleanup_testdir
38 }
39
40 _dm_create_session()
41 {
42     eval `${DMAPI_QASUITE1_DIR}../simple/dm_create_session`
43     echo "RET=$ret NEWSID=NUM"
44 }
45
46 _filter_sid_list()
47 {
48     $SED_PROG -e "s/sids=\"[0-9| ]*\"/sids=NUMS/"
49 }
50
51 _check_sids()
52 {
53         for i in $@; do
54                 CHECKED_SID=`${DMAPI_QASUITE1_DIR}../simple/dm_getall_sessions \
55                         | perl -ne "if (/^sids.*[\"|\s]($i)[\"|\s].*/) {print \$1} ;"`
56                 if [ -z "$CHECKED_SID" ] ; then
57                         echo "ERROR: SID(s) not created"
58                         ${DMAPI_QASUITE1_DIR}../simple/dm_getall_sessions >>$seq.full
59                         return
60                 fi
61         done
62 }
63
64 # get standard environment, filters and checks
65 . ./common.rc
66 . ./common.filter
67 . ./common.dmapi
68
69 # real QA test starts here
70 _supported_fs xfs
71 _supported_os Linux IRIX
72
73 _require_scratch
74 _scratch_mkfs_xfs >/dev/null 2>&1
75 _dmapi_scratch_mount
76
77 echo "*** create 3 sessions"
78 _dm_create_session
79 sid1=$newsid
80 _dm_create_session
81 sid2=$newsid
82 _dm_create_session
83 sid3=$newsid
84
85 echo "*** check 3 sessions exist"
86 _check_sids $sid1 $sid2 $sid3
87
88 echo "*** destroy first session"
89 ${DMAPI_QASUITE1_DIR}../simple/dm_destroy_session -s $sid1
90
91 #should fail
92 echo "*** check first session no longer exists"
93 _check_sids $sid1
94
95 #should still remain
96 echo "*** check last 2 session exist"
97 _check_sids $sid2 $sid3
98
99 echo "*** query"
100 ${DMAPI_QASUITE1_DIR}../simple/dm_query_session -s $sid2
101
102 echo "*** remove remaining sessions"
103 ${DMAPI_QASUITE1_DIR}../simple/dm_destroy_session -s $sid2
104 ${DMAPI_QASUITE1_DIR}../simple/dm_destroy_session -s $sid3
105
106 echo "*** check second session no longer exists"
107 _check_sids $sid2
108
109 echo "*** check third session no longer exists"
110 _check_sids $sid3
111
112 status=0
113 exit