Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CPAN-Reporter CPAN distribution.

Report information
The Basics
Id: 31081
Status: resolved
Priority: 0/
Queue: CPAN-Reporter

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.06
Fixed in: (no value)

Attachments
0001-fix-for-RT-31081-cut-test-report-in-the-middle-if-to.patch



Subject: Keep last lines of test report when truncating
Download (untitled) / with headers
text/plain 414b
It would be nice if the last n kilobytes (or last n lines) of the test report would be preserved in siuations when the whole report grows over the 50 kilobyte limit. In most cases there is valuable information in these last lines, i.e. the test summary. (I just looked at http://www.nntp.perl.org/group/perl.cpan.testers/2007/11/msg738442.html and did not find the cause of the failure here) Regards, Slaven
Download (untitled) / with headers
text/plain 525b
On Thu Nov 29 14:29:35 2007, SREZIC wrote: Show quoted text
> It would be nice if the last n kilobytes (or last n lines) of the test > report would be preserved in siuations when the whole report grows over > the 50 kilobyte limit. In most cases there is valuable information in > these last lines, i.e. the test summary. (I just looked at > http://www.nntp.perl.org/group/perl.cpan.testers/2007/11/msg738442.html > and did not find the cause of the failure here) >
Attached a patch with a solution for this problem. Regards, Slaven
Subject: 0001-fix-for-RT-31081-cut-test-report-in-the-middle-if-to.patch
From 364505353caff3938b15a30647d8967dbab66767 Mon Sep 17 00:00:00 2001 From: Slaven Rezic <slaven@rezic.de> Date: Sat, 6 Feb 2010 21:05:09 +0100 Subject: [PATCH] fix for RT #31081: cut test report in the middle if too large --- lib/CPAN/Reporter.pm | 5 +++-- t/Helper.pm | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/CPAN/Reporter.pm b/lib/CPAN/Reporter.pm index c1b75eb..dfa8d30 100644 --- a/lib/CPAN/Reporter.pm +++ b/lib/CPAN/Reporter.pm @@ -1049,9 +1049,10 @@ sub _report_text { my $data = shift; my $test_log = join(q{},@{$data->{output}}); if ( length $test_log > MAX_OUTPUT_LENGTH ) { - $test_log = substr( $test_log, 0, MAX_OUTPUT_LENGTH) . "\n"; my $max_k = int(MAX_OUTPUT_LENGTH/1000) . "K"; - $test_log .= "\n[Output truncated after $max_k]\n\n"; + $test_log = substr( $test_log, 0, int(MAX_OUTPUT_LENGTH/2)) . "\n" + . "\n[Output cut because it's larger than $max_k]\n\n" + . substr( $test_log, -int(MAX_OUTPUT_LENGTH/2)) . "\n"; } # Flag automated report my $default_comment = $ENV{AUTOMATED_TESTING} diff --git a/t/Helper.pm b/t/Helper.pm index 8518afc..0684edc 100644 --- a/t/Helper.pm +++ b/t/Helper.pm @@ -563,10 +563,11 @@ sub test_report { my $length_error = q{}; my $max_in_k = int($max_report_length / 1000) . "K"; if ( $found_test_output =~ m/ - ^(.+)\n # test output ending in a newline + ^(.+?)\n # test output ending in a newline ^\n # blank line - ^(\[[^\n]+\]) \n # stuff in brackets + ^(\[Output\scut\sbecause\sit's\slarger\sthan\s[^\n]+\]) \n # stuff in brackets ^\n # blank line + ^(.+)\n \z /xms ) { @@ -575,7 +576,7 @@ sub test_report { } if ( length $joined_output > $max_report_length ) { - is( $length_error, "[Output truncated after $max_in_k]", + is( $length_error, "[Output cut because it's larger than $max_in_k]", "$label truncated length error message correct" ) } @@ -593,7 +594,9 @@ sub test_report { # confirm that we indeed got the test output we expected # (whether all or just a truncated portion) if ( length $joined_output > $max_report_length ) { - $joined_output = substr( $joined_output, 0, $max_report_length ); + $joined_output = substr( $joined_output, 0, int($max_report_length/2) ) . "\n" + . "\n[Output cut because it's larger than $max_in_k]\n\n" + . substr( $joined_output, -int($max_report_length/2)) . "\n"; } like( $t::Helper::sent_report, '/' . quotemeta($joined_output) . '/ms', -- 1.6.4.3


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.