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/12 17:38:09 UTC
cvs commit: tcl-rivet/tests rivet.test runtests.tcl
davidw 02/03/12 08:38:09
Modified: tests rivet.test runtests.tcl
Log:
Updated the test suite so that we can start the server up for each
test, if needs be, to do extra stuff with it...
Revision Changes Path
1.12 +28 -2 tcl-rivet/tests/rivet.test
Index: rivet.test
===================================================================
RCS file: /home/cvs/tcl-rivet/tests/rivet.test,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- rivet.test 23 Feb 2002 11:28:21 -0000 1.11
+++ rivet.test 12 Mar 2002 16:38:09 -0000 1.12
@@ -6,20 +6,46 @@
# See README file for more information.
-# $Id: rivet.test,v 1.11 2002/02/23 11:28:21 davidw Exp $
+# $Id: rivet.test,v 1.12 2002/03/12 16:38:09 davidw Exp $
package require tcltest
package require http
set urlbase "http://localhost:8081/"
+# Use this to start and stop the server:
+
+namespace eval server {
+ variable binname
+}
+set server::binname $binname
+
+proc server::start { options code } {
+ variable serverpid 0
+ variable binname
+ after 200
+ set serverpid [eval exec $binname -X -f "[file join [pwd] server.conf]" $options &]
+ puts "Apache started as PID $serverpid"
+ after 200
+ if { ! [catch {
+ uplevel $code
+ } err] } {
+ puts $err
+ }
+ after 100
+ exec kill $serverpid
+}
+
+
# Test stanzas are created by giving the test a name and a
# description. The code is then executed, and the results compared
# with the desired result, which is placed after the block of code.
# See man tcltest for more information.
foreach Test {cookies.test get.test post.test tclfile.test env.test hello.test include.test binary.test parse.test upload.test} {
- source $Test
+ server::start {} {
+ source $Test
+ }
}
::tcltest::cleanupTests
1.7 +6 -26 tcl-rivet/tests/runtests.tcl
Index: runtests.tcl
===================================================================
RCS file: /home/cvs/tcl-rivet/tests/runtests.tcl,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- runtests.tcl 6 Jan 2002 13:30:54 -0000 1.6
+++ runtests.tcl 12 Mar 2002 16:38:09 -0000 1.7
@@ -17,28 +17,11 @@
source makeconf.tcl
makeconf $binname server.conf
-switch -exact [lindex $argv 1] {
- withconfigs {
- foreach {option val} {
- {} {}
- RivetServerConf {GlobalInitScript "source tclconf.tcl"}
- RivetServerConf {ChildInitScript "source tclconf.tcl"}
- RivetServerConf {ChildExitScript "source tclconf.tcl"}
- RivetServerConf {BeforeScript "source tclconf.tcl"}
- RivetServerConf {AfterScript "source tclconf.tcl"}
- RivetServerConf {ErrorScript "source tclconf.tcl"}
- RivetServerConf {CacheSize 20}
- RivetServerConf {UploadDirectory /tmp/}
- RivetServerConf {UploadMaxSize 2000}
- RivetServerConf {UploadFilesToVar yes}
- RivetServerConf {SeparateVirtualInterps yes}
- } {
- set apachepid [exec $binname -X -f "[file join [pwd] server.conf]" -c "$option $val" &]
- set oput [exec [file join . rivet.test]]
- puts $oput
- exec kill $apachepid
- }
- }
+# we do this to keep tcltest happy - it reads argv...
+set commandline [lindex $argv 1]
+set argv {}
+
+switch -exact [lindex $commandline 1] {
startserver {
if { [catch {
exec $binname -X -f "[file join [pwd] server.conf]"
@@ -47,9 +30,6 @@
}
}
default {
- set apachepid [exec $binname -X -f "[file join [pwd] server.conf]" &]
- set oput [exec [file join . rivet.test]]
- puts $oput
- exec kill $apachepid
+ source [file join . rivet.test]
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org