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

Reply via email to