fstests: convert remaining tests to SPDX license tags
[xfstests-dev.git] / tests / xfs / 160
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FSQA Test No. 160
6 #
7 # Change and view DMAPI access rights.
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1    # failure is the default!
16 trap "exit \$status" 0 1 2 3 15
17
18 # get standard environment, filters and checks
19 . ./common/rc
20 . ./common/filter
21 . ./common/dmapi
22
23 # real QA test starts here
24 _supported_fs xfs
25 _supported_os Linux
26
27 _require_scratch
28 _scratch_mkfs_xfs >/dev/null 2>&1
29 _dmapi_scratch_mount
30
31 touch $SCRATCH_MNT/dmapi_test
32
33 echo "***create session"
34 eval `${DMAPI_QASUITE1_DIR}../simple/dm_create_session`
35
36 echo "***create user event"
37 token="`${DMAPI_QASUITE1_DIR}cmd/create_userevent -s $newsid ACCESS_RIGHT_EVENT | perl -ne 'if (/token ([0-9]+)/) { print $1; } '`"
38 [ $? -ne 0 ] && echo "failed to create user event"
39
40 echo "*** query & up/downgrade right"
41 ${DMAPI_QASUITE1_DIR}cmd/query_right -s $newsid $token $SCRATCH_MNT/dmapi_test
42
43 ${DMAPI_QASUITE1_DIR}cmd/request_right -s $newsid $token $SCRATCH_MNT/dmapi_test DM_RIGHT_SHARED
44 ${DMAPI_QASUITE1_DIR}cmd/query_right -s $newsid $token $SCRATCH_MNT/dmapi_test
45
46 ${DMAPI_QASUITE1_DIR}cmd/upgrade_right -s $newsid $token $SCRATCH_MNT/dmapi_test
47 ${DMAPI_QASUITE1_DIR}cmd/query_right -s $newsid $token $SCRATCH_MNT/dmapi_test
48
49 ${DMAPI_QASUITE1_DIR}cmd/downgrade_right -s $newsid $token $SCRATCH_MNT/dmapi_test
50 ${DMAPI_QASUITE1_DIR}cmd/query_right -s $newsid $token $SCRATCH_MNT/dmapi_test
51
52 echo "*** respond to event"
53 ${DMAPI_QASUITE1_DIR}cmd/respond_event $newsid $token 1 0
54
55 echo "*** destroy session"
56 ${DMAPI_QASUITE1_DIR}../simple/dm_destroy_session -s $newsid
57
58 status=0
59 exit