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 COMMIT operation test - negative tests
27
28 # include all test enironment
29 source COMMIT.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: Commit without Putrootfh, expect NOFILEHANDLE
41 set expcode "NOFILEHANDLE"
42 set ASSERTION "Commit without <cfh>, expect $expcode"
43 set tag "$TNAME{a}"
44 putmsg stdout 0 "$tag: $ASSERTION"
45 set res [compound {Commit 0 0}]
46 ckres "Commit" $status $expcode $res $PASS
47
48
49 # b: Commit with <cfh> is a readonly file, expect ACCESS
50 set expcode "ACCESS"
51 set ASSERTION "Commit <cfh> is a readonly file, expect $expcode"
52 set tag "$TNAME{b}"
53 putmsg stdout 0 "$tag: $ASSERTION"
54 set res [compound {Putfh $bfh; Lookup $env(ROFILE);
55 Commit 0 10; Getfh}]
56 ckres "Commit" $status $expcode $res $PASS
57
58
59 # c: Commit with <cfh> is a symlink, expect INVAL
60 set expcode "INVAL"
61 set ASSERTION "Commit with <cfh> is a symlink, expect $expcode"
62 set tag "$TNAME{c}"
63 putmsg stdout 0 "$tag: $ASSERTION"
64 set res [compound {Putfh $bfh; Lookup "$env(SYMLDIR)";
65 Commit 1 2; Getfh}]
66 ckres "Commit" $status $expcode $res $PASS
67
68
69 # d: Commit with <cfh> is a fifofile, expect INVAL
70 set expcode "INVAL"
71 set ASSERTION "Commit with <cfh> is a fifofile, expect $expcode"
72 set tag "$TNAME{d}"
73 putmsg stdout 0 "$tag: $ASSERTION"
74 set res [compound {Putfh $bfh; Lookup "$env(FIFOFILE)";
75 Commit 2 3; Getfh}]
76 ckres "Commit" $status $expcode $res $PASS
77
78
79 # e: Commit with <cfh> is a dir, expect ISDIR
80 set expcode "ISDIR"
81 set ASSERTION "Commit with <cfh> is a directory, expect $expcode"
82 set tag "$TNAME{e}"
83 putmsg stdout 0 "$tag: $ASSERTION"
84 set res [compound {Putfh $bfh; Lookup "$env(DIR0711)";
85 Commit 1 2; Getfh}]
86 ckres "Commit" $status $expcode $res $PASS
87
88
89 # f: Commit with <cfh> is in ROFS, expect ROFS
90 set expcode "ROFS"
91 set ASSERTION "Commit with <cfh> is in ROFS, expect $expcode"
92 set tag "$TNAME{f}"
93 putmsg stdout 0 "$tag: $ASSERTION"
94 set tfh [get_fh "[path2comp $env(ROFSDIR) $DELM] $env(RWFILE)"]
95 set res [compound {Putfh $tfh; Commit 10 2; Getfh}]
96 ckres "Commit" $status $expcode $res $PASS
97
98
99 # --------------------------------------------------------------
100 # disconnect and exit
101 Disconnect
102 exit $PASS