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 2007 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26 # NFSv4 OPENATTR operation test - negative tests
27 # verify SERVER errors returned under error conditions
28
29 # include all test enironment
30 source OPENATTR.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
40 # Start testing
41 # --------------------------------------------------------------
42 # a: Openattr create at ROFS w/no named_attr dir setup - expect ROFS
43 set expcode "ROFS"
44 set ASSERTION "Openattr create at ROFS w/no attrdir setup, expect $expcode"
45 set tag "$TNAME{a}"
46 putmsg stdout 0 "$tag: $ASSERTION"
47 set rfh [get_fh [path2comp $env(ROFSDIR) $DELM]]
48 if {$rfh == ""} {
49 putmsg stdout 0 "\t Test NOTINUSE: ROFSDIR is not setup in server."
50 } else {
51 if { "$env(SRVOS)" == "Solaris" } {
52 putmsg stdout 0 \
53 "\t Test UNSUPPORTED: Solaris server creates ext-attr/dir by default"
54 } else {
55 set res [compound {Putfh $rfh; Lookup $env(RWFILE); Openattr T}]
56 ckres "Openattr" $status $expcode $res $PASS
57 }
58 }
59
60
61 # b: Openattr(T) at pseudo node w/no named_attr dir setup - expect ACCESS
62 set expcode "ACCESS"
63 set ASSERTION "Openattr(T) at pseudo node w/no attrdir setup, expect $expcode"
64 set tag "$TNAME{b}"
65 putmsg stdout 0 "$tag: $ASSERTION"
66 if { "$env(SRVOS)" == "Solaris" } {
67 putmsg stdout 0 \
68 "\t Test UNSUPPORTED: Solaris server creates ext-attr/dir by default"
69 } else {
70 set Tpath [path2comp $env(SSPCDIR2) $DELM]
71 set res [compound {Putrootfh; foreach c $Tpath {Lookup $c};
72 Lookupp; Openattr T}]
73 ckres "Openattr" $status $expcode $res $PASS
74 }
75
76 # c: OPENATTR create on a FS with no more inode, expect NOSPC
77 set expcode "NOSPC"
78 set ASSERTION "OPENATTR create on a FS with no more inode, expect $expcode"
79 set tag "$TNAME{c}"
80 putmsg stdout 0 "$tag: $ASSERTION"
81 if { "$env(SRVOS)" == "Solaris" } {
82 putmsg stdout 0 \
83 "\t Test UNSUPPORTED: Solaris server creates ext-attr/dir by default"
84 } else {
85 set rfh [get_fh [path2comp $env(NSPCDIR) $DELM]]
86 if {$rfh == ""} {
87 putmsg stdout 0 "\t Test NOTINUSE: NSPCDIR is not setup in server."
88 } else {
89 set res [compound {Putfh $rfh; Lookup $env(RWFILE); Openattr T}]
90 ckres "Openattr" $status $expcode $res $PASS
91 }
92 }
93
94 # d: OPENATTR create on a FS with no more quota, expect DQUOT
95 set expcode "DQUOT"
96 set ASSERTION "OPENATTR create on a FS with no more quota, expect $expcode"
97 set tag "$TNAME{d}"
98 putmsg stdout 0 "$tag: $ASSERTION"
99 # add check of quota setup for Solaris:
100 if { "$env(SRVOS)" == "Solaris" } {
101 putmsg stdout 0 \
102 "\t Test UNSUPPORTED: Solaris server creates ext-attr/dir by default"
103 } else {
104 set qpath [path2comp $env(QUOTADIR) $DELM]
105 set res [compound {Putrootfh; foreach c $qpath {Lookup $c};
106 Getfh; Lookup "quotas"}]
107 set qfh [lindex [lindex $res end-1] 2]
108 if {[is_cipso $env(SERVER)]} {
109 set RWFILE $env(RWFILE)
110 set res [exec zlogin $env(ZONENAME) \
111 "su $env(TUSER2) -c \"qfh=$qfh; RWFILE=$RWFILE; \
112 export qfh RWFILE; /nfsh /$TNAME\""]
113 set status [lindex $res 0]
114 } else {
115 set res [compound {Putfh $qfh; Lookup $env(RWFILE); Openattr T}]
116 }
117 ckres "Openattr" $status $expcode $res $PASS
118 }
119
120 # i: OPENATTR(T) w/<cfh> is type of attrdir, expect OK|NOTSUPP
121 set expcode "OK|NOTSUPP"
122 set ASSERTION "OPENATTR(T) w/<cfh> is type of attrdir, expect $expcode"
123 set tag "$TNAME{i}"
124 putmsg stdout 0 "$tag: $ASSERTION"
125 # First get the attrdir filehandle:
126 set res [compound {Putfh $bfh; Lookup $env(ATTRDIR); Openattr F; Getfh}]
127 if { [ckres "1st Openattr" $status "OK" $res $FAIL] == "true" } {
128 # now try nested Openattr:
129 set nfh [lindex [lindex $res 3] 2]
130 set res [compound {Putfh $nfh; Openattr T}]
131 ckres "Openattr" $status $expcode $res $PASS
132 }
133
134 # j: OPENATTR(F) w/<cfh> is type of namedattr, expect OK|NOTSUPP
135 set expcode "OK|NOTSUPP"
136 set ASSERTION "OPENATTR(F) w/<cfh> is type of namedattr, expect $expcode"
137 set tag "$TNAME{j}"
138 putmsg stdout 0 "$tag: $ASSERTION"
139 # First get the attrdir filehandle:
140 set res [compound {Putfh $bfh; Lookup $env(ATTRDIR); Openattr F; Getfh}]
141 if { [ckres "1st Openattr" $status "OK" $res $FAIL] == "true" } {
142 # now try nested Openattr:
143 set nfh [lindex [lindex $res 3] 2]
144 set res [compound {Putfh $nfh; Lookup $env(ATTRDIR_AT1); Openattr F}]
145 ckres "Openattr" $status $expcode $res $PASS
146 }
147
148
149 # --------------------------------------------------------------
150 # disconnect and exit
151 Disconnect
152 exit $PASS