Starting with 2.4, Apache needs to read its configuration file even to
report its version and build parameters with the "-V" option, probably
because the MPM module can be chosen at run time.

However, the system Apache configuration may not be available to the user
building mod_perl, or it may depend on special environment variables or
the like. The attached proposed patch makes Apache-Test use the test
configuration file and server root instead for the "-V" invocations,
if those are available.

I don't see any reason why this shouldn't be safe to use with earlier
versions of Apache too. Everything works for me with Apache 2.2 too FWIW.

We're currently using this for the Debian package, to run the test suite
in package builds with a controlled httpd config instead of relying on the
system one.
-- 
Niko Tyni   nt...@debian.org
>From 8de878c3b133981af58588f8c40545b42806cbfd Mon Sep 17 00:00:00 2001
From: Niko Tyni <nt...@debian.org>
Date: Fri, 24 May 2013 15:30:29 +0300
Subject: [PATCH] Run "httpd -V" with the test config and server root if
 available

Starting with 2.4, Apache needs to read its configuration file even to
report its version and build parameters with the "-V" option, probably
because the MPM module can be chosen at run time.

However, the system Apache configuration may not be available to the user
building mod_perl, or it may depend on special environment variables or
the like. Make Apache-Test use the test configuration file and server
root instead for the "-V" invocations, if those are available.
---
 Apache-Test/lib/Apache/TestConfigParse.pm |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Apache-Test/lib/Apache/TestConfigParse.pm b/Apache-Test/lib/Apache/TestConfigParse.pm
index 2534ce1..4985442 100644
--- a/Apache-Test/lib/Apache/TestConfigParse.pm
+++ b/Apache-Test/lib/Apache/TestConfigParse.pm
@@ -456,6 +456,13 @@ sub get_httpd_defines {
 
     $httpd = shell_ready($httpd);
     my $cmd = "$httpd -V";
+
+    my $httpdconf = $self->{vars}->{httpd_conf};
+    $cmd .= " -f $httpdconf" if $httpdconf;
+
+    my $serverroot = $self->{vars}->{serverroot};
+    $cmd .= " -d $serverroot" if $serverroot;
+
     my $proc = $self->open_cmd($cmd);
 
     while (<$proc>) {
-- 
1.7.10.4


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@perl.apache.org
For additional commands, e-mail: dev-h...@perl.apache.org

Reply via email to