1 #
2 # CDDL HEADER START
3 #
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
7 #
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
12 #
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 #
19 # CDDL HEADER END
20 #
21
22 #
23 # Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26 # NFSv4 VERIFY operation test - negative tests
27 # verify SERVER errors returned with invalid Verify.
28
29 # include all test enironment
30 source VERIFY.env
31
32 # connect to the test server
33 Connect
34
35 # setting local variables
36 set TNAME $argv0
37 set bfh [get_fh $BASEDIRS]
38
39 # Start testing
40 # --------------------------------------------------------------
41 # a: Verify without Putrootfh, expect NOFILEHANDLE
42 set expcode "NOFILEHANDLE"
43 set ASSERTION "Verify without Putrootfh, expect $expcode"
44 set tag "$TNAME{a}"
45 putmsg stdout 0 "$tag: $ASSERTION"
46 set res [compound {Verify {{type reg}}}]
47 ckres "Verify" $status $expcode $res $PASS
48
49
50 # b: try to Verify while the obj is removed, expect STALE
51 set expcode "STALE"
52 set ASSERTION "try to Verify while obj is removed, expect $expcode"
53 set tag "$TNAME{b}"
54 #putmsg stdout 0 "$tag: $ASSERTION"
55 #set tmpd "tmp.[pid]"
56 #set res [compound {Putfh $bfh; Create $tmpd {{mode 0755}} d; Getfh}]
57 #set tfh [lindex [lindex $res 2] 2]
58 #check_op "Putfh $bfh; Remove $tmpd" "OK" "UNINITIATED"
59 #set res [compound {Putfh $tfh; Verify {{cansettime true}}; Getfh}]
60 #ckres "Verify" $status $expcode $res $PASS
61 #puts "\t Test UNTESTED: XXX need to remove <cfh> between PUTFH/VERIFY\n"
62
63
64 # c: Verify an attribute is not supported, expect ATTRNOTSUPP
65 set expcode "ATTRNOTSUPP"
66 set ASSERTION "Verify an attribute is not supported, expect $expcode"
67 set tag "$TNAME{c}"
68 putmsg stdout 0 "$tag: $ASSERTION"
69 set nsattr "hidden"
70 # check this attr is not in supported_attrs list
71 set res [compound {Putfh $bfh; Getattr supported_attrs}]
72 if {[lsearch -exact [lindex [lindex [lindex $res 1] 2] 1] $nsattr] >= 0} {
73 putmsg stdout 0 "\t Test NOTINUSE: attr($nsattr) is in supported_attrs list"
74 } else {
75 set res [compound {Putfh $bfh; Verify {{$nsattr "true"}}; Getfh}]
76 ckres "Verify" $status $expcode $res $PASS
77 }
78
79
80 # d: Verify from a bad-FH, expect BADHANDLE
81 set expcode "BADHANDLE"
82 set ASSERTION "Verify from a bad-FH, expect $expcode"
83 set tag "$TNAME{d}"
84 #putmsg stdout 0 "$tag: $ASSERTION"
85 #set res [compound {Putrootfh; Lookup "__badfh"; Verify {{mode 000}}}]
86 #ckres "Verify" $status $expcode $res $PASS
87 #puts "\t Test UNTESTED: XXX need nfsv4shell & server support on BADFH\n"
88
89
90 # g: Verify without permission, expect ACCESS
91 set expcode "ACCESS"
92 set ASSERTION "Verify without permission, expect $expcode"
93 set tag "$TNAME{g}"
94 #putmsg stdout 0 "$tag: $ASSERTION"
95 #puts "\t Test UNTESTED: XXX need <cfh> permission changed in server\n"
96
97
98 # h: Verify with WrongSec, expect WRONGSEC
99 set expcode "WRONGSEC"
100 set ASSERTION "Verify with WrongSec, expect $expcode"
101 set tag "$TNAME{h}"
102 #putmsg stdout 0 "$tag: $ASSERTION"
103 #puts "\t Test UNTESTED: XXX need hook to change Sec of <CFH> from SERVER\n"
104
105
106 # i: XXX how do we simulate some server errors:
107 # NFS4ERR_IO
108 # NFS4ERR_MOVE
109 # NFS4ERR_SERVERFAULT
110 # NFS4ERR_RESOURCE
111
112
113 # m: try to Verify of expired FH, expect FHEXPIRED
114 set expcode "FHEXPIRED"
115 set ASSERTION "Verify an expired FH, expect $expcode"
116 set tag "$TNAME{m}"
117 #putmsg stdout 0 "$tag: $ASSERTION"
118 #puts "\t Test UNTESTED: XXX need hook for FH to expire\n"
119
120
121 # n: try to Verify with DELAY, expect with DELAY
122 set expcode "DELAY"
123 set ASSERTION "Verify with DELAY, expect $expcode"
124 set tag "$TNAME{n}"
125 #putmsg stdout 0 "$tag: $ASSERTION"
126 #puts "\t Test UNTESTED: XXX need server hooks on the delay??\n"
127
128
129 # o: Verify with rdattr_error, expect INVAL
130 set expcode "INVAL"
131 set ASSERTION "Verify with rdattr_error, expect $expcode"
132 set tag "$TNAME{o}"
133 putmsg stdout 0 "$tag: $ASSERTION"
134 set res [compound {Putfh $bfh; Verify {{rdattr_error "OK"}}}]
135 ckres "Verify" $status $expcode $res $PASS
136
137 # p: Verify with time_access_set to time value, expect INVAL
138 set expcode "INVAL"
139 set ASSERTION "Verify w/time_access_set to time value, expect $expcode"
140 set tag "$TNAME{p}"
141 putmsg stdout 0 "$tag: $ASSERTION"
142 set nta "[clock seconds] 0"
143 set res [compound {Putfh $bfh; Verify {{time_access_set {$nta}}}}]
144 ckres "Verify" $status $expcode $res $PASS
145
146 # q: Verify with time_modify_set to server time, expect INVAL
147 set expcode "INVAL"
148 set ASSERTION "Verify w/time_access_set to server time, expect $expcode"
149 set tag "$TNAME{q}"
150 putmsg stdout 0 "$tag: $ASSERTION"
151 set res [compound {Putfh $bfh; Verify {{time_modify_set 0}}}]
152 ckres "Verify" $status $expcode $res $PASS
153
154
155 # --------------------------------------------------------------
156 # disconnect and exit
157 Disconnect
158 exit $PASS