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 OPEN with named attributes, negative tests
27
28 # include all test enironment
29 # TESTROOT directory; must be set in the environment already
30 set TESTROOT $env(TESTROOT)
31
32 # include common code and init environment
33 source [file join ${TESTROOT} tcl.init]
34 source [file join ${TESTROOT} testproc]
35
36 # connect to the test server
37 Connect
38
39 # setting local variables
40 set TNAME $argv0
41 set bfh [get_fh "$BASEDIRS"]
42
43 # now set/confirm the clientid
44 set cid [getclientid $TNAME.[pid]]
45 if {$cid == -1} {
46 putmsg stderr 0 "Test UNRESOLVED: unable to get clientid"
47 exit $UNRESOLVED
48 }
49 set oseqid 1
50 set oowner $TNAME-oowner
51
52
53 # Start testing
54 # --------------------------------------------------------------
55 # a: Open(CREATE/Exclusiv) w/<cfh> is named_attr, expect INVAL
56 set expcode "INVAL"
57 set ASSERTION "Open(CREATE/Exclusiv) w/<cfh> is named_attr, expect $expcode"
58 putmsg stdout 0 "$TNAME{a}: $ASSERTION"
59 set res [compound {Putfh $bfh; Lookup $env(ATTRDIR); Openattr f; Getfh}]
60 if { [ckres "Openattr" $status "OK" $res $FAIL] == "true" } {
61 # get the named_attr filehandle, and tried to OPEN create/exclusive
62 set nfh [lindex [lindex $res 3] 2]
63 set createverf "$cid-a"
64 set fname $TNAME-a.[pid]
65 set res [compound {Putfh $nfh;
66 Open $oseqid 3 0 "$cid $oowner-a" \
67 {1 2 {$createverf}} {0 $fname}; Getfh}]
68 if { [ckres "Open" $status $expcode $res $FAIL] == "true" } {
69 # make sure file is not created due to error
70 set res [compound {Putfh $nfh; Lookup $fname}]
71 if {$status != "NOENT"} {
72 putmsg stderr 0 \
73 "\t Test FAIL: OPEN failed, but ($fname) created?"
74 putmsg stderr 1 "\t res=($res)"
75 } else {
76 logres PASS
77 }
78 }
79 }
80
81
82 # --------------------------------------------------------------
83 # disconnect and exit
84 Disconnect
85 exit $PASS