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 SAVEFH operation test - positive tests
27
28 # include all test enironment
29 source SAVEFH.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 Savefh with CFH retains its value, expect OK
41 set expcode "OK"
42 set ASSERTION "basic Savefh with CFH retains its value, expect $expcode"
43 putmsg stdout 0 "$TNAME{a}: $ASSERTION"
44 set res [compound {Putfh $bfh; Savefh; Getfh}]
45 set cont [ckres "Savefh" $status $expcode $res $FAIL]
46 # verify filehandle remains the same
47 set nfh [lindex [lindex $res 2] 2]
48 fh_equal $bfh $nfh $cont $PASS
49
50
51 # b: Savefh more than Once, expect OK
52 set expcode "OK"
53 set ASSERTION "Savefh more than Once, expect $expcode"
54 putmsg stdout 0 "$TNAME{b}: $ASSERTION"
55 set res [compound {Putfh $bfh; Savefh; Lookup $env(DIR0711); Getfh;
56 Savefh; Putfh $bfh; Restorefh; Getfh}]
57 set cont [ckres "Savefh" $status $expcode $res $FAIL]
58 # verify filehandle returned was the saved FH
59 set sfh [lindex [lindex $res 3] 2]
60 set nfh [lindex [lindex $res 7] 2]
61 fh_equal $sfh $nfh $cont $PASS
62
63
64 # c: Savefh of ROOT-FH, expect OK
65 set expcode "OK"
66 set ASSERTION "Savefh of root-FH, expect $expcode"
67 putmsg stdout 0 "$TNAME{c}: $ASSERTION"
68 set tdir "$BASEDIRS $env(DIR0711)"
69 set tdir "$BASEDIRS $env(DIR0711)"
70 set res [compound {Putrootfh; Getfh; Savefh; foreach c $tdir {Lookup $c};
71 Restorefh; Getfh; foreach c $tdir {Lookup $c}}]
72 set cont [ckres "Savefh" $status $expcode $res $FAIL]
73 # verify filehandle restored was the saved FH
74 set sfh [lindex [lindex $res 1] 2]
75 set nfh [lindex [lindex $res [expr [llength $tdir] + 4]] 2]
76 fh_equal $sfh $nfh $cont $PASS
77
78
79 # --------------------------------------------------------------
80 # disconnect and exit
81 Disconnect
82 exit $PASS