On Tuesday 17 January 2012, Graham Leggett wrote:
> # verifying that logged content is 256 characters
> ok 51
> # posted content (length 1024) to bogus-perl.pl
> # got return code of: 500, expecting: 500
> ok 52
> # verifying log did not increase in size...
> ok 53
> # verifying log is greater than 8192 bytes.
> ok 54
> # verifying log did not grow after making bogus request.
> ok 55
> # verifying log did not grow after making another bogus request.
> ok 56
> # checking that HEAD /modules/cgi/perl.pl returns 200.
> ok 57
> Failed 1/58 subtests
> 
> Test Summary Report
> -------------------
> t/modules/cgi.t (Wstat: 0 Tests: 57 Failed: 0)
>   Parse errors: Bad plan.  You planned 58 tests but ran 57.
> Files=1, Tests=57, 22 wallclock secs ( 0.27 usr  0.22 sys +  3.06
> cusr  5.35 csys =  8.90 CPU) Result: FAIL
> Failed 1/1 test programs. 0/57 subtests failed.
> 
> Regards,
> Graham
> --

The diff to a PASS run starts with:

 # posted content (length 1024) to bogus-perl.pl
 # got return code of: 500, expecting: 500
 ok 52
-# checking that log size (5115) is greater than 4516
+# verifying log did not increase in size...
 ok 53
-# verifying that logged content is 256 characters
-ok 54
 # verifying log is greater than 8192 bytes.
-ok 55
+ok 54

It's certainly a bug in the test that the number of "ok"s differs in 
different code paths. Can you try if the attached diff gives better 
debug output with -v?

Index: t/modules/cgi.t
===================================================================
--- t/modules/cgi.t	(Revision 1232562)
+++ t/modules/cgi.t	(Arbeitskopie)
@@ -204,17 +204,23 @@
         ## characters logged from the post content
         open (LOG, $cgi_log) or die "died opening cgi log: $!";
         my $multiplier = 256;
-        while (<LOG>) {
-            if (/^$content+$/) {
-                chomp;
-                $multiplier = $length unless $length > $multiplier;
-                print "# verifying that logged content is $multiplier characters\n";
-                ok ($_ eq "$content"x$multiplier);
-                last;
-            }
+        my $log;
+        {
+            local $/;
+            $log = <LOG>;
         }
         close (LOG);
-
+        $multiplier = $length unless $length > $multiplier;
+        print "# verifying that logged content is $multiplier characters\n";
+        if ($log =~ /^(?:$content){$multiplier}\n?$/m) {
+            ok 1;
+        }
+        else {
+            $log =~ s{^}{# }m;
+            print "# no log line found with $multiplier '$content' characters\n";
+            print "# log is:\n'$log'\n";
+            ok 0;
+        }
     } else {
         ## log does not exist ##
         print "# cgi log does not exist, test fails.\n";

Reply via email to