Hi,
i finally came around to fix p5-Apache-Test when i was updating it to
1.30.  With ``fix'' i mean it's now eventually able to run tests.

The reason i didn't work is quite simple: our httpd(8) has chroot
enabled by default.  The obvious fix is simple - i've implemented
support for chroot and set it disabled by default.
The documentation is also covered and i've tested it with some other
ports that have their tests still disabled because p5-Apache-Test wasn't
actually working - their tests pass with this diff.

Further i've changed the maintainer to myself, as mjc@ isn't active
lately and even told me in private that he's glad if i take ``them''
over, though in relation to another port, so i guess he's fine with it.
To be sure i CC'ed him.

Is anyone in disagreement with this approach or should i commit it?
In either case, please give me some feedback.

Kind regards,
Simon


Index: Makefile
===================================================================
RCS file: /cvs/ports/www/p5-Apache-Test/Makefile,v
retrieving revision 1.9
diff -u -p -r1.9 Makefile
--- Makefile    15 Sep 2007 20:38:23 -0000      1.9
+++ Makefile    29 Apr 2008 21:13:30 -0000
@@ -3,10 +3,10 @@
 COMMENT=       Test wrapper with helpers for testing Apache
 
 MODULES=       cpan
-DISTNAME=      Apache-Test-1.29
+DISTNAME=      Apache-Test-1.30
 CATEGORIES=    www
 
-MAINTAINER=    Michael Coulter <[EMAIL PROTECTED]>
+MAINTAINER=    Simon Bertrang <[EMAIL PROTECTED]>
 
 # Apache License 2.0
 PERMIT_PACKAGE_CDROM=  Yes
@@ -14,7 +14,6 @@ PERMIT_PACKAGE_FTP=   Yes
 PERMIT_DISTFILES_CDROM=        Yes
 PERMIT_DISTFILES_FTP=  Yes
 
-# does not work
-NO_REGRESS=    Yes
+MAKE_ENV+=     APACHE_TEST_HTTPD=/usr/sbin/httpd
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/www/p5-Apache-Test/distinfo,v
retrieving revision 1.7
diff -u -p -r1.7 distinfo
--- distinfo    5 Apr 2007 17:26:22 -0000       1.7
+++ distinfo    29 Apr 2008 21:13:30 -0000
@@ -1,5 +1,5 @@
-MD5 (Apache-Test-1.29.tar.gz) = 2ZyIuFYwJCAhHO4viRrZMQ==
-RMD160 (Apache-Test-1.29.tar.gz) = abIaxIcs5cFUJiv5XmUJNLtLaGk=
-SHA1 (Apache-Test-1.29.tar.gz) = rsdXelxpWPbbzl/SK3F1dD9+exo=
-SHA256 (Apache-Test-1.29.tar.gz) = yHgMYzM14zSUFMZ7gbFTcZ1AU02McJLb0wIU7SenIEM=
-SIZE (Apache-Test-1.29.tar.gz) = 151416
+MD5 (Apache-Test-1.30.tar.gz) = 9ONL4hiiUEje9aT3l658uQ==
+RMD160 (Apache-Test-1.30.tar.gz) = j8o+whGFH3OQ7MbF+DcbQH+qhi4=
+SHA1 (Apache-Test-1.30.tar.gz) = t90BbSOJ/f4959RCgrsGtl5wWIg=
+SHA256 (Apache-Test-1.30.tar.gz) = 5F0eplGuF5vJ8w8yHjZP/xKF20d8xHNapKkAMcW6Jno=
+SIZE (Apache-Test-1.30.tar.gz) = 150711
Index: patches/patch-lib_Apache_TestConfig_pm
===================================================================
RCS file: patches/patch-lib_Apache_TestConfig_pm
diff -N patches/patch-lib_Apache_TestConfig_pm
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_Apache_TestConfig_pm      29 Apr 2008 21:13:30 -0000
@@ -0,0 +1,75 @@
+$OpenBSD$
+--- lib/Apache/TestConfig.pm.orig      Thu Nov 15 00:59:24 2007
++++ lib/Apache/TestConfig.pm   Tue Apr 29 22:44:26 2008
+@@ -60,7 +60,7 @@ use vars qw(%Usage);
+ 
+ # variables stored in $Apache::TestConfigData::vars
+ my @data_vars_must = qw(httpd apxs);
+-my @data_vars_opt  = qw(user group port);
++my @data_vars_opt  = qw(user group port chroot);
+ # mapping from $Apache::TestConfigData::vars to $ENV settings
+ my %vars_to_env = (
+     httpd => 'APACHE_TEST_HTTPD',
+@@ -68,6 +68,7 @@ my %vars_to_env = (
+     user  => 'APACHE_TEST_USER',
+     group => 'APACHE_TEST_GROUP',
+     port  => 'APACHE_TEST_PORT',
++    chroot=> 'APACHE_TEST_CHROOT',
+ );
+ 
+ %Usage = (
+@@ -100,6 +101,7 @@ my %vars_to_env = (
+    sslcaorg        => 'SSL CA organization to use for tests (default is asf)',
+    libmodperl      => 'path to mod_perl\'s .so (full or relative to 
LIBEXECDIR)',
+    defines         => 'values to add as -D defines (for example, "VAR1 
VAR2")',
++   chroot          => 'switch to enable httpd chroot behavior',
+    (map { $_ . '_module_name', "$_ module name"} qw(cgi ssl thread access 
auth php)),
+ );
+ 
+@@ -156,6 +158,7 @@ my %passenv = map { $_,1 } qw{
+     APACHE_TEST_GROUP
+     APACHE_TEST_USER
+     APACHE_TEST_PORT
++    APACHE_TEST_CHROOT
+ };
+ 
+ sub passenv {
+@@ -303,6 +306,7 @@ sub new {
+     $vars->{documentroot} ||= catfile $vars->{serverroot}, 'htdocs';
+     $vars->{perlpod}      ||= $self->find_in_inc('pods') ||
+                               $self->find_in_inc('pod');
++    $vars->{chroot}       ||= $self->default_chroot;
+     $vars->{perl}         ||= $^X;
+     $vars->{t_conf}       ||= catfile $vars->{serverroot}, 'conf';
+     $vars->{sslca}        ||= catfile $vars->{t_conf}, 'ssl', 'ca';
+@@ -732,6 +736,17 @@ sub default_httpd {
+     $ENV{APACHE_TEST_HTTPD};
+ }
+ 
++sub default_chroot {
++    my $uid = $>;
++
++    my $chroot = $ENV{APACHE_TEST_CHROOT} || 0;
++
++    if ($chroot && $uid != 0) {
++        die "cannot run tests in chroot as normal user";
++    }
++
++    $chroot;
++}
+ my $localhost;
+ 
+ sub default_localhost {
+@@ -2593,6 +2608,12 @@ a tty. But sometimes there is a program that can answe
+ (e.g. when testing A-T itself). If this variable is true the
+ interactive config won't be skipped (if needed).
+ 
++=head2 APACHE_TEST_CHROOT
++
++Under OpenBSD the httpd(8) runs per default in a chroot environment.
++As this conflicts with the usual test setup and requires root privileges,
++the default in C<Apache::Test> is to do no chroot.
++With C<APACHE_TEST_CHROOT> set, the httpd is started chrooted.
+ 
+ =head1 Special Placeholders
+ 
Index: patches/patch-lib_Apache_TestRun_pm
===================================================================
RCS file: patches/patch-lib_Apache_TestRun_pm
diff -N patches/patch-lib_Apache_TestRun_pm
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_Apache_TestRun_pm 29 Apr 2008 21:13:30 -0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+--- lib/Apache/TestRun.pm.orig Tue Apr 29 22:44:39 2008
++++ lib/Apache/TestRun.pm      Tue Apr 29 22:46:51 2008
+@@ -1431,9 +1431,10 @@ to a configuration file C<Apache::TestConfigData>.  Th
+ will then be used in setting these options for subsequent uses of
+ C<Apache-Test> unless temprorarily overridden, either by setting the
+ appropriate environment variable (C<APACHE_TEST_HTTPD>,
+-C<APACHE_TEST_APXS>, C<APACHE_TEST_PORT>, C<APACHE_TEST_USER>, and
+-C<APACHE_TEST_GROUP>) or by giving the relevant option (C<-httpd>,
+-C<-apxs>, C<-port>, C<-user>, and C<-group>) when the C<TEST> script
++C<APACHE_TEST_APXS>, C<APACHE_TEST_PORT>, C<APACHE_TEST_USER>,
++C<APACHE_TEST_GROUP>, and C<APACHE_TEST_CHROOT>) or by giving the
++relevant option (C<-httpd>, C<-apxs>, C<-port>, C<-user>, C<-chroot>,
++and C<-group>) when the C<TEST> script
+ is run.
+ 
+ To avoid either using previous persistent configurations or saving
Index: patches/patch-lib_Apache_TestServer_pm
===================================================================
RCS file: patches/patch-lib_Apache_TestServer_pm
diff -N patches/patch-lib_Apache_TestServer_pm
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_Apache_TestServer_pm      29 Apr 2008 21:13:30 -0000
@@ -0,0 +1,24 @@
+$OpenBSD$
+--- lib/Apache/TestServer.pm.orig      Wed Nov 14 07:44:36 2007
++++ lib/Apache/TestServer.pm   Thu Apr 17 23:08:12 2008
+@@ -164,14 +164,19 @@ sub start_cmd {
+     my $config = $self->{config};
+     my $vars   = $config->{vars};
+     my $httpd  = $vars->{httpd};
++    my $chroot = '';
+ 
+     my $one_process = $self->{run}->{opts}->{'one-process'}
+         ? $self->version_of(\%one_process)
+         : '';
+ 
++    if ($self->{rev} == 1 && !$vars->{chroot}) {
++        $chroot = '-u'
++    }
++
+     #XXX: threaded mpm does not respond to SIGTERM with -D ONE_PROCESS
+ 
+-    return "$httpd $one_process $args";
++    return "$httpd $chroot $one_process $args";
+ }
+ 
+ sub default_gdbinit {
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/www/p5-Apache-Test/pkg/PLIST,v
retrieving revision 1.7
diff -u -p -r1.7 PLIST
--- pkg/PLIST   29 Jan 2007 16:31:58 -0000      1.7
+++ pkg/PLIST   29 Apr 2008 21:13:30 -0000
@@ -7,7 +7,9 @@ ${P5SITE}/Apache/TestClient.pm
 ${P5SITE}/Apache/TestCommon.pm
 ${P5SITE}/Apache/TestCommonPost.pm
 ${P5SITE}/Apache/TestConfig.pm
[EMAIL PROTECTED] ${P5SITE}/Apache/TestConfig.pm.orig
 ${P5SITE}/Apache/TestConfigC.pm
+${P5SITE}/Apache/TestConfigData.pm
 ${P5SITE}/Apache/TestConfigPHP.pm
 ${P5SITE}/Apache/TestConfigParrot.pm
 ${P5SITE}/Apache/TestConfigParse.pm
@@ -22,11 +24,13 @@ ${P5SITE}/Apache/TestReport.pm
 ${P5SITE}/Apache/TestReportPerl.pm
 ${P5SITE}/Apache/TestRequest.pm
 ${P5SITE}/Apache/TestRun.pm
[EMAIL PROTECTED] ${P5SITE}/Apache/TestRun.pm.orig
 ${P5SITE}/Apache/TestRunPHP.pm
 ${P5SITE}/Apache/TestRunParrot.pm
 ${P5SITE}/Apache/TestRunPerl.pm
 ${P5SITE}/Apache/TestSSLCA.pm
 ${P5SITE}/Apache/TestServer.pm
[EMAIL PROTECTED] ${P5SITE}/Apache/TestServer.pm.orig
 ${P5SITE}/Apache/TestSmoke.pm
 ${P5SITE}/Apache/TestSmokePerl.pm
 ${P5SITE}/Apache/TestSort.pm
@@ -36,6 +40,7 @@ ${P5SITE}/Bundle/
 ${P5SITE}/Bundle/ApacheTest.pm
 @man man/man3p/Apache::Test.3p
 @man man/man3p/Apache::TestConfig.3p
[EMAIL PROTECTED] man/man3p/Apache::TestConfigData.3p
 @man man/man3p/Apache::TestMB.3p
 @man man/man3p/Apache::TestMM.3p
 @man man/man3p/Apache::TestReport.3p

Reply via email to