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 LOOKUP operation test - negative tests
27
28 # include all test enironment
29 source LOOKUP.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
38 # Start testing
39 # --------------------------------------------------------------
40 # a: Lookup without Putrootfh, expect NOFILEHANDLE
41 set expcode "NOFILEHANDLE"
42 set ASSERTION "Lookup without Putrootfh, expect $expcode"
43 putmsg stdout 0 "$TNAME{a}: $ASSERTION"
44 set res [compound {Lookup $env(TEXTFILE)}]
45 ckres "Lookup" $status $expcode $res $PASS
46
47
48 # b: Lookup an obj under dir_noperm, expect ACCESS
49 set expcode "ACCESS"
50 set ASSERTION "Lookup an obj under dir_noperm, expect $expcode"
51 putmsg stdout 0 "$TNAME{b}: $ASSERTION"
52 set res [compound {Putfh $bfh; Lookup $env(DNOPERM);
53 Lookup $env(RWFILE); Getfh}]
54 ckres "Lookup" $status $expcode $res $PASS
55
56
57 # c: Lookup an obj under symlink dir, expect SYMLINK
58 set expcode "SYMLINK"
59 set ASSERTION "Lookup an obj under symlink dir, expect $expcode"
60 putmsg stdout 0 "$TNAME{c}: $ASSERTION"
61 set res [compound {Putfh $bfh; Lookup "$env(SYMLDIR)";
62 Lookup rwfile; Getfh}]
63 ckres "Lookup" $status $expcode $res $PASS
64
65
66 # d: Lookup '.', expect INVAL|NOENT
67 set expcode "INVAL|NOENT"
68 set ASSERTION "Lookup '.', expect $expcode"
69 putmsg stdout 0 "$TNAME{d}: $ASSERTION"
70 set res [compound {Putfh $bfh; Lookup "."; Getfh}]
71 ckres "Lookup" $status $expcode $res $PASS
72
73
74 # e: Lookup '..', expect INVAL|NOENT
75 set expcode "INVAL|NOENT"
76 set ASSERTION "Lookup '..', expect $expcode"
77 putmsg stdout 0 "$TNAME{e}: $ASSERTION"
78 set res [compound {Putfh $bfh; Lookup "$env(DIR0777)";
79 Lookup ".."; Getfh}]
80 ckres "Lookup" $status $expcode $res $PASS
81
82
83 # g: Lookup with path delimiter in name, expect INVAL|NOENT
84 set expcode "INVAL|NOENT"
85 set ASSERTION "Lookup with path delimiter in name, expect $expcode"
86 putmsg stdout 0 "$TNAME{g}: $ASSERTION"
87 set res [compound {Putfh $bfh; Lookup "XX${DELM}xx"; Getfh}]
88 ckres "Lookup" $status $expcode $res $PASS
89
90
91 # h: Lookup with zero length component, expect INVAL
92 set expcode "INVAL"
93 set ASSERTION "Lookup with zero length component, expect $expcode"
94 putmsg stdout 0 "$TNAME{h}: $ASSERTION"
95 set res [compound {Putfh $bfh; Lookup ""; Getfh}]
96 ckres "Lookup" $status $expcode $res $PASS
97
98
99 # m: try to Lookup while dir is removed, expect STALE
100 set expcode "STALE"
101 set ASSERTION "try to Lookup while dir is removed, expect $expcode"
102 #putmsg stdout 0 "$TNAME{m}: $ASSERTION"
103 #set tmpd "tmp.[pid]"
104 #set res [compound {Putfh $bfh; Create $tmpd {{mode 0777}} d;
105 # Getfh; Create "Nfifo" {{mode 0666}} f}]
106 #set tfh [lindex [lindex $res 2] 2]
107 #check_op "Putfh $tfh; Remove Nfifo; Lookupp; Remove $tmpd" "OK" "UNINITIATED"
108 #set res [compound {Putfh $tfh; Lookup "Nfifo"; Getfh}]
109 #ckres "Lookup" $status $expcode $res $PASS
110 #puts "\t Test UNTESTED: XXX need a better way to remove files (in server?)\n"
111
112
113 # --------------------------------------------------------------
114 # disconnect and exit
115 Disconnect
116 exit $PASS