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 - positive 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: basic lookup of a regular file, expect OK
41 set expcode "OK"
42 set ASSERTION "basic Lookup of a regular file, expect $expcode"
43 putmsg stdout 0 "$TNAME{a}: $ASSERTION"
44 set res [compound {Putfh $bfh; Lookup "$env(TEXTFILE)"; Getfh}]
45 set cont [ckres "Lookup" $status $expcode $res $FAIL]
46 # Now verify - filehandle from LOOKUP should be good
47 verf_fh [lindex [lindex $res 2] 2] $cont $PASS
48
49
50 # b: lookup a non-regular file from putfh, expect OK
51 set expcode "OK"
52 set tpath "$env(SYMLDIR)"
53 set ASSERTION "Lookup a non-regular file from putfh, expect $expcode"
54 putmsg stdout 0 "$TNAME{b}: $ASSERTION"
55 set res [compound {Putfh $bfh; Lookup $env(SYMLDIR); Getfh}]
56 set cont [ckres "Lookup" $status $expcode $res $FAIL]
57 # Now verify - filehandle from LOOKUP should be good
58 verf_fh [lindex [lindex $res 2] 2] $cont $PASS
59
60
61 # c: multiple lookups for a long dir, export OK
62 set expcode "OK"
63 set ASSERTION "multiple lookups for a long dir, expect $expcode"
64 putmsg stdout 0 "$TNAME{c}: $ASSERTION"
65 set LONGDIRS [path2comp $env(LONGDIR) $DELM]
66 set res [compound {Putfh $bfh; foreach c $LONGDIRS {Lookup $c}; Getfh}]
67 ckres "Lookup" $status $expcode $res $FAIL
68 # Now verify filehandle returned is good
69 verf_fh [lindex [lindex $res end] 2] $cont $PASS
70
71
72 # d: Lookup same dir after lookupp, expect OK
73 set expcode "OK"
74 set ASSERTION "Lookup same dir after lookupp, expect $expcode"
75 putmsg stdout 0 "$TNAME{d}: $ASSERTION"
76 set d1 $env(DIR0777)
77 set res [compound {Putfh $bfh; Lookup $d1; Lookupp; Lookup $d1; Lookupp; Getfh}]
78 set cont [ckres "Lookup" $status $expcode $res $FAIL]
79 set nfh [lindex [lindex $res 5] 2]
80 # the filehandle returned should be same as the FH for $BASEDIRS
81 fh_equal $bfh $nfh $cont $PASS
82
83
84 # --------------------------------------------------------------
85 # disconnect and exit
86 Disconnect
87 exit $PASS