Index: tests/tlsIo.test ================================================================== --- tests/tlsIo.test +++ tests/tlsIo.test @@ -8,11 +8,11 @@ # Copyright (c) 1998-2000 Ajuba Solutions. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: tlsIo.test,v 1.10 2000/06/03 03:17:58 awb Exp $ +# RCS: @(#) $Id: tlsIo.test,v 1.11 2000/06/03 03:35:36 awb Exp $ # Running socket tests with a remote server: # ------------------------------------------ # # Some tests in socket.test depend on the existence of a remote server to @@ -672,35 +672,41 @@ test socket-3.1 {socket conflict} {socket stdio} { removeFile script set f [open script w] puts $f { package require tls - set f [tls::socket -server accept 2828] + } + puts $f "set f \[tls::socket -server accept -certfile $serverCert -cafile $caCert -keyfile $serverKey 2828 \]" + puts $f { puts ready gets stdin close $f } close $f set f [open "|[list $::tcltest::tcltest script]" r+] gets $f - set x [list [catch {tls::socket -server accept 2828} msg] \ + set x [list [catch {tls::socket \ + -certfile $clientCert -cafile $caCert -keyfile $clientKey \ + -server accept 2828} msg] \ $msg] puts $f bye close $f set x } {1 {couldn't open socket: address already in use}} -test socket-3.2 {server with several clients} {socket stdio pcCrash} { +test socket-3.2 {server with several clients} {socket stdio} { removeFile script set f [open script w] puts $f { package require tls set t1 [after 30000 "set x timed_out"] set t2 [after 31000 "set x timed_out"] set t3 [after 32000 "set x timed_out"] set counter 0 - set s [tls::socket -server accept 2828] + } + puts $f "set s \[tls::socket -server accept -certfile $serverCert -cafile $caCert -keyfile $serverKey 2828 \]" + puts $f { proc accept {s a p} { fileevent $s readable [list echo $s] fconfigure $s -buffering line } proc echo {s} { @@ -724,15 +730,21 @@ puts $x } close $f set f [open "|[list $::tcltest::tcltest script]" r+] set x [gets $f] - set s1 [tls::socket 127.0.0.1 2828] + set s1 [tls::socket \ + -certfile $clientCert -cafile $caCert -keyfile $clientKey \ + 127.0.0.1 2828] fconfigure $s1 -buffering line - set s2 [tls::socket 127.0.0.1 2828] + set s2 [tls::socket \ + -certfile $clientCert -cafile $caCert -keyfile $clientKey \ + 127.0.0.1 2828] fconfigure $s2 -buffering line - set s3 [tls::socket 127.0.0.1 2828] + set s3 [tls::socket \ + -certfile $clientCert -cafile $caCert -keyfile $clientKey \ + 127.0.0.1 2828] fconfigure $s3 -buffering line for {set i 0} {$i < 100} {incr i} { puts $s1 hello,s1 gets $s1 puts $s2 hello,s2 @@ -746,17 +758,19 @@ lappend x [gets $f] close $f set x } {ready done} -test socket-4.1 {server with several clients} {socket stdio pcCrash} { +test socket-4.1 {server with several clients} {socket stdio} { removeFile script set f [open script w] puts $f { package require tls gets stdin - set s [tls::socket 127.0.0.1 2828] + } + puts $f "set s \[tls::socket -certfile $clientCert -cafile $caCert -keyfile $clientKey 127.0.0.1 2828 \]" + puts $f { fconfigure $s -buffering line for {set i 0} {$i < 100} {incr i} { puts $s hello gets $s } @@ -786,11 +800,13 @@ } } set t1 [after 30000 "set x timed_out"] set t2 [after 31000 "set x timed_out"] set t3 [after 32000 "set x timed_out"] - set s [tls::socket -server accept 2828] + set s [tls::socket \ + -certfile $serverCert -cafile $caCert -keyfile $serverKey \ + -server accept 2828] puts $p1 open puts $p2 open puts $p3 open vwait x vwait x @@ -873,11 +889,11 @@ close $s rename bgerror {} set x } {{divide by zero}} -test socket-7.1 {testing socket specific options} {socket stdio pcCrash} { +test socket-7.1 {testing socket specific options} {socket stdio} { removeFile script set f [open script w] puts $f { package require tls } @@ -939,26 +955,29 @@ lappend l [expr [lindex $p 2] == 2821] } {3 127.0.0.1 0} test socket-7.3 {testing socket specific options} {socket} { set s [tls::socket \ + -certfile $serverCert -cafile $caCert -keyfile $serverKey \ -server accept 2822] set l [fconfigure $s] close $s update llength $l } 12 -test socket-7.4 {testing socket specific options} {socket pcCrash} { +test socket-7.4 {testing socket specific options} {socket} { set s [tls::socket \ + -certfile $serverCert -cafile $caCert -keyfile $serverKey \ -server accept 2823] proc accept {s a p} { global x set x [fconfigure $s -sockname] close $s } set s1 [tls::socket \ + -certfile $clientCert -cafile $caCert -keyfile $clientKey \ [info hostname] 2823] set timer [after 10000 "set x timed_out"] vwait x after cancel $timer close $s @@ -965,11 +984,11 @@ close $s1 set l "" lappend l [lindex $x 2] [llength $x] } {2823 3} -test socket-7.5 {testing socket specific options} {socket unixOrPc pcCrash} { +test socket-7.5 {testing socket specific options} {socket unixOrPc} { set s [tls::socket \ -certfile $serverCert -cafile $caCert -keyfile $serverKey \ -server accept 2829] proc accept {s a p} { global x @@ -986,11 +1005,11 @@ close $s1 set l "" lappend l [lindex $x 0] [lindex $x 2] [llength $x] } {127.0.0.1 2829 3} -test socket-8.1 {testing -async flag on sockets} {empty socket pcCrash} { +test socket-8.1 {testing -async flag on sockets} {empty socket} { # NOTE: This test may fail on some Solaris 2.4 systems. If it does, # check that you have these patches installed (using showrev -p): # # 101907-05, 101925-02, 101945-14, 101959-03, 101969-05, 101973-03, # 101977-03, 101981-02, 101985-01, 102001-03, 102003-01, 102007-01,