of interest to people who use Apache-Test
to test their Apache::
modules...
if you use TestRunPerl
to configure your tests (as you should) but the end-user of your module configures Apache-Test
with a non-mod_perl-enabled Apache, the test suite will blow up before it ever starts, due to the presense of mod_perl specific directives (such as PerlRequire
).
the current CVS version helps to protect you from this by making sure that the default httpd.conf
does not keep your tests from running - the server will now start, leaving it up to you to decide whether your tests pass or fail.
so, now that the server starts but mod_perl isn't guaranteed to be available, here are your options:
- keep the mod_perl-specific direcitves in your extra.conf.in
and your test suite keeps blowing up (same as before). if you want to let the test suite (and not your tests) decide whether make test
fails due to your test environemt, this is currently your only option. personally, I consider this a bad programming practice; only the tests ought to decide whether make test
is successful. I know of others that disagree, though.
- if you don't want the server to blow up, protect your extra.conf.in
with <IfModule mod_perl.c>
, which will allow the server to start, even if mod_perl isn't available. then
- use plan tests => $tests, have_module('mod_perl.c');
in each test where mod_perl is required, similar to the way you (should be) using have_module('mod_cgi')
to skip over tests where mod_cgi is required. or
- use ok (have_module('mod_perl.c'));
or some form of die
if you want the tests to fail due to an improperly configured test environment.
oh, and for those paying attention, it'shave_module('mod_perl.c')
and nothave_module('mod_perl')
as the latter will return true for mod_perl 1.0 installations where mod_perl.pm
is present, which probably isn't what you want.
Thanks for the suggestions, Geoff. I've now made these changes for my MasonX::Interp::WithCallback module. However, when I test it against an Apache without mod_perl, it still chokes on:
PerlPassEnv APACHE_TEST_TRACE_LEVEL
PerlRequire/Users/david/dev/perl/MasonX-Interp-WithCallbacks/t/conf/modperl_startup.pl
I assume that's because Apache::Test 1.04 isn't fixed for this issue, yes? Apache::Test 1.05 I assume will fix it.
Cheers,
Davied
Re:Still Chokes
geoff on 2003-10-08T22:40:46
yup, 1.04 breaks - the changes were just added to CVS a day or so ago (as was removinghttpd -X
as mentioned in another recent journal) and ought to be in 1.05.