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 NVERIFY operation test - negative tests
27 # verify SERVER errors returned with invalid Nverify.
28
29 # include all test enironment
30 source NVERIFY.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: Nverify without Putrootfh, expect NOFILEHANDLE
42 set expcode "NOFILEHANDLE"
43 set ASSERTION "Nverify without Putrootfh, expect $expcode"
44 set tag "$TNAME{a}"
45 putmsg stdout 0 "$tag: $ASSERTION"
46 set res [compound {Nverify {{type reg}}}]
47 ckres "Nverify" $status $expcode $res $PASS
48
49
50 # b: try to Nverify while the obj is removed, expect STALE
51 set expcode "STALE"
52 set ASSERTION "try to Nverify 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 0777}} 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; Nverify {{cansettime true}}; Getfh}]
60 #ckres "Nverify" $status $expcode $res $PASS
61 #puts "\t Test UNTESTED: XXX need to remove <cfh> between PUTFH/NVERIFY\n"
62
63
64 # c: Nverify an attribute is not supported, expect ATTRNOTSUPP
65 set expcode "ATTRNOTSUPP"
66 set ASSERTION "Nverify 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; Nverify {{$nsattr "true"}}; Getfh}]
76 ckres "Nverify" $status $expcode $res $PASS
77 }
78
79
80 # d: Nverify from a bad-FH, expect BADHANDLE
81 set expcode "BADHANDLE"
82 set ASSERTION "Nverify from a bad FH, expect $expcode"
83 set tag "$TNAME{d}"
84 #putmsg stdout 0 "$tag: $ASSERTION"
85 #set res [compound {Putrootfh; Lookup "__badfh"; Nverify {{mode 000}}}]
86 #ckres "Nverify" $status $expcode $res $PASS
87 #puts "\t Test UNTESTED: XXX need nfsv4shell & server support on BADFH\n"
88
89
90 # g: Nverify without permission, expect ACCESS
91 set expcode "ACCESS"
92 set ASSERTION "Nverify from root, 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: Nverify with WrongSec, expect WRONGSEC
99 # XXX Need server w/Krb5 setup
100 set expcode "WRONGSEC"
101 set ASSERTION "Nverify with WrongSec, expect $expcode"
102 set tag "$TNAME{h}"
103 #putmsg stdout 0 "$tag: $ASSERTION"
104 #puts "\t Test UNTESTED: XXX need more on Sec support\n"
105
106
107 # i: XXX how do we simulate some server errors:
108 # NFS4ERR_IO
109 # NFS4ERR_MOVE
110 # NFS4ERR_SERVERFAULT
111 # NFS4ERR_RESOURCE
112
113
114 # m: try to Nverify of expired FH, expect FHEXPIRED
115 set expcode "FHEXPIRED"
116 set ASSERTION "Nverify an expired FH, expect $expcode"
117 set tag "$TNAME{m}"
118 #putmsg stdout 0 "$tag: $ASSERTION"
119 #puts "\t Test UNTESTED: XXX need hook for FH to expire\n"
120
121
122 # n: try to Nverify with DELAY, expect with DELAY
123 # XXX need nfsv4shell to set invalid bits?
124 set expcode "DELAY"
125 set ASSERTION "Nverify with DELAY, expect $expcode"
126 set tag "$TNAME{n}"
127 #putmsg stdout 0 "$tag: $ASSERTION"
128 #puts "\t Test UNTESTED: XXX need server hooks on the delay??\n"
129
130
131 # o: Nverify with rdattr_error, expect INVAL
132 set expcode "INVAL"
133 set ASSERTION "Nverify with rdattr_error, expect $expcode"
134 set tag "$TNAME{o}"
135 putmsg stdout 0 "$tag: $ASSERTION"
136 set res [compound {Putfh $bfh; Nverify {{rdattr_error "OK"}}}]
137 ckres "Nverify" $status $expcode $res $PASS
138
139 # p: Nverify with time_access_set to time value, expect INVAL
140 set expcode "INVAL"
141 set ASSERTION "Nverify w/time_access_set to time value, expect $expcode"
142 set tag "$TNAME{p}"
143 putmsg stdout 0 "$tag: $ASSERTION"
144 set nta "[clock seconds] 0"
145 set res [compound {Putfh $bfh; Nverify {{time_access_set {$nta}}}}]
146 ckres "Nverify" $status $expcode $res $PASS
147
148 # q: Nverify with time_modify_set to server time, expect INVAL
149 set expcode "INVAL"
150 set ASSERTION "Nverify w/time_access_set to server time, expect $expcode"
151 set tag "$TNAME{q}"
152 putmsg stdout 0 "$tag: $ASSERTION"
153 set res [compound {Putfh $bfh; Nverify {{time_modify_set 0}}}]
154 ckres "Nverify" $status $expcode $res $PASS
155
156
157 # --------------------------------------------------------------
158 # disconnect and exit
159 Disconnect
160 exit $PASS