You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by da...@apache.org on 2002/03/18 22:49:19 UTC

cvs commit: tcl-rivet/tests/apachetest apachetest.tcl

davidw      02/03/18 13:49:19

  Modified:    tests    rivet.test
               tests/apachetest apachetest.tcl
  Log:
  * tests/apachetest/apachetest.tcl: Added TclX to requirements.  Damn.
  
  Revision  Changes    Path
  1.17      +9 -7      tcl-rivet/tests/rivet.test
  
  Index: rivet.test
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/tests/rivet.test,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- rivet.test	16 Mar 2002 18:13:42 -0000	1.16
  +++ rivet.test	18 Mar 2002 21:49:19 -0000	1.17
  @@ -6,7 +6,7 @@
   
   # See README file for more information.
   
  -# $Id: rivet.test,v 1.16 2002/03/16 18:13:42 davidw Exp $
  +# $Id: rivet.test,v 1.17 2002/03/18 21:49:19 davidw Exp $
   
   package require tcltest
   package require http
  @@ -26,24 +26,26 @@
   set testgroup2 1
   set testgroup3 1
   
  +# Run all tests against one server process.
  +
   if { $testgroup1 } {
  -    foreach Test $TestList {
  -	apachetest::start {} {
  +    apachetest::start {} {
  +	foreach Test $TestList {
   	    source $Test
   	}
       }
   }
   
  -# Now run them all against one server process, just to change things
  -# around some.
  +# Run each test in its own server
   
   if { $testgroup2 } {
  -    apachetest::start {} {
  -	foreach Test $TestList {
  +    foreach Test $TestList {
  +	apachetest::start {} {
   	    source $Test
   	}
       }
   }
  +
   
   # These tests start the server on their own
   
  
  
  
  1.2       +25 -7     tcl-rivet/tests/apachetest/apachetest.tcl
  
  Index: apachetest.tcl
  ===================================================================
  RCS file: /home/cvs/tcl-rivet/tests/apachetest/apachetest.tcl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- apachetest.tcl	16 Mar 2002 18:13:42 -0000	1.1
  +++ apachetest.tcl	18 Mar 2002 21:49:19 -0000	1.2
  @@ -1,4 +1,4 @@
  -# $Id: apachetest.tcl,v 1.1 2002/03/16 18:13:42 davidw Exp $
  +# $Id: apachetest.tcl,v 1.2 2002/03/18 21:49:19 davidw Exp $
   
   # Tcl based Apache test suite, by David N. Welton <da...@dedasys.com>
   
  @@ -7,6 +7,7 @@
   # the name of the Apache executable, which must, however, be compiled
   # with the right options.
   
  +package require Tclx
   package provide apachetest 0.1
   
   namespace eval apachetest {
  @@ -27,6 +28,19 @@
   			       template.conf.tcl]
   }
   
  +# make sure we can connect to the server
  +
  +proc apachetest::connect { } {
  +    while { 1 } {
  +	if { ! [catch {
  +	    set sk [socket localhost 8081]
  +	} err]} {
  +	    close $sk
  +	    return
  +	}
  +    }
  +}
  +
   # start - start the server in the background with 'options' and then
   # run 'code'.
   
  @@ -35,26 +49,30 @@
       variable binname
   
       # There has got to be a better way to do this, aside from waiting.
  -    after 200
       set serverpid [eval exec $binname -X -f \
   		       "[file join [pwd] server.conf]" $options &]
  -    after 100
  +
  +    apachetest::connect
       puts "Apache started as PID $serverpid"
       if { ! [catch {
   	uplevel $code
       } err] } {
   	puts $err
       }
  -    after 100
  -    exec kill $serverpid
  +    kill $serverpid
  +    wait $serverpid
   }
   
   # startserver - start the server with 'options'.
   
   proc apachetest::startserver { options } {
       variable binname
  -    eval exec $binname -X -f \
  -	"[file join [pwd] server.conf]" $options
  +    if { [catch {
  +	eval exec $binname -X -f \
  +	    "[file join [pwd] server.conf]" $options
  +    } err] } {
  +	puts $err
  +    }
   }
   
   # getbinname - get the name of the apache binary, and check to make
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org