From 1ae762d3bc924245aa96378929a9a048d385a61e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 20 Dec 2007 15:54:08 +0100 Subject: r26549: Remove suite-specific bits. (This used to be commit ac01d515b71ce44a0d98e50d58a76e1ce9e1f5d9) --- source4/selftest/output/buildfarm.pm | 12 +++++++----- source4/selftest/output/html.pm | 8 +++++--- source4/selftest/output/plain.pm | 19 ++++++++++++------- 3 files changed, 24 insertions(+), 15 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm index 81ffd5012c..af61376446 100644 --- a/source4/selftest/output/buildfarm.pm +++ b/source4/selftest/output/buildfarm.pm @@ -7,11 +7,11 @@ use Exporter; use strict; -sub new($$$$) { - my ($class, $statistics) = @_; +sub new($$$) { + my ($class) = @_; my $self = { - statistics => $statistics, - test_output => {} + test_output => {}, + start_time => time() }; bless($self, $class); } @@ -24,7 +24,7 @@ sub start_testsuite($$$) $state->{NAME} = $name; $state->{START_TIME} = time(); - my $duration = $state->{START_TIME} - $self->{statistics}->{START_TIME}; + my $duration = $state->{START_TIME} - $self->{start_time}; $out .= "--==--==--==--==--==--==--==--==--==--==--\n"; $out .= "Running test $name (level 0 stdout)\n"; $out .= "--==--==--==--==--==--==--==--==--==--==--\n"; @@ -103,6 +103,8 @@ sub end_test($$$$$$) sub summary($) { my ($self) = @_; + + print "DURATION: " . (time() - $self->{start_time}) . " seconds\n"; } sub skip_testsuite($$$$) diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index 13d2f10938..1e2dacac6f 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -9,13 +9,13 @@ use warnings; use FindBin qw($RealBin); -sub new($$$$) { +sub new$($$$) { my ($class, $dirname, $statistics) = @_; my $self = { dirname => $dirname, - statistics => $statistics, active_test => undef, local_statistics => {}, + statistics => {}, msg => "", error_summary => { skip => [], @@ -248,7 +248,9 @@ sub summary($) print INDEX "\n"; print INDEX " Total\n"; - if ($st->{SUITES_FAIL} == 0) { + if ($st->{TESTS_UNEXPECTED_OK} == 0 and + $st->{TESTS_UNEXPECTED_FAIL} == 0 and + $st->{TESTS_ERROR} == 0) { print INDEX " "; } else { print INDEX " "; diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index af353c3cff..086bd2b0e5 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -6,14 +6,16 @@ use Exporter; use strict; -sub new($$$$$$) { +sub new($$$$$$$) { my ($class, $summaryfile, $verbose, $immediate, $statistics, $totaltests) = @_; my $self = { verbose => $verbose, immediate => $immediate, statistics => $statistics, + start_time => time(), test_output => {}, suitesfailed => [], + suites_ok => 0, skips => {}, summaryfile => $summaryfile, index => 0, @@ -32,13 +34,13 @@ sub start_testsuite($$$) $state->{NAME} = $name; $state->{START_TIME} = time(); - my $duration = $state->{START_TIME} - $self->{statistics}->{START_TIME}; + my $duration = $state->{START_TIME} - $self->{start_time}; $self->{test_output}->{$name} = "" unless($self->{verbose}); my $out = ""; $out .= "[$self->{index}/$self->{totalsuites} in ".$duration."s"; - $out .= sprintf(", %d errors", $self->{statistics}->{SUITES_FAIL}) if ($self->{statistics}->{SUITES_FAIL} > 0); + $out .= sprintf(", %d errors", ($#{$self->{suitesfailed}}+1)) if ($#{$self->{suitesfailed}} > -1); $out .= "] $name\n", print "$out"; } @@ -68,13 +70,16 @@ sub end_testsuite($$$$$$) if ($unexpected) { $self->output_msg($state, "ERROR: $reason\n"); + push (@{$self->{suitesfailed}}, $name); + } else { + $self->{suites_ok}++; } if ($unexpected and $self->{immediate} and not $self->{verbose}) { $out .= $self->{test_output}->{$name}; - push (@{$self->{suitesfailed}}, $name); } + print $out; } @@ -151,12 +156,12 @@ sub summary($) print "\nA summary with detailed informations can be found in:\n $self->{summaryfile}\n"; - if ($self->{statistics}->{SUITES_FAIL} == 0) { + if ($#{$self->{suitesfailed}} == -1) { my $ok = $self->{statistics}->{TESTS_EXPECTED_OK} + $self->{statistics}->{TESTS_EXPECTED_FAIL}; - print "\nALL OK ($ok tests in $self->{statistics}->{SUITES_OK} testsuites)\n"; + print "\nALL OK ($ok tests in $self->{suites_ok} testsuites)\n"; } else { - print "\nFAILED ($self->{statistics}->{TESTS_UNEXPECTED_FAIL} failures and $self->{statistics}->{TESTS_ERROR} errors in $self->{statistics}->{SUITES_FAIL} testsuites)\n"; + print "\nFAILED ($self->{statistics}->{TESTS_UNEXPECTED_FAIL} failures and $self->{statistics}->{TESTS_ERROR} errors in ". ($#{$self->{suitesfailed}}+1) ." testsuites)\n"; } } -- cgit