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 OPEN operation test - more of negative tests
27
28 # include all test enironment
29 source OPEN.env
30
31 # connect to the test server
32 Connect
33
34 # setting local variables
35 set TNAME $argv0
36 set bfh [get_fh "$BASEDIRS"]
37 set cid [getclientid $TNAME.[pid]]
38 if {$cid == -1} {
39 putmsg stdout 0 "$TNAME: test setup - getclientid"
40 putmsg stderr 0 "\t Test UNRESOLVED: unable to get clientid"
41 exit $UNRESOLVED
42 }
43 set seqid 1
44 set owner "$TNAME-OpenOwner"
45
46
47
48 # Start testing
49 # --------------------------------------------------------------
50 # a: Open(NOCREATE) with 'name' not exist, expect NOENT
51 set expcode "NOENT"
52 set ASSERTION "Open(NOCREATE) with 'name' not exist, expect $expcode"
53 set tag "$TNAME{a}"
54 putmsg stdout 0 "$tag: $ASSERTION"
55 set res [compound {Putfh $bfh; Open $seqid 3 0 "$cid $owner-a" \
56 {0 0 {{mode 0644}}} {0 "NOENT.[pid]"}; Getfh}]
57 ckres "Open" $status $expcode $res $PASS
58
59
60 # b: Open(NOCREATE) w/'name' not in namespace (Solaris only), expect NOENT
61 set expcode "NOENT"
62 set ASSERTION "Open(NOCREATE) w/name(/usr) not in namespace, expect $expcode"
63 set tag "$TNAME{b}"
64 putmsg stdout 0 "$tag: $ASSERTION"
65 set res [compound {Putrootfh; Open $seqid 3 0 "$cid $owner-b" \
66 {0 0 {{mode 0644}}} {0 "usr"}; Getfh}]
67 ckres "Open" $status $expcode $res $PASS
68
69
70 # c: Open(NOCREATE) w/name exists & is a dir, expect ISDIR
71 set expcode "ISDIR"
72 set ASSERTION "Open(NOCREATE) w/name exists & is a dir, expect $expcode"
73 set tag "$TNAME{c}"
74 putmsg stdout 0 "$tag: $ASSERTION"
75 set res [compound {Putfh $bfh; Open $seqid 3 0 "$cid $owner-c" \
76 {0 0 {{mode 0644}}} {0 "$env(DIR0777)"}; Getfh}]
77 ckres "Open" $status $expcode $res $PASS
78
79
80 # d: Open(NOCREATE) with CFH is a file, expect NOTDIR
81 set expcode "NOTDIR"
82 set ASSERTION "Open(NOCREATE) with CFH is a file, expect $expcode"
83 set tag "$TNAME{b}"
84 putmsg stdout 0 "$tag: $ASSERTION"
85 set res [compound {Putfh $bfh; Lookup "$env(RWFILE)";
86 Open $seqid 3 0 "$cid $owner-d" {0 0 {{mode 0644}}} {0 "XXX"}; Getfh}]
87 ckres "Open" $status $expcode $res $PASS
88
89
90 # e: Open(CREATE) with CFH as a fifo, expect NOTDIR
91 set expcode "NOTDIR"
92 set ASSERTION "Open(CREATE) with CFH as a fifo, expect $expcode"
93 set tag "$TNAME{e}"
94 putmsg stdout 0 "$tag: $ASSERTION"
95 set res [compound {Putfh $bfh; Lookup "$env(FIFOFILE)";
96 Open $seqid 3 0 "$cid $owner-e" {1 0 {{mode 0644}}} {0 "XXX"}; Getfh}]
97 ckres "Open" $status $expcode $res $PASS
98
99
100 # h: Open(CREATE) with filename too long, expect NAMETOOLONG
101 set expcode "NAMETOOLONG"
102 set ASSERTION "Open(CREATE) with filename too long, expect $expcode"
103 set tag "$TNAME{h}"
104 putmsg stdout 0 "$tag: $ASSERTION"
105 set nli [set_maxname $bfh]
106 set res [compound {Putfh $bfh;
107 Open $seqid 3 0 "$cid $owner-h" {1 0 {{mode 0644}}} {0 "$nli"}; Getfh}]
108 ckres "Open" $status $expcode $res $PASS
109
110
111 # i: Open(CREATE/UNCHECKED) w/name exists and is a dir, expect ISDIR
112 set expcode "ISDIR"
113 set ASSERTION "Open(CREATE/UNCHECKED) w/name exists & is a dir, expect $expcode"
114 set tag "$TNAME{i}"
115 putmsg stdout 0 "$tag: $ASSERTION"
116 set res [compound {Putfh $bfh; Open $seqid 3 0 "$cid $owner-i" \
117 {1 0 {{mode 0644}}} {0 "$env(DIR0777)"}; Getfh}]
118 ckres "Open" $status $expcode $res $PASS
119
120
121 # j: Open(CREATE/UNCHECK) w/name exists & is a fifo, expect INVAL
122 set expcode "INVAL"
123 set ASSERTION "Open(CREATE/UNCHECKED) w/name exists & is fifo, expect $expcode"
124 set tag "$TNAME{j}"
125 putmsg stdout 0 "$tag: $ASSERTION"
126 set res [compound {Putfh $bfh; Open $seqid 3 0 "$cid $owner-j" \
127 {1 0 {{mode 0644}}} {0 "$env(FIFOFILE)"}; Getfh}]
128 ckres "Open" $status $expcode $res $PASS
129
130
131 # k: Open(CREATE/GUARDED) w/name exists & is a file, expect EXIST
132 set expcode "EXIST"
133 set ASSERTION "Open(CREATE/GUARDED) w/name exists & is a file, expect $expcode"
134 set tag "$TNAME{k}"
135 putmsg stdout 0 "$tag: $ASSERTION"
136 set res [compound {Putfh $bfh; Open $seqid 3 0 "$cid $owner-k" \
137 {1 1 {{mode 0644}}} {0 "$env(RWFILE)"}; Getfh}]
138 ckres "Open" $status $expcode $res $PASS
139
140
141
142 # l: Open(CREATE/EXCLUSIVE) w/name exists & is a file, expect EXIST
143 set expcode "EXIST"
144 set ASSERTION "Open(CREATE/EXCLUSIVE) w/name exists & is file, expect $expcode"
145 set tag "$TNAME{l}"
146 putmsg stdout 0 "$tag: $ASSERTION"
147 set createverf "0011[pid]"
148 set res [compound {Putfh $bfh; Open $seqid 3 0 "$cid $owner-l" \
149 {1 2 $createverf} {0 "$env(ROFILE)"}; Getfh}]
150 ckres "Open" $status $expcode $res $PASS
151
152
153 # s: Open(NOCREATE) with name is a symlink, expect SYMLINK
154 set expcode "SYMLINK"
155 set ASSERTION "Open(NOCREATE) w/name is a symlink, expect $expcode"
156 set tag "$TNAME{s}"
157 putmsg stdout 0 "$tag: $ASSERTION"
158 set res [compound {Putfh $bfh; Open $seqid 3 0 "$cid $owner-s" \
159 {0 0 {{mode 0644}}} {0 "$env(SYMLFILE)"}; Getfh}]
160 ckres "Open" $status $expcode $res $PASS
161
162
163 # --------------------------------------------------------------
164 # disconnect and exit
165 Disconnect
166 exit $PASS