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 CREATE operation test - negative tests with creating other file types
27
28 # include all test enironment
29 source CREATE.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: create a new fifo without FH, expect NOFILEHANDLE
41 set expcode "NOFILEHANDLE"
42 set nobj "noFH.[pid]"
43 set ASSERTION "Create a new fifo without FH, expect $expcode"
44 set tag $TNAME{a}
45 putmsg stdout 0 "$tag: $ASSERTION"
46 set res [compound {Create $nobj {{size 22}} f; Getfh}]
47 ckres "Create" $status $expcode $res $PASS
48
49
50 # b: create a new link with objname existed; expect EXIST
51 set expcode "EXIST"
52 set nobj $env(DIR0777)
53 set ASSERTION "Create a new link with objname existed, expect $expcode"
54 set tag $TNAME{b}
55 putmsg stdout 0 "$tag: $ASSERTION"
56 set res [compound {Putfh $bfh;
57 Create $nobj {{mode 0644}} l $env(DIR0777); Getfh }]
58 ckres "Create" $status $expcode $res $PASS
59
60
61 # c: try to create an obj while dir removed, expect STALE
62 set expcode "STALE"
63 set ASSERTION "Create an obj while dir removed, expect $expcode"
64 set tag $TNAME{c}
65 #putmsg stdout 0 "$tag: $ASSERTION"
66 #puts "\t Test UNTESTED: XXX need hook to remove <cfh> in server\n"
67
68
69 # d: try to create a sock with longname, expect NAMETOOLONG
70 set expcode "NAMETOOLONG"
71 set tobj [set_maxname $bfh]
72 set ASSERTION "Create a sock with longname, expect $expcode"
73 set tag $TNAME{d}
74 putmsg stdout 0 "$tag: $ASSERTION"
75 set res [compound {Putfh $bfh; Create $tobj {{mode 0666}} s; Getfh }]
76 ckres "Create" $status $expcode $res $PASS
77
78
79 # e: try to create an obj with type=NF4REG; expect BADTYPE
80 set expcode "BADTYPE"
81 set tobj "reg.[pid]"
82 set ASSERTION "Create an obj with type=NF4REG, expect $expcode"
83 set tag $TNAME{e}
84 #putmsg stdout 0 "$tag: $ASSERTION"
85 #set res [compound {Putfh $bfh; Create $tobj {{mode 0700}} r; Getfh }]
86 #ckres "Create" $status $expcode $res $PASS
87 #puts "\t Test UNTESTED: XXX need nfsv4shell/nfs4_prot.x to support badtype.\n"
88
89
90 # f: try to create an obj with FH expired, expect FHEXPIRED
91 set expcode "FHEXPIRED"
92 set tobj "$BASEDIRS XXX need nfsv4shell to support"
93 set ASSERTION "Create an obj with FH expired, expect $expcode"
94 set tag $TNAME{f}
95 #putmsg stdout 0 "$tag: $ASSERTION"
96 #set res [compound {Putfh $bfh; Create $tobj {{mode 0777}} d; Getfh }]
97 #ckres "Create" $status $expcode $res $PASS
98 #puts "\t Test UNTESTED: XXX need server hook on FH expired.\n"
99
100
101 # --------------------------------------------------------------
102 # disconnect and exit
103 Disconnect
104 exit $PASS