summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2016-08-19 22:22:21 -0700
committerFather Chrysostomos <sprout@cpan.org>2016-08-19 22:25:57 -0700
commitc8fbf4a0405c1b43d860af2d332b5193efe24706 (patch)
tree253b3a04253fca058ed70a4b8e84e5990ea9dc7c
parentbc7bbd314b9de6da4e0b8bf6a3c1ced7645acc76 (diff)
downloadperl-c8fbf4a0405c1b43d860af2d332b5193efe24706.tar.gz
podcheck.t: Send helpful error output to stderr
While we do try to keep stderr clean for tests, that is for *passing* tests. If the diagnostic output goes to stdout instead, then nobody gets to see it for ‘make test’, which means that the script has to be re-run by itself just to find out what failed. Since this is a long-running test, that is quite inconvenient. Also mention which .t the output is coming from.
-rw-r--r--t/porting/podcheck.t20
1 files changed, 12 insertions, 8 deletions
diff --git a/t/porting/podcheck.t b/t/porting/podcheck.t
index f0c3990951..a6c8528865 100644
--- a/t/porting/podcheck.t
+++ b/t/porting/podcheck.t
@@ -531,16 +531,20 @@ sub suppressed {
last SKIP;
}
- sub note {
- my $message = shift;
+ sub _note {
+ my ($andle, $message) = @_;
chomp $message;
- print $message =~ s/^/# /mgr;
- print "\n";
+ print $andle $message =~ s/^/# /mgr;
+ print $andle "\n";
return;
}
+ sub note { unshift @_, \*STDOUT; goto &_note }
+
+ sub diag { unshift @_, \*STDERR; goto &_note }
+
END {
if ($planned && $planned != $current_test) {
print STDERR
@@ -2133,7 +2137,7 @@ foreach my $filename (@files) {
}
ok(@diagnostics == $thankful_diagnostics, $output);
if (@diagnostics) {
- note(join "", @diagnostics,
+ diag(join "", @diagnostics,
"See end of this test output for your options on silencing this");
}
@@ -2165,7 +2169,7 @@ if (%files_with_unknown_issues) {
: "were $were_count_files files";
my $message = <<EOF;
-HOW TO GET THIS .t TO PASS
+HOW TO GET ${\__FILE__} TO PASS
There $were_count_files that had new potential problems identified.
Some of them may be real, and some of them may be false positives because
@@ -2204,9 +2208,9 @@ EOF
and change the count of known potential problems to -1.
EOF
- note($message);
+ diag($message);
} elsif (%files_with_fixes) {
- note(<<EOF
+ diag(<<EOF
To teach this test script that the potential problems have been fixed,
$how_to
EOF