You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Graham TerMarsch <mo...@howlingfrog.com> on 2007/09/26 18:58:10 UTC

Q: Build.PL/Makefile.PL, and CPAN testers...

Wanted to ping the list about something that's irked me the last few days...

After recently releasing Apache2::Filter::Minifier::JavaScript/CSS, I saw 
several failed CPAN testers reports, generally due to the tester not having 
the required modules on their machine.

Now, admittedly these are likely -automated- tests running -unattended-, but a 
failure is still a failure, and I'd like to get it fixed up and passing on as 
many machines as possible.

So... to accommodate those who didn't have Module::Build installed, I set up a 
basic Makefile.PL, following the general guidelines from Apache::Test.  
Unfortunately, most testers borked this one too as if they don't have 
Apache::Test installed they can't even fire up the Makefile.PL.  Doh!

Wanted to ping others, though, and see what you guys are doing with regards to 
trying to make sure that you get as few CPAN testers failures as possible.  
Obviously I can't prevent -all- of the failures, but I'd like to reduce them 
wherever possible.

My current test/devel versions of Build.PL/Makefile.PL are below.  I'd 
appreciate comments/feedback...

Build.PL
	use 5.008;
	use strict;
	use warnings;
	use Module::Build;
	my $build_pkg = eval { require Apache::TestMB }
		? 'Apache::TestMB'
		: 'Module::Build';
	$build_pkg->new(
		...
		build_requires => {
			'Apache::Test' => 1.12,
			},
		requires => {
			...
			'mod_perl2' => 2.0,
			},
		)->create_build_script();

Makefile.PL
	use 5.008;
	use strict;
	use warnings;
	use ExtUtils::MakeMaker;
	eval {
		# load MP2 build modules
		require ModPerl::MM;
		require Apache::TestMM;
		require Apache::TestRunPerl;
		# import test driver
		Apache::TestMM->import(qw( test clean );
		# configure tests based on incoming args
		Apache::TestMM::filter_args();
		# create test harness
		Apache::TestRunPerl->generate_script();
	};
	my $mm = $@ ? \&WriteMakefile : \&ModPerl::MM::WriteMakefile;
	$mm->(
		...
		'PREREQ_PM' => {
			'Apache::Test' => 1.12,
			'mod_perl2' => 2.0,
			...
			},
		);

-- 
Graham TerMarsch

Re: Q: Build.PL/Makefile.PL, and CPAN testers...

Posted by Andy Armstrong <an...@hexten.net>.
On 26 Sep 2007, at 17:58, Graham TerMarsch wrote:
> Wanted to ping others, though, and see what you guys are doing with  
> regards to
> trying to make sure that you get as few CPAN testers failures as  
> possible.
> Obviously I can't prevent -all- of the failures, but I'd like to  
> reduce them
> wherever possible.

This is a good question. It might be worth posting it to the CPAN  
testers discussion list and / or the perl-qa list.

cpan-testers-discuss-subscribe@perl.org
perl-qa-subscribe@perl.org

CPAN testers in particular will be interested in avoiding false  
positives. I don't believe this is a mod_perl specific problem.

(and no, I don't have an answer I'm afraid :)

-- 
Andy Armstrong, hexten.net


Re: Q: Build.PL/Makefile.PL, and CPAN testers...

Posted by Graham TerMarsch <mo...@howlingfrog.com>.
On Wednesday 26 September 2007 12:23 pm, Geoffrey Young wrote:
> sorry, I got a private copy of this email and responded to that instead
> of on list :)
>
> in the end, what graham seemed to want was a variant of this:
>
>   http://search.cpan.org/src/GEOFF/Apache-Clean-0.05/Makefile.PL
>
> which simply skips over the test phase if $testing_infrastructure_module
> isn't available.  in this example I want Apache::Test, but I've also
> used it to scan for $version of Test::Builder or whatever.  outside of
> test infrastructure modules, you can/ought to handle other dependencies
> in the test files themselves.
>
> graham's module has the additional overhead of using ModPerl::MM to make
> the basic WriteMakfile() call, for which he has a solution I'll let him
> share :)  but most modules don't suffer from that.

I've had another look at what I thought I needed ModPerl::MM for, and have 
decided that I -don't- actually need it; I've got a pure-Perl module and 
don't need any of the additional add-ins that MP::MM gives (they all appear 
to be relevant if I had any XS code, but I don't).

What I've decided to do here, in order to satisfy what I think is the widest 
do-able range of test environments is:

1. Provide a Build.PL which uses "Apache::TestMB" if its available.  I provide 
this as M::B lets me easily specify "Apache::Test" as a -build- prerequisite 
and not an actual -install- prerequisite.  And, uh, because the rest of my 
toolchain uses M::B too. :)

2. Provide a Makefile.PL which uses a variant of what Geoffrey pointed out 
above in Apache::Clean.  I provide a custom "MY::test()" method which checks 
to see if Apache::Test is installed, and uses it if it is.  If its -not- 
installed, I spit out a warning and pass-through to the default EU::MM tests.  
I provide this so that people without M::B can build/install too.

3. Update the test suites themselves so they -each- check to see if 
Apache::Test is installed and available.  If not, they "skip_all" tests.  I 
did this so that it becomes really obvious to anyone reading the output that 
there -WERE- other tests that could have been run, but that their system 
didn't meet the test requirements.

----------------------------------------------------------------------

Using the above, I've got "successful" (for whatever you'd like that to mean) 
test runs in the following environments:

a) EU::MM, no A::T.  Skips all tests.

b) EU::MM, has A::T.  Runs tests successfully.

c) M::B, no A::T.  Skips all tests.

d) M::B, has A::T.  Runs tests successfully.

and, for (a) and (c) above, when Apache::Test isn't present, you at least get 
some notification that you're missing something in your environment and that 
things -aren't- going to run as expected.  If the user chooses to ignore the 
warnings then that's their business, but for automated testbots this should 
work a bit better.

----------------------------------------------------------------------

Now... before I package this all up and roll a new release of this stuff, does 
anyone see any problems with the above and how its handling results in the 
various scenarios?

-- 
Graham TerMarsch

Re: Q: Build.PL/Makefile.PL, and CPAN testers...

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Fred Moyer wrote:
> Graham TerMarsch wrote:
>> Wanted to ping the list about something that's irked me the last few
>> days...
>>
>> After recently releasing Apache2::Filter::Minifier::JavaScript/CSS, I
>> saw several failed CPAN testers reports, generally due to the tester
>> not having the required modules on their machine.
> 
> I can't speak too well to the Module::Build problems, but I learned a
> great deal from following Geoff's lead on some of his modules.  Take a
> look at:
> 
> http://search.cpan.org/src/GEOFF/WebService-CaptchasDotNet-0.06/Makefile.PL
> 
> for a good example of how to handle whether or not Apache::Test is
> present.  If Apache::Test isn't present, then the tests don't run, which
> is what you want.  The philosophy there is that you can still install
> the module if you don't have the dependencies required for the test,
> which is an issue sometimes (production environments for example).
> 
> Geoff can speak to this problem a lot better than I can, everything I
> know about this stuff I owe him for responding to my pestering when I
> was making Apache::Dispatch mp2 compatible.

sorry, I got a private copy of this email and responded to that instead
of on list :)

in the end, what graham seemed to want was a variant of this:

  http://search.cpan.org/src/GEOFF/Apache-Clean-0.05/Makefile.PL

which simply skips over the test phase if $testing_infrastructure_module
isn't available.  in this example I want Apache::Test, but I've also
used it to scan for $version of Test::Builder or whatever.  outside of
test infrastructure modules, you can/ought to handle other dependencies
in the test files themselves.

graham's module has the additional overhead of using ModPerl::MM to make
the basic WriteMakfile() call, for which he has a solution I'll let him
share :)  but most modules don't suffer from that.

--Geoff

Re: Q: Build.PL/Makefile.PL, and CPAN testers...

Posted by Fred Moyer <fr...@redhotpenguin.com>.
Graham TerMarsch wrote:
> Wanted to ping the list about something that's irked me the last few days...
> 
> After recently releasing Apache2::Filter::Minifier::JavaScript/CSS, I saw 
> several failed CPAN testers reports, generally due to the tester not having 
> the required modules on their machine.

I can't speak too well to the Module::Build problems, but I learned a 
great deal from following Geoff's lead on some of his modules.  Take a 
look at:

http://search.cpan.org/src/GEOFF/WebService-CaptchasDotNet-0.06/Makefile.PL

for a good example of how to handle whether or not Apache::Test is 
present.  If Apache::Test isn't present, then the tests don't run, which 
is what you want.  The philosophy there is that you can still install 
the module if you don't have the dependencies required for the test, 
which is an issue sometimes (production environments for example).

Geoff can speak to this problem a lot better than I can, everything I 
know about this stuff I owe him for responding to my pestering when I 
was making Apache::Dispatch mp2 compatible.

HTH

Re: Q: Build.PL/Makefile.PL, and CPAN testers...

Posted by Graham TerMarsch <mo...@howlingfrog.com>.
On Wednesday 26 September 2007 9:58 am, Graham TerMarsch wrote:
> After recently releasing Apache2::Filter::Minifier::JavaScript/CSS, I saw
> several failed CPAN testers reports, generally due to the tester not having
> the required modules on their machine.
>
> Now, admittedly these are likely -automated- tests running -unattended-,
> but a failure is still a failure, and I'd like to get it fixed up and
> passing on as many machines as possible.

Wanted to fire a note back to say that I think I've found a short and viable 
solution here for my problem... :)

I ping'd the guys over on the "perl-qa" and "cpan-testers" lists to see what 
sort of input they could provide on it.  cpan-testers didn't provide any 
response, but several people on perl-qa piped in with some useful 
information.

What I learned from the guys on perl-qa was:

1) I'm not the only one who feels that CPANPLUS generates false "failure" 
reports, when the build/test environment is missing prereqs.

2) EU::MM sucks when it comes to having to deal with things that are required 
at -configuration- time.  There is discussion for adding "configure_requires" 
to Module::Build to help address this scenario, but not EU::MM.  Gee, isn't 
this part of why I had a Build.PL but no Makefile.PL in the first place?

3) Both CPAN/CPANPLUS behave such that if you list a "PREREQ_PM" in 
Makefile.PL that's missing and they have to go out and install it, 
they -don't- re-run "perl Makefile.PL" again.  I'm sure this is widely known, 
but its worth mentioning again as this is what makes it particularly hard to 
depend on things that you need -when- "perl Makefile.PL" is run.  It never 
gets re-run after the dependencies are installed, and you've got a half-baked 
build.

(and now, for the big winner...)

4) If you "exit 0" -before- generating the Makefile, CPAN/CPANPLUS stop the 
build/test process, but -DON'T- consider it a failure that'd constitute 
sending a CPAN Testers report.  I've verified the CPANPLUS behaviour locally, 
and am told that CPAN also exhibits this behaviour.

----------------------------------------------------------------------

What this means, though, is that I can now set up a Makefile.PL that checks to 
see if Apache::Test is installed, and then spit out a warning and "exit 0" 
before the Makefile is written.  People running the build manually will see 
why its not working, and automated test bots will stop filing false "failure" 
reports.

I'll try to get updated releases out today, and we'll see what the CPAN 
Testers reports look like tomorrow...

-- 
Graham TerMarsch
Howling Frog Internet Development, Inc.