Skip Menu |

This queue is for tickets about the Apache-Test CPAN distribution.

Report information
The Basics
Id: 64934
Status: resolved
Priority: 0/
Queue: Apache-Test

People
Owner: Nobody in particular
Requestors: B.Candler [...] pobox.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.34
Fixed in: (no value)



Subject: 'make test' fails as root
The version of Apache::TestRun provided by Apache::Test in CPAN fails if run as root: if ($user eq 'root') { error "Apache cannot spawn child processes as root, therefore the test suite must be run as a non-privileged user."; exit_perl(0); } However the Apache::TestRun in mod_perl-2.0.4 is more forgiving. It will try to run the test as a non-root user, and if it cannot (because directory permissions are wrong) it will skip the test. The new behaviour causes the following problem for me. When installing Netdot (netdot.uoregon.edu), there's a script to install all the dependencies, which must be run as root: # make installdeps-apt-get This does some apt-get's to pull in some packages, then uses CPAN to pull in additional perl modules. However it fails to install Apache2::AuthCookie; that module has a dependency on Apache::Test Show quoted text
>=1.32, and so I get the newer Apache::Test instead of the one from
mod_perl2. See https://rt.cpan.org/Public/Bug/Display.html?id=64933 for a transcript. Then it also fails to install Apache2::SiteControl because that in turn depends on the failed Apache2::AuthCookie. Would it be possible to make Apache::TestRun succeed silently if run as root? If not, what's the recommended way to make packages which depend on Apache::TestRun install successfully when cpan is run as root? Thanks, Brian.
Hi Brian, On Wed Jan 19 16:46:06 2011, B.Candler@pobox.com wrote: Show quoted text
> The version of Apache::TestRun provided by Apache::Test in CPAN fails if > run as root: > > if ($user eq 'root') { > error "Apache cannot spawn child processes as root, therefore > the test suite must be run as a non-privileged user."; > exit_perl(0); > } > > However the Apache::TestRun in mod_perl-2.0.4 is more forgiving. It will > try to run the test as a non-root user, and if it cannot (because > directory permissions are wrong) it will skip the test.
The latest version of Apache-Test will skip the tests if built as root also. Show quoted text
> The new behaviour causes the following problem for me. When installing > Netdot (netdot.uoregon.edu), there's a script to install all the > dependencies, which must be run as root: > > # make installdeps-apt-get > > This does some apt-get's to pull in some packages, then uses CPAN to > pull in additional perl modules. However it fails to install > Apache2::AuthCookie; that module has a dependency on Apache::Test
> >=1.32, and so I get the newer Apache::Test instead of the one from
> mod_perl2. See https://rt.cpan.org/Public/Bug/Display.html?id=64933 for > a transcript.
I see the dilemma here. Technically Apache::Test should not be a prerequisite - the tests should just be skipped if Apache::Test is not present. If you take a look here you'll see the recommended way of making Apache::Test a dependency - http://cpansearch.perl.org/src/PHRED/Apache2-Dispatch-0.15/Makefile.PL The Makefile.PL overrides the make test target if Apache::Test is not present. $HAS_APACHE_TEST is determined using Apache::Bootstrap. I'd suggest sending a patch to Apache2::AuthCookie which removes Apache::Test as a prerequisite, and instead uses something like this so that it skips the tests if Apache::Test isn't present. Hope that helps. sub test { my $self = shift; eval { require Test::More } or return <<EOF; test:: \t\@echo sorry, cannot run tests without Test::More EOF return $self->Apache::TestMM::test(@_) if $HAS_APACHE_TEST; return <<EOF test:: \t\@echo \t\@echo sorry, cannot run tests without a properly \t\@echo configured Apache-Test environment \t\@echo EOF }
Subject: Re: [rt.cpan.org #64934] 'make test' fails as root
Date: Thu, 20 Jan 2011 09:56:04 +0000
To: via RT <bug-Apache-Test [...] rt.cpan.org>
From: Brian Candler <B.Candler [...] pobox.com>
On Wed, Jan 19, 2011 at 05:03:02PM -0500, via RT wrote: Show quoted text
> The latest version of Apache-Test will skip the tests if built as root also.
Thank you. CPAN had pulled in 1.34; I'll check for a newer one. Show quoted text
> I'd suggest sending a patch to > Apache2::AuthCookie which removes Apache::Test as a prerequisite, and instead uses > something like this so that it skips the tests if Apache::Test isn't present.
Unfortunately, it's always likely to be present, because Apache::Test 1.31 comes bundled with mod_perl2 (at least in the Ubuntu package libapache2-mod-perl2). However, the bundled version causes some other problems, so the author of Apache2::AuthCookie decided to depend on a more recent version. Details in ticket #64933 Anyway, he's decided to fix the problem by not running the tests at all if running as root. Thanks again for your rapid reply. Regards, Brian.
I've spoken with the Apache::AuthCookie library maintainer, and the issue was resolved in the most recent release of Apache::Test.