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 GETFH operation test - negative tests
27
28 # include all test enironment
29 source GETFH.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: Getfh without Putrootfh, expect NOFILEHANDLE
41 set expcode "NOFILEHANDLE"
42 set ASSERTION "Getfh without Putrootfh, expect $expcode"
43 putmsg stdout 0 "$TNAME{a}: $ASSERTION"
44 set res [compound {Getfh}]
45 ckres "Getfh" $status $expcode $res $PASS
46
47
48 # b: try to Getfh while file is removed, expect STALE
49 set expcode "STALE"
50 set ASSERTION "try to Getfh while file is removed, expect $expcode"
51 #putmsg stdout 0 "$TNAME{b}: $ASSERTION"
52 #set tmpd "tmp.[pid]"
53 #set res [compound {Putfh $bfh; Create $tmpd {{mode 0777}} d; Getfh}]
54 #set tfh [lindex [lindex $res 3] 2]
55 #check_op "Putrootfh; Lookup \"$BASEDIRS\"; Remove $tmpd" "OK" "UNINITIATED"
56 #set res [compound {Putfh $tfh; Create $tobj f; Getfh}]
57 #ckres "Getfh" $status $expcode $res $PASS
58 #puts "\t Test UNTESTED: XXX need a better way to remove files (in server?)\n"
59
60
61 # h: getfh with WrongSec, expect WRONGSEC
62 # Need more set with w/Security
63 set expcode "WRONGSEC"
64 set ASSERTION "Getfh with wrongsec, expect $expcode"
65 #putmsg stdout 0 "$TNAME{h}: $ASSERTION"
66 #puts "\t Test UNTESTED: XXX need hooks to change SEC of <cfh> in server.\n"
67
68
69 # i: XXX how do we simulate some server errors:
70 # NFS4ERR_MOVE
71 # NFS4ERR_SERVERFAULT
72 # NFS4ERR_RESOURCE
73
74
75 # m: try to getfh of expired FH, expect FHEXPIRED
76 set expcode "FHEXPIRED"
77 set ASSERTION "Getfh an expired FH, expect $expcode"
78 #putmsg stdout 0 "$TNAME{m}: $ASSERTION"
79 #puts "\t Test UNTESTED: XXX need migration support.\n"
80
81
82 # --------------------------------------------------------------
83 # disconnect and exit
84 Disconnect
85 exit $PASS