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 # Test NFSv4 numbered attributes:
27 #
28 # {a}:Test get attr FATTR4_UNIQUE HANDLES of a file object, expect OK
29 # {b}:Test get attr FATTR4_UNIQUE HANDLES of a dir object, expect OK
30 #
31
32 # Get the TESTROOT directory; set to '.' if not defined
33 set TESTROOT $env(TESTROOT)
34 set delm $env(DELM)
35
36 # include common code and init section
37 source ${TESTROOT}${delm}tcl.init
38 source ${TESTROOT}${delm}testproc
39
40 #
41 # connect to the test server
42 Connect
43
44 # setting local variables
45 set TNAME $argv0
46 set tag $TNAME{setup}
47 set bfh [get_fh "$BASEDIRS"]
48 set expcode "OK"
49
50 # Start testing
51 # -----------------------------------------------------------------
52 # a:Test get attr FATTR4_UNIQUE_HANDLES of a file object, expect OK
53
54 # Generate a compound request that
55 # obtains the attributes for the path.
56
57 set ASSERTION \
58 "Test get attr FATTR4_UNIQUE_HANDLES of a file object, expect $expcode"
59 set tag $TNAME{a}
60 putmsg stdout 0 "$tag: $ASSERTION"
61
62 # Hard coded expected value to be returned from the server
63 set expval "false"
64
65 set attrs {unique_handles}
66 set res [compound { Putfh $bfh; Lookup $env(EXECFILE); Getfh; Getattr $attrs }]
67 set cont [ckres "Getattr" $status $expcode $res $FAIL]
68
69 if {[string equal $cont "true"] == 1} {
70 set attrval [ extract_attr [lindex [lindex $res 3] 2] "unique_handles" ]
71 if { [string compare $attrval $expval] == 0 } {
72 prn_attrs [lindex [lindex $res 3] 2]
73 putmsg stdout 0 "\t Test PASS"
74 } else {
75 putmsg stderr 1 "unique_handles = $attrval"
76 putmsg stderr 1 "res=($res)"
77 putmsg stderr 0 "\t Test FAIL"
78 }
79 }
80
81
82 puts ""
83
84 Disconnect
85 exit $PASS