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 named attributes:
27 #
28 # a: Test Getattr returns a fh type NF4NAMEDATTR of file in attrdir directory,
29 # expect OK
30 # b: Test Getattr returns a fh type NF4ATTRDIR for attrdir, expect OK
31 #
32
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 # connect to the test server
41 Connect
42
43 # setting local variables
44 set TNAME $argv0
45 set bfh [get_fh "$BASEDIRS"]
46 set expcode "OK"
47
48 # Start testing
49 # ------------------------------------------------------------------------
50 # a: Test Getattr returns a fh type NF4NAMEDATTR of file attrdir directory, expect OK
51
52 set ASSERTION "Test Getattr returns a fh type NF4NAMEDATTR for file w/named attrs, expect OK"
53 putmsg stdout 0 "$TNAME{a}: $ASSERTION"
54
55 # Check for NF4NAMEDATTR filehandle type
56 set attr {type}
57
58 # Do the lookup on the attrdir file
59 set res [compound { Putfh $bfh; Lookup $env(ATTRDIR); Openattr f; Lookup $env(ATTRDIR_AT1); Getattr $attr}]
60 set cont [ckres "Getattr" $status $expcode $res $FAIL]
61
62 if { ![string equal $cont "false"] } {
63
64 set attrcomp [ extract_attr [lindex [lindex $res 4] 2] "type" ]
65 # Verify filehandle type expected
66 set expval "namedattr"
67 #Get the filehandle of the test file
68
69 if { [string equal $expval $attrcomp] } {
70 putmsg stdout 1 "res=<$res>"
71 putmsg stdout 0 "\t Test PASS"
72 } else {
73 prn_attrs [lindex [lindex $res 4] 2]
74 putmsg stderr 0 "\t Test FAIL: bad expected filehandle type, $expval"
75 }
76
77 }
78
79 # ----------------------------------------------------------------------
80 # b: Test Getattr returns a fh type NF4ATTRDIR for attrdir, expect OK
81
82 set ASSERTION "Test Getattr returns a fh type NF4ATTRDIR for attrdir, expect OK"
83 putmsg stdout 0 "$TNAME{b}: $ASSERTION"
84
85 # Check for NF4NAMEDATTR filehandle type
86 set attr {type}
87
88 # Do the lookup on the attrdir file
89 set res [compound { Putfh $bfh; Lookup $env(ATTRDIR); Openattr f; Getattr $attr}]
90 set cont [ckres "Getattr" $status $expcode $res $FAIL]
91
92 if { ![string equal $cont "false"] } {
93
94 # Verify filehandle type expected
95 set attrcomp [ extract_attr [lindex [lindex $res 3] 2] "type" ]
96 set expval "attrdir"
97
98 if { [string equal $expval $attrcomp] } {
99 putmsg stdout 1 "res=<$res>"
100 putmsg stdout 0 "\t Test PASS"
101 } else {
102 prn_attrs [lindex [lindex $res 3] 2]
103 putmsg stderr 0 "\t Test FAIL: bad expected filehandle type, $expval"
104 }
105
106 }
107
108
109 Disconnect
110 exit 0