Re: [Apache-dispatch-devel] Fwd: SF.net SVN: apache-dispatch: [50]trunk
Brought to you by:
geoffrey_young,
phred_moyer
|
From: Geoffrey Y. <ge...@mo...> - 2006-08-09 13:50:13
|
Fred Moyer wrote: >>>just this one last nit. >> >>hmph, sounds like import() is up to something funky. >> >>maybe just fully qualify Apache::TestRequest::GET_OK($url) in the code? >> > > > Indeed. Same thing happens with a fully qualified call. Should I cc this to the Apache::Test list? I don't think so quite yet... I think I see a few things that could be contributing. first of all, the results of the Makefile.PL are odd when A-T isn't present - it spits out "sorry, can't run tests" _and_ runs the tests. we need to decide what we'll be requiring :) WS::CDN has both apache and non-apache tests, so I wanted to run _some_ of the tests no matter what, but configure and run the apache tests if A-T was properly set up. we probably only want to run tests if o A-T is configured o apache has mod_perl configured to that end I think we need a patch like the one attached. so, ok, that solves the first point above - we've made sure that we aren't running tests unless A-T is present and we know which httpd binary to use. and we've enforced Test::More is present, which is helpful because... now we have a few more problems to handle gracefully. first, we need to make sure that our enabled httpd has mod_perl available to it - if it doesn't then we can't run our tests at all. but to find out httpd needs to be fully configured, which doesn't happen until we actually run 'make test'. the solution to this little problem is all.t, a special test file with magical properties. yum :) so, all.t would look something like this http://search.cpan.org/src/GEOFF/Apache-SSLLookup-2.00_04/t/live/all.t except we would be checking for plan tests => 1, need_module('mod_perl.c'); so the call to vars() isn't required. this prevents us from trying to run tests if mod_perl isn't installed. but we're not finished yet. you see, just because we won't run the tests doesn't mean that httpd won't start up... and when it does and doesn't find mod_perl then httpd.conf will blow up because extra.last.conf.in contains directives it can't parse. so... you _also_ need to protect all of extra.last.conf.in in <IfModule> statements such that if we have httpd without mod_perl httpd still starts, so we can then run all.t, which will then skip over our tests. apache will then shut down. yeah, I know, but it's just the way things work. so, putting all that in place means you don't actually need to protect individual test files like you're doing below. but I think the problem you originally reported would be fixed like this: > ---------------------------- > use strict; > use warnings FATAL => 'all';a > > use Test::More; take this out. > > require Apache::Test; > Apache::Test->import(qw(have_lwp)); substitute these for use Apache::Test qw(:withtestmore); which use()s Test::More for you and does the magic required for both to coexist. note the difference between :withtestmore and -withtestmore the simple import form (:) is fine for *.t clients (like this one) while the action form (-) is a requirement for *.pm server side tests because it adds (yet more) magic. anyway, I hope this helps clear things up a bit. I'm happy to work on and commit things, but I didn't want to step on your work. --Geoff |