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 VERIFY operation test - positive tests
27 # verify verify with supported_attrs
28
29 # include all test enironment
30 source VERIFY.env
31
32 # connect to the test server
33 Connect
34
35 # setting local variables
36 set TNAME $argv0
37 set bfh [get_fh "$BASEDIRS"]
38 set req_attrs "type fh_expire_type change size link_support
39 symlink_support named_attr fsid unique_handles lease_time"
40
41 # Start testing
42 # --------------------------------------------------------------
43 # a: Verify of a file w/its FH, expect OK
44 set expcode "OK"
45 set ASSERTION "Verify of a file w/its FH, expect $expcode"
46 set tag "$TNAME{a}"
47 putmsg stdout 0 "$tag: $ASSERTION"
48 set res [compound {Putfh $bfh; Lookup $env(RWFILE); Getfh;
49 Verify {{type reg}}}]
50 set cont [ckres "Verify" $status $expcode $res $FAIL]
51 # try FH again:
52 set fh1 [lindex [lindex $res 2] 2]
53 set res [compound {Putfh $fh1; Verify {{filehandle "$fh1"}}; Getfh}]
54 set cont [ckres "Verify" $status $expcode $res $FAIL]
55 # verify FH is not changed after successful Verify op
56 set fh2 [lindex [lindex $res 2] 2]
57 fh_equal $fh1 $fh2 $cont $PASS
58
59
60 # b: Verify a file w/list of attrs, all same from Getattr, expect OK
61 set expcode "OK"
62 set ASSERTION "Verify a file w/same attr list from Getattr, expect $expcode"
63 set tag "$TNAME{b}"
64 putmsg stdout 0 "$tag: $ASSERTION"
65 set res [compound {Putfh $bfh; Lookup $env(ROFILE); Getattr "$req_attrs"}]
66 set cont [ckres "Getattr" $status $expcode $res $FAIL]
67 # Verify all attr returned from Getattr
68 if {! [string equal $cont "false"]} {
69 set attrl [lindex [lindex $res 2] 2]
70 set res [compound {Putfh $bfh; Lookup $env(ROFILE); Getfh;
71 Verify {$attrl}; Getfh}]
72 set cont [ckres "Verify" $status $expcode $res $FAIL]
73 }
74 # verify FH is not changed after successful Getattr op
75 set fh1 [lindex [lindex $res 2] 2]
76 set fh2 [lindex [lindex $res 4] 2]
77 fh_equal $fh1 $fh2 $cont $PASS
78
79
80 # c: Verify a dir w/list of attrs, all same from Getattr, expect OK
81 set expcode "OK"
82 set ASSERTION "Verify a dir w/same attr list from Getattr, expect $expcode"
83 set tag "$TNAME{c}"
84 putmsg stdout 0 "$tag: $ASSERTION"
85 set mylist "type symlink_support lease_time filehandle mode owner time_access time_modify"
86 set res [compound {Putfh $bfh; Lookup $env(DIR0777); Getattr "$mylist"}]
87 set cont [ckres "Getattr" $status $expcode $res $FAIL]
88 # Verify all attr returned from Getattr
89 if {! [string equal $cont "false"]} {
90 set attrl [lindex [lindex $res 2] 2]
91 set res [compound {Putfh $bfh; Lookup $env(DIR0777); Getfh;
92 Verify {$attrl}; Getfh}]
93 set cont [ckres "Verify" $status $expcode $res $FAIL]
94 }
95 # verify FH is not changed after successful Getattr op
96 set fh1 [lindex [lindex $res 2] 2]
97 set fh2 [lindex [lindex $res 4] 2]
98 fh_equal $fh1 $fh2 $cont $PASS
99
100
101 # --------------------------------------------------------------
102 # disconnect and exit
103 Disconnect
104 exit $PASS