new Apache::Test tracing functionality
Here is a quick heads up on the extended Apache::TestTrace functionality: 1) you can now use Apache::TestTrace tracing functions in the mod_perl handlers, replacing those warn calls that you have to remember to comment out before committing. The default tracing level is 'info', so if you use: debug this is a debug string it won't log anything, unless you override it via one of these ways: # override tracing level via -trace opt % t/TEST -trace=debug # override tracing level via env var % env APACHE_TEST_TRACE_LEVEL=debug t/TEST The cool thing is that you can keep those calls uncommented, and if a user reports a problem, you can simply ask them to run the specific tests using the 'debug' trace level (see above) and post the relevant section of error_log. You also don't need to add \n; This wasn't working before because the tracing level wasn't propogated to the server-side. Now I added 'PerlPassEnv APACHE_TEST_TRACE_LEVEL' to the autogenerated t/conf/httpd.conf to pick the override. 2) I've added two more macros for each of those tracing functions: If the '_mark' suffix is appended (e.g., 'error_mark') the trace will start with the filename and the line number the function was called from. For example: error_mark bad programmer, no cookie; Will print something like: == /home/stas/apache.org/mp-filters/t/filter/TestFilter/both_str_req_mix.pm:90 : bad programmer, no cookie This is similar to calling warn() without the \n, so it logs the filename/line number, but you can control the tracing level from the command line, without touching the code. I've used _mark, in parallel with Apache::LOG_MARK. If the '_sub' suffix is appended (e.g., 'error_info') the trace will start with the name of the subroutine the function was called from. For example: error_sub bad programmer, no cookie; Will print something like: == TestFilter::both_str_req_mix::adjust : bad programmer, no cookie Now that I think about it, may be it's better to append the sub name, file/line info at the end of the trace like warn/die do, instead of the beginning? What do you think? __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: resolving Apache::Test vs. Apache::test collision
Stas Bekman wrote: Geoffrey Young wrote: I actually like Apache::TestPlan, it's most of the functionality that this module provides. but there are a few subs that are not. May be this other functionality should move elsewhere. given that almost all of the functions from the various Test* packages are exported by default and almost nobody specifies an import list currently with Apache::Test, I wouldn't worry too much about shuffling stuff around later after the immediate problem has been fixed. This is what I see now as the simplest solution at all fronts: 1) keep the distro name Apache-Test. 2) s|Apache/Test.pm|Apache/TestPlan.pm| 3) contents of Apache/TestPlan.pm: package Apache::Test; $Apache::Test::VERSION = '1.02'; package Apache::TestPlan; # what was previously Apache::Test code follows I decided to nevertheless plug these two lines in: package Apache::Test; $Apache::Test::VERSION = '1.02'; so that CPAN will still index Apache::Test, and we can still tell CPAN.pm to install Apache::Test, same for dependencies list. Also that's where we maintain the distro's version. Usage-wise, the only change you have to do is this: perl -pi -e 's|use Apache::Test([\s;])|use Apache::TestPlan$1|' files Is everybody happy with that solution? Unfortunately this solution won't work. If you have PREREQ_PM = {Apache::Test = 1.03}, MakeMaker is going to 'require Apache::Test' and either won't find it or will find Apache::test on case-insensitive platforms. What a bummer. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: resolving Apache::Test vs. Apache::test collision
David Wheeler wrote: On Thursday, May 8, 2003, at 05:44 PM, Stas Bekman wrote: 1) Integrate test.pm in Test.pm. I think we should bundle Apache::Test with future versions of mod_perl to make the maintenance simple and remove the original Apache::test from it. 2) Rename Apache::Test to Apache::Tester (or else) to resolve the collision. Rename the distro Apache-Test to Apache-TestHarness (or else) to avoid confusion. Looks like if we can provide a clean implementation of (1) that's would be the best solution. Randy says that it shouldn't be a problem with winFU. If David says that it's cool with MacOSX, let's try to take this route then. It's much more likely that someone would install 1.27 over an Apache::Test installation on Mac OS X than it is on Win32, apparently. But if you were to release 1.28 with the new integrated Apache::Test, it probably wouldn't be too much of a problem. You might want to post a quick query to macosx@perl.org to get a general feel from the Mac OS X Perl community. If an old mod_perl 1.0 is installed and it overrides Apache::Test, Makefile.PL will simply fail to satisfy the requirement of a specific version (because Apache::test's version is smaller than Apache::Test's). However taking again this track of overriding test.pm, we may still have a problem in the following situation: root installs mod_perl 1.27 system-wide, user installs Apache::Test locally (can't unlink Apache/test.pm), this can be a problem if user's @INC are added after the system-wide ones. But that would be silly, isn't it? If we are sticking with this track, we need to figure out the way to make sure that Apache/test.pm is nuked. David, if Apache-Test includes Apache/test.pm and Apache/Test.pm is it ensured that any other occurance of Apache/test.pm will be nuked? __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: resolving Apache::Test vs. Apache::test collision
Unfortunately this solution won't work. If you have PREREQ_PM = {Apache::Test = 1.03}, MakeMaker is going to 'require Apache::Test' and either won't find it or will find Apache::test on case-insensitive platforms. What a bummer. yes, I thought about that already as I began to revamp my distributions :) the solution, of course, is to advocate prereq'ing Apache::TestPlan = 0 - it's a bit counterintuitive, but no different than downloading libwww-perl and using a LWP::UserAgent prereq. but really, this shouldn't be much of an issue - you generally prereq module dependencies, not testing dependencies (yeah the tests will fail, but there are steps you can take within the tests to keep that from happening). and EU::MM only warns on missing prereqs anyway, so it's never failsafe :) for mp2 users you'll be able to prereq mod_perl 1.9910 and that should cover almost all cases (save a few weeks of CVS). for mp1 users eval'ing 'require Apache::TestPlan' will be sufficient, since you require() the modules anyway to avoid failing makefiles. for the others, well, altering the tests to require one or the other or requiring TestPlan will be the only way. so the main version lives in TestPlan instead of a file matching the dist name - that happens with other modules so it's not all that strange or difficult to live with. --Geoff
Re: resolving Apache::Test vs. Apache::test collision
Geoffrey Young wrote: Unfortunately this solution won't work. If you have PREREQ_PM = {Apache::Test = 1.03}, MakeMaker is going to 'require Apache::Test' and either won't find it or will find Apache::test on case-insensitive platforms. What a bummer. yes, I thought about that already as I began to revamp my distributions :) the solution, of course, is to advocate prereq'ing Apache::TestPlan = 0 - it's a bit counterintuitive, but no different than downloading libwww-perl and using a LWP::UserAgent prereq. but really, this shouldn't be much of an issue - you generally prereq module dependencies, not testing dependencies (yeah the tests will fail, but there are steps you can take within the tests to keep that from happening). and EU::MM only warns on missing prereqs anyway, so it's never failsafe :) for mp2 users you'll be able to prereq mod_perl 1.9910 and that should cover almost all cases (save a few weeks of CVS). for mp1 users eval'ing 'require Apache::TestPlan' will be sufficient, since you require() the modules anyway to avoid failing makefiles. for the others, well, altering the tests to require one or the other or requiring TestPlan will be the only way. so the main version lives in TestPlan instead of a file matching the dist name - that happens with other modules so it's not all that strange or difficult to live with. eh, no, the prereq is LWP, not LWP::UserAgent, look at LWP.pm: package LWP; $VERSION = 5.69; sub Version { $VERSION; } require 5.004; require LWP::UserAgent; # this should load everything you need 1; so libwww-perl = LWP is intuitive Apache-Test = Apache::TestPlan is not __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
whence Apache::TestLoad?
I can't get Apache-Test to compile. use Apache::TestLoad; was added by mistake in revision 1.26 without the proposed TestLoad.pm? --Geoff Index: Apache-Test/lib/Apache/TestMM.pm === RCS file: /home/cvspublic/httpd-test/perl-framework/Apache-Test/lib/Apache/TestMM.pm,v retrieving revision 1.26 diff -u -r1.26 TestMM.pm --- Apache-Test/lib/Apache/TestMM.pm14 May 2003 02:53:54 - 1.26 +++ Apache-Test/lib/Apache/TestMM.pm14 May 2003 13:04:16 - @@ -4,7 +4,6 @@ use warnings FATAL = 'all'; use Config; -use Apache::TestLoad (); use Apache::TestConfig (); use Apache::TestTrace;
Re: cvs commit: httpd-test/perl-framework/Apache-Test Changes
sorry, I didn't realize I was subscribed to this list :) use Config; +use Apache::TestLoad (); whoops :) --Geoff
Re: cvs commit: httpd-test/perl-framework/Apache-Test Changes
Geoffrey Young wrote: sorry, I didn't realize I was subscribed to this list :) use Config; +use Apache::TestLoad (); whoops :) oops indeed, thanks for the fix Geoff. I've removed it. __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com