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 # Close testing.
27
28 # TESTROOT directory; must be set in the environment already
29 set TESTROOT $env(TESTROOT)
30
31 source [file join ${TESTROOT} tcl.init]
32 source [file join ${TESTROOT} testproc]
33 source [file join ${TESTROOT} lcltools]
34
35 # setting local variables
36 set TNAME $argv0
37
38 # connect to the test server
39 Connect
40
41 # XXX add catch here later
42 set tag $TNAME.setup
43 set dfh [get_fh $BASEDIRS]
44
45 proc setparms {} {
46 uplevel 1 {set stateid ""}
47 uplevel 1 {set seqid ""}
48 uplevel 1 {set rflags ""}
49 uplevel 1 {set res ""}
50 uplevel 1 {set st ""}
51 }
52
53
54 # Start testing
55 # --------------------------------------------------------------
56
57 # a: normal file
58 set tag $TNAME{a}
59 set expct "OK"
60 set ASSERTION "normal file, expect $expct"
61 putmsg stdout 0 "$tag: $ASSERTION"
62 set TESTFILE [file join $BASEDIR $tag]
63 setparms
64 set fh [openv4 $TESTFILE clientid stateid seqid ]
65 if {$fh == $NULL} {
66 putmsg stderr 0 "\t Test UNINITIATED: unable to open $TESTFILE."
67 } else {
68 set res ""
69 set st [closetst $fh $stateid $seqid res]
70 ckres "Close" $st $expct $res $PASS
71 if {[removev4 $TESTFILE] == $NULL} {
72 putmsg stdout 0 "Can not remove $TESTFILE"
73 }
74 }
75
76 # b: close retransmitted same seqid
77 set tag $TNAME{b}
78 set expct "OK"
79 set ASSERTION "close retransmitted same seqid, expect $expct"
80 putmsg stdout 0 "$tag: $ASSERTION"
81 #putmsg stdout 0 "\tTest UNTESTED retransmitted not realistic"
82 set TESTFILE [file join $BASEDIR $tag]
83 setparms
84 set fh [openv4 $TESTFILE clientid stateid seqid ]
85 if {$fh == $NULL} {
86 putmsg stderr 0 "\t Test UNINITIATED: unable to open $TESTFILE."
87 } else {
88 set res ""
89 set st [closetst $fh $stateid $seqid res]
90 set st [closetst $fh $stateid $seqid res]
91 ckres "Close" $st $expct $res $PASS
92 if {[removev4 $TESTFILE] == $NULL} {
93 putmsg stdout 0 "Can not remove $TESTFILE"
94 }
95 }
96
97
98 # f: seqid set to max value
99 set tag $TNAME{f}
100 set expct "OK"
101 set ASSERTION "seqid set to max value, expect $expct"
102 putmsg stdout 0 "$tag: $ASSERTION"
103 set TESTFILE [file join $BASEDIR $tag]
104 setparms
105 # max unsigned 32 bit value - 1
106 set seqid 4294967294
107 set fh [openv4 $TESTFILE clientid stateid seqid ]
108 if {$fh == $NULL} {
109 putmsg stderr 0 "\t Test UNINITIATED: unable to open $TESTFILE."
110 } else {
111 set res ""
112 set st [closetst $fh $stateid $seqid res]
113 ckres "Close" $st $expct $res $PASS
114 if {[removev4 $TESTFILE] == $NULL} {
115 putmsg stdout 0 "Can not remove $TESTFILE"
116 }
117 }
118
119
120 # --------------------------------------------------------------
121 # disconnect and exit
122 Disconnect
123 exit $PASS