httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <>
Subject Re: Perl test framework, TestConfig, and debugging A::T
Date Thu, 08 Jan 2004 20:57:43 GMT
William McKee wrote:
> Hi all,
> I'm still working on getting my test environment in place using
> Apache::Test. Recently, I added a vhost section to my
> file. The test servers fire up as I would expect on ports 8529 and 8530
> when I run `t/TEST -start`.  However, following the instructions on the
> testing page[1], I am unable to retrieve the port number
> of the second server.
> I looked into the source of Apache::TestRequest and can see where the
> hostport function is trying to search $config->{vhosts} to get the
> hostport for the module in question. I dumped $config and my vhosts key
> contains an empty hashref :(.
> After a bit of thinking, I realized that my VirtualHost directives are
> being included from another file as follows:
> 	<VirtualHost securehost>
> 		include /home/quicktel/QT-Web/conf/quicktel-ssl.conf
> 	</VirtualHost>
> Putting the contents of the include file directly into the
> didn't work either. However, while testing these
> variations, instead of stopping and restarting the server, I started to
> have each test independently startup the server so that my changes to
> would get parsed and loaded by the Apache test server.
> While doing so, I noticed that the vhosts hash on the $config object is
> populated. It doesn't matter whether the VirtualHost is inside of an
> include or not.
> So now I'm wondering if there is any way to get the vhost info without
> having fire up a new server on every test. I can see where that info
> would get "lost" when running the servers separately from the tests. Is
> there anyway to reparse the config files using Apache::TestConfig to
> gather that port number again or must I manually parse the extra.conf
> file which contains the assigned port number for my vhost?

It's really hard to guess what did you do. As suggested below if you could 
create a sample package which reproduces the problem, upload it somewhere and 
post the URL here, we could be much more helpful. You should be able to create 
this sample package without having any perl modules, only the test modules.

Take a look at the modperl-2.0 suite for examples. Also see 
Apache-VMonitor-2.0 on CPAN which has 3 vhosts and it works just fine.

> While tracking down the problem, I used the perl debugger to try to find
> where Apache::Config was going astray but kept getting to the exec $cmd
> at line 570 of Apache::TestRun which fires off a command that I can't
> follow using the debugger. Is there another way to debug Apache::Test?
> Can I set an environment variable that will prevent this second
> execution of the TEST script?

I use the good old print() and Data::Dumper to debug. Actually I use error() 
which is imported by Apache::TestTrace, and if you have env var 
APACHE_TEST_COLOR=1 it'll get out in red colour and it knows to handle 
variable references via Data::Dumper. I don't think you can use perl debugger 
with fork/exec, though I could be wrong. How do you invoke the debugger? exec 
runs exactly the same command, so it should invoke the debugger again.

Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker     mod_perl Guide --->

View raw message