5.8.1 recently started failing 2 tests in op/cproto.t, on pop(), shift();


this only happens on one box, ie RH-7.2, not RH-9, and I havent tried
a make distclean, so I havent reported it to p5p.

Instead I decided that some false laziness was in order, and I should go digging.
But, I thought it would be handy to run only those 2 tests, ie:


[EMAIL PROTECTED] t]$ ./perl op/cproto.t 130 178

which when run, gives:

....(debugging elided)
1..234
not ok 130 - pop
#     Failed test (../lib/Test/More.pm at line 332)
not ok 178 - shift
#     Failed test (../lib/Test/More.pm at line 332)
WHOA!  Somehow you got a different number of results than tests ran!
This should never happen!  Please contact the author immediately!
END failed--call queue aborted, <DATA> line 234.


I did this by hacking horribly on Test::Builder so that it


1. reads @ARGV to know what test numbers to run. (130, 178 above)
*yes, action at a distance*, but it allows Test::More users to get selective,
nominally w/o breaking tests
( not quite - failures now 11, not 2, using the patch)


2. skips tests that arent in @ARGV, if @ARGV;

3. <contrite sincerity='low' ulterior-motive='flame-retardance'>
I moved the is_*() functions into a subclass, then either package-aliased them
or eval'd a new baseclass function which conditionally calls the sub-class one.
It should be faster than just wrapping funcs with conditionals, and felt less like
cut-paste programming...
Interestingly, I had to clone the BEGIN {require threads} block into the sub-class
package too.
also, I used our $Level, from 5.6, cuz it fixed localization probs between base and subclass.
</contrite>


Im certain the implementation is *unsuitable*, but Id like to advocate some
cmdline option which would allow constraining the test-list to the 'interesting' ones.
It could be helpful when using debugger on tests (ive had issues with stepping thru
<DATA> sets in the past (charnames,iirc), though not with this test)


./perl op/cproto.t -testonly=130,178

Anyway, patch is attached for your amusement

--jimc

ps. make distclean would have been quicker ;-)
30,31c30
< #use vars qw($Level);
< our $Level;
---
> use vars qw($Level);
278,292d276
< package Test::Builder::Funcs;
< 
< BEGIN {
<     use Config;
<     if( $] >= 5.008 && $Config{useithreads} ) {
<         require threads;
<         require threads::shared;
<         threads::shared->import;
<     }
<     else {
<         *share = sub { 0 };
<         *lock  = sub { 0 };
<     }
< }
< 
384d367
<     #$Level = $Test::Builder::Level + 1;
401d383
<     #local $Level = $Test::Builder::Level + 1;
460d441
<     # local $Level = $Test::Builder::Level + 1;
477d457
<     #    local $Level = $Test::Builder::Level + 1;
515d494
<     # local $Level = $Test::Builder::Level + 1;
521a501
>     local $Level = $Level + 1;
570d549
<     # local $Level = $Test::Builder::Level + 1;
621d599
<     # local $Level = $Test::Builder::Level + 1;
646,688d623
< 
< our @TestOnly = @ARGV;
< 
< package Test::Builder;
< 
< { # unless (@ARGV) {
<     # no test-list args given, run all tests normally.
<     # basically, we'll insure that above sub-class functions are 'exported' up
<     no strict 'refs', 'subs';
<     foreach my $sub (keys %Test::Builder::Funcs::) {
<       next unless *{'Test::Builder::Funcs::'.$sub}{CODE};
<       unless (@TestOnly) {
<           print "Funcs::$sub\n";
<           *{'Test::Builder::'.$sub} = *{'Test::Builder::Funcs::'.$sub}{CODE};
<       } else {
<           next if *{'Test::Builder::'.$sub}{CODE};
<           my $proto = prototype('Test::Builder::Funcs::'.$sub);
<           print __PACKAGE__, "::$sub ($proto)\n";
<           my $code = qq{
<               #share (\$Curr_Test);
<               sub $sub { 
<                   unless (grep {\$_ == \$Curr_Test+1} [EMAIL PROTECTED]) {
<                       print "ok - skipping \$Curr_Test per cmdln args\\n";
<                       \$Curr_Test++;
<                       return 1;
<                   }
<                   goto &{Test::Builder::Funcs::$sub};
<               };
<             };
<             print "compiling: $code\n";
<             eval "$code";
<             warn $@ if $@;
<       }
<     }
<     # check it
<     foreach my $sub (keys %Test::Builder::) {
<       next unless *{'Test::Builder::Funcs::'.$sub}{CODE};
<       next unless *{'Test::Builder::'.$sub}{CODE};
<       print "defined $sub\n";
< 
<     }
< }
< 

Reply via email to