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 2004/02/06 22:43:55 UTC
cvs commit: tcl-rivet/tests/apachetest apachetest.tcl
davidw 2004/02/06 13:43:55
Modified: . ChangeLog
tests headers.test
tests/apachetest apachetest.tcl
Log:
* tests/headers.test: Include current version of http package in
result automatically, so as to avoid having to update it by hand.
* tests/apachetest/apachetest.tcl (apachetest::getallincludes): Create
function to fetch a conf file and all the files Included it from it.
Revision Changes Path
1.163 +7 -0 tcl-rivet/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /home/cvs/tcl-rivet/ChangeLog,v
retrieving revision 1.162
retrieving revision 1.163
diff -u -r1.162 -r1.163
--- ChangeLog 6 Feb 2004 17:07:29 -0000 1.162
+++ ChangeLog 6 Feb 2004 21:43:55 -0000 1.163
@@ -1,5 +1,12 @@
2004-02-06 David N. Welton <da...@dedasys.com>
+ * tests/headers.test: Include current version of http package in
+ result automatically, so as to avoid having to update it by hand.
+
+ * tests/apachetest/apachetest.tcl (apachetest::getallincludes):
+ Create function to fetch a conf file and all the files Included it
+ from it.
+
* doc/rivet.xml: Add section for session package.
* doc/rivet.xml: Added SESSION documentation.
1.2 +8 -4 tcl-rivet/tests/headers.test
Index: headers.test
===================================================================
RCS file: /home/cvs/tcl-rivet/tests/headers.test,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- headers.test 30 Sep 2003 18:27:47 -0000 1.1
+++ headers.test 6 Feb 2004 21:43:55 -0000 1.2
@@ -2,12 +2,16 @@
set testfilename1 headers.rvt
+# We do this in order to always match the version present.
+set httpversion [package require http]
+set result "hdrs(Accept) = */*
+hdrs(Host) = localhost:8081
+hdrs(User-Agent) = Tcl http client package $httpversion"
+
::tcltest::test headers-1.1 {load_headers test} {
set page [::http::geturl "${urlbase}$testfilename1"]
regexp -all -lineanchor "(^hdrs.*?$\n){3}" [::http::data $page] match
set match [string trim $match]
::http::cleanup $page
set match
-} {hdrs(Accept) = */*
-hdrs(Host) = localhost:8081
-hdrs(User-Agent) = Tcl http client package 2.4.4}
\ No newline at end of file
+} $result
\ No newline at end of file
1.9 +58 -7 tcl-rivet/tests/apachetest/apachetest.tcl
Index: apachetest.tcl
===================================================================
RCS file: /home/cvs/tcl-rivet/tests/apachetest/apachetest.tcl,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- apachetest.tcl 24 May 2003 08:43:30 -0000 1.8
+++ apachetest.tcl 6 Feb 2004 21:43:55 -0000 1.9
@@ -1,6 +1,7 @@
# $Id$
-# Tcl-based Apache test suite, by David N. Welton <da...@dedasys.com>
+# apachetest.tcl -- Tcl-based Apache test suite, by David N. Welton
+# <da...@dedasys.com>
# This test suite provides a means to create configuration files, and
# start apache with user-specified options. All it needs to run is
@@ -185,16 +186,66 @@
return $filename
}
-# if we need to load some modules, find out how to do it from the
-# 'real' (the one installed on the system) conf file, with this proc
+# apachetest::getallincludes --
+#
+# Reads the conf file, and returns its text, plus the text in
+# all the files that it Includes itself.
+#
+# Arguments:
+# conffile - file to read.
+#
+# Side Effects:
+# None.
+#
+# Results:
+# Text of configuration files.
-proc apachetest::getloadmodules { conffile needtoget } {
+proc apachetest::getallincludes { conffile } {
set fl [open $conffile r]
- set confdata [read $fl]
+ set data [read $fl]
close $fl
+
+ set newdata {}
+ foreach line [split $data \n] {
+ # Look for Include lines.
+ if { [regexp -line {^[^\#]*Include +(.*)} $line match file] } {
+ set file [string trim $file]
+ # Since directories may be included, glob them for all
+ # files contained therein.
+ if { [file isdirectory $file] } {
+ foreach fl [glob -nocomplain [file join $file *]] {
+ append newdata [getallincludes $fl]
+ }
+ } else {
+ append newdata [getallincludes $file]
+ }
+ }
+ }
+ append data $newdata
+ return $data
+}
+
+# apachetest::getloadmodules --
+#
+# Get the LoadModule lines for modules that we want to load.
+#
+# Arguments:
+# conffile - the name of the conf file to read.
+# needtoget - list of modules that we want to load.
+#
+# Side Effects:
+# None.
+#
+# Results:
+# Returns a string suitable for inclusion in a conf file.
+
+
+proc apachetest::getloadmodules { conffile needtoget } {
+ set confdata [getallincludes $conffile]
set loadline [list]
foreach mod $needtoget {
- if { ! [regexp -line "^.*?(LoadModule\\s+$mod\\s+.+)\$"\
+ # Look for LoadModule lines.
+ if { ! [regexp -line "^\[^\#\]*(LoadModule\\s+$mod\\s+.+)\$"\
$confdata match line] } {
error "No LoadModule line for $mod!"
} else {
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-cvs-help@tcl.apache.org