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 REMOVE operation test - negative tests
27
28 # include all test enironment
29 source REMOVE.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: Remove with CFH=file, expect NOTDIR
41 set expcode "NOTDIR"
42 set ASSERTION "Try to remove with CFH=file, expect $expcode"
43 putmsg stdout 0 "$TNAME{a}: $ASSERTION"
44 set res [compound {Putfh $bfh; Lookup $env(RWFILE); Remove "something"}]
45 ckres "Remove" $status $expcode $res $PASS
46
47
48 # b: Remove with CFH=symlink_dir, expect NOTDIR
49 set expcode "NOTDIR"
50 set ASSERTION "Try to remove with CFH=symlink_dir, expect $expcode"
51 putmsg stdout 0 "$TNAME{b}: $ASSERTION"
52 set res [compound {Putfh $bfh; Lookup $env(SYMLDIR); Remove "xxx"}]
53 ckres "Remove" $status $expcode $res $PASS
54
55
56 # f: Remove an non-empty dir, expect NOTEMPTY
57 set expcode "NOTEMPTY"
58 set ASSERTION "Try to remove a non-empty dir, expect $expcode"
59 putmsg stdout 0 "$TNAME{f}: $ASSERTION"
60 set res [compound {Putfh $bfh; Remove $env(LARGEDIR); Getfh}]
61 ckres "Remove" $status $expcode $res $PASS
62
63
64 # i: Remove with FS is READONLY, expect ROFS
65 set expcode "ROFS"
66 set ASSERTION "Try to remove FS is READONLY, expect $expcode"
67 putmsg stdout 0 "$TNAME{i}: $ASSERTION"
68 set rofh [get_fh [path2comp $env(ROFSDIR) $DELM]]
69 if {"$rofh" == ""} {
70 putmsg stdout 0 "\t Test NOTINUSE: ROFS is not setup in server."
71 } else {
72 set res [compound {Putfh $rofh; ; Remove $env(ROFILE)}]
73 ckres "Remove" $status $expcode $res $PASS
74 }
75
76
77 # j: Remove is not supported in SERVER, expect NOTSUPP
78 set expcode "NOTSUPP"
79 set ASSERTION "Remove is not supported in SERVER, expect $expcode"
80 putmsg stdout 0 "$TNAME{j}: $ASSERTION"
81 putmsg stdout 0 "\t Test NOTINUSE: Invalid for Solaris server."
82 putmsg stdout 1 "\t\t Solaris supports REMOVE op."
83
84
85 # --------------------------------------------------------------
86 # disconnect and exit
87 Disconnect
88 exit $PASS