I re-read
Parallel maintenance on many projects, part II: The Testing and decided to try something similar for some of the modules I've been working with (both CPAN and not). Unlike
brian_d_foy, I wanted to use
Test::Harness::Straps from the get-go. Just to be different. :-)
Starting with the code Schwern posted (that brian_d_foy links to), I modified it slightly to run through all the tests in a given t/, as so:
use strict;
use warnings;
use Test::Harness::Straps;
my $tester = Test::Harness::Straps->new;
use lib 'blib';
my @failures;
foreach my $file (<t/*.t>) {
local *STDERR;
my %results = $tester->analyze_file( $file );
push @failures, $file unless $results{passing};
}
if (@failures) {
print scalar(@failures), " files failed.\n";
local $"=$/;
print "@failures\n";
}
else {
print "All tests succeeded.\n";
}
When all the tests pass, I get a nice "All tests succeeded." message. But, when the tests fail, especially due to a module that doesn't compile, a bunch of messages appear on STDERR and local *STDERR; doesn't fix that. Turns out it's cause the test file is being run in a sub-process.
- Is there some way I can stop that without having to patch Test::Harness::Straps to add 2>/dev/null to the end of the command it runs (as seen from the _command_line() method)?
- If that is the only solution, what's a good patch so that it will run on Mac, VMS, and Win32? I don't think Andy will accept a *nix-only patch ...
Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.