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 GETATTR operation test - negative tests
27 # verify SERVER errors returned with invalid Getattr.
28
29 # include all test enironment
30 source GETATTR.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: Getattr without Putrootfh, expect NOFILEHANDLE
42 set expcode "NOFILEHANDLE"
43 set ASSERTION "Getattr without Putrootfh, expect $expcode"
44 putmsg stdout 0 "$TNAME{a}: $ASSERTION"
45 set res [compound {Getattr type}]
46 ckres "Getattr" $status $expcode $res $PASS
47
48
49 # b: try to Getattr while the obj is removed, expect STALE
50 set expcode "STALE"
51 set ASSERTION "try to Getattr while obj is removed, expect $expcode"
52 #putmsg stdout 0 "$TNAME{b}: $ASSERTION"
53 #set tmpd "tmp.[pid]"
54 #set res [compound {Putfh $bfh; Create $tmpd {{mode 0777}} d; Getfh}]
55 #set tfh [lindex [lindex $res 2] 2]
56 #check_op "Putfh $bfh; Remove $tmpd" "OK" "UNINITIATED"
57 #set res [compound {Putfh $tfh; Getattr cansettime; Getfh}]
58 #ckres "Getattr" $status $expcode $res $PASS
59 #puts "\t Test UNTESTED: XXX need support/hooks to remove <cfh> on SERVER\n"
60
61
62 # c: Getattr when no access permission to file, expect ACCESS
63 set expcode "ACCESS"
64 set ASSERTION "Getattr when no access permission to file, expect $expcode"
65 #putmsg stdout 0 "$TNAME{c}: $ASSERTION"
66 #puts "\t Test UNTESTED: XXX need hooks in server to change obj after Putfh\n"
67
68
69 # d: Getattr from a bad-FH, expect BADHANDLE
70 set expcode "BADHANDLE"
71 set ASSERTION "Getattr from a bad-FH, expect $expcode"
72 #putmsg stdout 0 "$TNAME{d}: $ASSERTION"
73 #set res [compound {Putrootfh; Lookup "__badfh"; Getattr type}]
74 #ckres "Getattr" $status $expcode $res $PASS
75 #puts "\t Test UNTESTED: XXX need nfsv4shell & server support on BADFH\n"
76
77
78 # h: Getattr with WrongSec, expect WRONGSEC
79 # XXX Need more set with w/Security
80 set expcode "WRONGSEC"
81 set ASSERTION "Getattr with WrongSec, expect $expcode"
82 #putmsg stdout 0 "$TNAME{h}: $ASSERTION"
83 #puts "\t Test UNTESTED: XXX need more on Sec support\n"
84
85
86 # i: XXX how do we simulate some server errors:
87 # NFS4ERR_IO
88 # NFS4ERR_MOVE
89 # NFS4ERR_SERVERFAULT
90 # NFS4ERR_RESOURCE
91
92
93 # m: try to Getattr of expired FH, expect FHEXPIRED
94 set expcode "FHEXPIRED"
95 set ASSERTION "Getattr an expired FH, expect $expcode"
96 #putmsg stdout 0 "$TNAME{m}: $ASSERTION"
97 #puts "\t Test UNTESTED: XXX need hook for FH to expire\n"
98
99
100 # n: try to Getattr with invalid bit set, expect INVAL
101 # XXX need nfsv4shell to set invalid bits?
102 set expcode "INVAL"
103 set ASSERTION "Getattr with invalid bits set, expect $expcode"
104 #putmsg stdout 0 "$TNAME{n}: $ASSERTION"
105 #puts "\t Test UNTESTED: XXX need nfsv4shell to set invalid bits?\n"
106
107
108 # o: try to Getattr with <cfh> delay'ed, expect DELAY
109 set expcode "DELAY"
110 set ASSERTION "Getattr with , expect $expcode"
111 #putmsg stdout 0 "$TNAME{o}: $ASSERTION"
112 #puts "\t Test UNTESTED: XXX need server support on this?\n"
113
114
115 # --------------------------------------------------------------
116 # disconnect and exit
117 Disconnect
118 exit $PASS