digging out the missing error message
hi all a while ago Ken Coar brought up that Apache-Test doesn't print the final test count when there are errors. that is, we currently do this: # Failed test 20 in t/apache/contentlength.t at line 54 fail #10 FAILED tests 2, 6, 10, 14, 16, 18, 20 Failed 7/20 tests, 65.00% okay Failed Test Stat Wstat Total Fail Failed List of Failed --- Failed 1/1 test scripts, 0.00% okay. 7/20 subtests failed, 65.00% okay. [warning] server localhost.localdomain:8529 shutdown instead of this # Failed test 20 in t/apache/contentlength.t at line 54 fail #10 FAILED tests 2, 6, 10, 14, 16, 18, 20 Failed 7/20 tests, 65.00% okay Failed Test Stat Wstat Total Fail Failed List of Failed --- t/apache/contentlength.t 207 35.00% 2 6 10 14 16 18 20 Failed 1/1 test scripts, 0.00% okay. 7/20 subtests failed, 65.00% okay. [warning] server localhost.localdomain:8529 shutdown note the absence of the Failed 1/1... stuff in what we have currently. well, I finally figured out why. attached is a patch that fixes the problem. however, as you can see the installed SIG{__DIE__} handler (from TestRun.pm) is keeping us from simply putting Test::Harness::runtests in an eval block. so the fix isn't really a fix until we figure out some other stuff, and it may not be fixable at all. anyone with insight into the current SIG{__DIE__} foo? it's in the ToDo as something to consider removing, but I'm not sure how easy that would be. --Geoff Index: lib/Apache/TestHarness.pm === RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestHarness.pm,v retrieving revision 1.18 diff -u -r1.18 TestHarness.pm --- lib/Apache/TestHarness.pm 4 Mar 2004 05:51:31 - 1.18 +++ lib/Apache/TestHarness.pm 5 May 2004 19:14:56 - @@ -167,7 +167,12 @@ $ENV{HTTPD_TEST_SUBTESTS} = @subtests; } -Test::Harness::runtests($self-get_tests($args, @_)); +eval { + local $SIG{__DIE__}; + Test::Harness::runtests($self-get_tests($args, @_)); +}; + +print $@ if $@; } 1;
Re: digging out the missing error message
Geoffrey Young wrote: hi all a while ago Ken Coar brought up that Apache-Test doesn't print the final test count when there are errors. that is, we currently do this: # Failed test 20 in t/apache/contentlength.t at line 54 fail #10 FAILED tests 2, 6, 10, 14, 16, 18, 20 Failed 7/20 tests, 65.00% okay Failed Test Stat Wstat Total Fail Failed List of Failed --- Failed 1/1 test scripts, 0.00% okay. 7/20 subtests failed, 65.00% okay. [warning] server localhost.localdomain:8529 shutdown instead of this # Failed test 20 in t/apache/contentlength.t at line 54 fail #10 FAILED tests 2, 6, 10, 14, 16, 18, 20 Failed 7/20 tests, 65.00% okay Failed Test Stat Wstat Total Fail Failed List of Failed --- t/apache/contentlength.t 207 35.00% 2 6 10 14 16 18 20 Failed 1/1 test scripts, 0.00% okay. 7/20 subtests failed, 65.00% okay. [warning] server localhost.localdomain:8529 shutdown note the absence of the Failed 1/1... stuff in what we have currently. Not sure what you are talking about above, the only difference between the two is in line: t/apache/contentlength.t 207 35.00% 2 6 10 14 16 18 20 What is Failed 1/1... stuff? How did you invoke the script so I can reproduce the same? 'make test'? __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: digging out the missing error message
Not sure what you are talking about above, the only difference between the two is in line: blarg, cut and paste error. without my patch, it looks like this (note it's 1.3) [EMAIL PROTECTED] perl-framework]$ t/TEST t/apache/contentlength.t -v /apache/1.3/dso/perl-5.8.4/bin/httpd -d /src/httpd-test/perl-framework/t -f /src/httpd-test/perl-framework/t/conf/httpd.conf -D APACHE1 -D PERL_USEITHREADS using Apache/1.3.31-dev # testing : response codes # expected: HTTP/1.1 413 Request Entity Too Large # received: HTTP/1.1 400 Bad Request not ok 20 # Failed test 20 in t/apache/contentlength.t at line 54 fail #10 FAILED tests 2, 6, 10, 14, 16, 18, 20 Failed 7/20 tests, 65.00% okay Failed Test Stat Wstat Total Fail Failed List of Failed --- t/apache/contentlength.t 207 35.00% 2 6 10 14 16 18 20 [warning] server localhost.localdomain:8529 shutdown the problem is the lack of this line: Failed 1/1 test scripts, 0.00% okay. 7/20 subtests failed, 65.00% okay. which is produced when Test::Harness::_show_results() dies. --Geoff
Re: digging out the missing error message
Geoffrey Young wrote: Not sure what you are talking about above, the only difference between the two is in line: blarg, cut and paste error. without my patch, it looks like this (note it's 1.3) [EMAIL PROTECTED] perl-framework]$ t/TEST t/apache/contentlength.t -v /apache/1.3/dso/perl-5.8.4/bin/httpd -d /src/httpd-test/perl-framework/t -f /src/httpd-test/perl-framework/t/conf/httpd.conf -D APACHE1 -D PERL_USEITHREADS using Apache/1.3.31-dev # testing : response codes # expected: HTTP/1.1 413 Request Entity Too Large # received: HTTP/1.1 400 Bad Request not ok 20 # Failed test 20 in t/apache/contentlength.t at line 54 fail #10 FAILED tests 2, 6, 10, 14, 16, 18, 20 Failed 7/20 tests, 65.00% okay Failed Test Stat Wstat Total Fail Failed List of Failed --- t/apache/contentlength.t 207 35.00% 2 6 10 14 16 18 20 [warning] server localhost.localdomain:8529 shutdown the problem is the lack of this line: Failed 1/1 test scripts, 0.00% okay. 7/20 subtests failed, 65.00% okay. which is produced when Test::Harness::_show_results() dies. Got it. Why not just do this: Index: Apache-Test/lib/Apache/TestRun.pm === RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v retrieving revision 1.166 diff -u -r1.166 TestRun.pm --- Apache-Test/lib/Apache/TestRun.pm 16 Apr 2004 20:29:23 - 1.166 +++ Apache-Test/lib/Apache/TestRun.pm 5 May 2004 22:40:28 - @@ -347,6 +347,7 @@ $SIG{__DIE__} = sub { return unless $_[0] =~ /^Failed/i; #dont catch Test::ok failures +print $_[0]; $server-stop(1) if $opts-{'start-httpd'}; $server-failed_msg(error running tests); exit_perl 0; -- __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Re: digging out the missing error message
Got it. Why not just do this: return unless $_[0] =~ /^Failed/i; #dont catch Test::ok failures +print $_[0]; truthfully, I spent far too long trying to figure out why the die() wasn't cascading. once I got it I just patched it and let the patch fly without too much afterthought. but yeah, I think that will work just fine. is there any reason you can think of that we wouldn't want to see the error? or if the error should sometimes be preceeded with '#'? --Geoff