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 OPENATTR operation test - negative tests
27 # verify SERVER errors returned under error conditions
28
29 # include all test enironment
30 source OPENATTR.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
39
40 # Start testing
41 # --------------------------------------------------------------
42 # a: Try to create dir under attrdir - expect INVAL|OK
43 set expcode "INVAL|OK"
44 set ASSERTION "Try to create dir under attrdir, expect $expcode"
45 set tag "$TNAME{a}"
46 putmsg stdout 0 "$tag: $ASSERTION"
47 set newdir "ATTR-newdir"
48 set res [compound {Putfh $bfh; Lookup $env(ATTRFILE);
49 Openattr F; Getfh; Create $newdir {{mode 0777}} d}]
50 if {[ckres "Openattr/Create" $status $expcode $res $FAIL] == "true"} {
51 # verify the newdir is not created
52 set ofh [lindex [lindex $res 3] 2]
53 set res2 [compound {Putfh $ofh; Lookup $newdir}]
54 if {$status != "NOENT"} {
55 putmsg stderr 0 "\t Test FAIL: directory($newdir) created under attrdir"
56 putmsg stderr 1 "\t res=($res)"
57 } else {
58 logres PASS
59 }
60 }
61
62
63 # b: Try to rename attr to the none attrdir - expect INVAL|OK
64 set expcode "INVAL|OK"
65 set ASSERTION "Try to rename attr to the none attrdir, expect $expcode"
66 set tag "$TNAME{b}"
67 putmsg stdout 0 "$tag: $ASSERTION"
68 set newname "ATTR-newname"
69 set res [compound {Putfh $bfh; Lookup $env(ATTRDIR); Openattr F; Getfh;
70 Savefh; Putfh $bfh; Rename $env(ATTRDIR_AT1) $newname}]
71 if {[ckres "Openattr/Rename" $status $expcode $res $FAIL] == "true"} {
72 # verify the original name is still there
73 set ofh [lindex [lindex $res 3] 2]
74 set res2 [compound {Putfh $ofh; Lookup $env(ATTRDIR_AT1)}]
75 if {$status == "NOENT"} {
76 putmsg stderr 0 "\t Test FAIL: attrfile was renamed under attrdir"
77 putmsg stderr 1 "\t res=($res)"
78 } else {
79 logres PASS
80 }
81 }
82
83
84
85 # --------------------------------------------------------------
86 # disconnect and exit
87 Disconnect
88 exit $PASS