A recent change to XFSQA to resolve mkfs option conflicts means mkfs can be run twice...
[xfstests-dev.git] / 162
1 #! /bin/sh
2 # FSQA Test No. 162
3 #
4 # Placing holds on objects
5 #
6 #-----------------------------------------------------------------------
7 #  Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
8 #-----------------------------------------------------------------------
9 #
10 # creator
11 owner=allanr@sgi.com
12
13 seq=`basename $0`
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1    # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
20
21 _cleanup()
22 {
23     _cleanup_testdir
24 }
25
26 # get standard environment, filters and checks
27 . ./common.rc
28 . ./common.filter
29 . ./common.dmapi
30
31 # real QA test starts here
32 _supported_fs xfs
33 _supported_os Linux IRIX
34
35 _require_scratch
36 _scratch_mkfs_xfs >/dev/null 2>&1
37 _dmapi_scratch_mount
38
39 qa_file=$SCRATCH_MNT/dmapi_hole_file
40 touch $qa_file
41
42 echo "***create session"
43 eval `${DMAPI_QASUITE1_DIR}../simple/dm_create_session`
44
45 echo "***create user event"
46 token="`${DMAPI_QASUITE1_DIR}cmd/create_userevent -s $newsid OBJECT_HOLD_EVENT | perl -ne 'if (/token ([0-9]+)/) { print $1; } '`"
47 [ $? -ne 0 ] && echo "failed to create user event"
48
49 echo "***check hold"
50 ${DMAPI_QASUITE1_DIR}cmd/obj_ref_query -s $newsid $token $qa_file
51 ${DMAPI_QASUITE1_DIR}cmd/obj_ref_hold -s $newsid $token $qa_file
52 ${DMAPI_QASUITE1_DIR}cmd/obj_ref_query -s $newsid $token $qa_file
53
54 echo "***check holding an object thats already held"
55 ${DMAPI_QASUITE1_DIR}cmd/obj_ref_hold -s $newsid $token $qa_file 2>/dev/null
56 [ $? -eq 0 ] && echo "obj_ref_hold should have failed"
57
58 echo "***release object"
59 ${DMAPI_QASUITE1_DIR}cmd/obj_ref_rele -s $newsid $token $qa_file
60 ${DMAPI_QASUITE1_DIR}cmd/obj_ref_query -s $newsid $token $qa_file
61
62 echo "***release object with no hold"
63 ${DMAPI_QASUITE1_DIR}cmd/obj_ref_rele -s $newsid $token $qa_file 2>/dev/null
64 [ $? -eq 0 ] && echo "obj_ref_rele should have failed"
65
66 echo "***respond to user event"
67 ${DMAPI_QASUITE1_DIR}cmd/respond_event $newsid $token 1 0
68 [ $? -ne 0 ] && echo "1st respond_event failed."
69
70 ${DMAPI_QASUITE1_DIR}../simple/dm_destroy_session -s $newsid
71
72 status=0
73 exit