diff options
Diffstat (limited to 'source4/selftest')
-rw-r--r-- | source4/selftest/output/buildfarm.pm | 12 | ||||
-rw-r--r-- | source4/selftest/output/html.pm | 8 | ||||
-rw-r--r-- | source4/selftest/output/plain.pm | 19 | ||||
-rwxr-xr-x | source4/selftest/selftest.pl | 11 |
4 files changed, 24 insertions, 26 deletions
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 "<tr>\n"; print INDEX " <td class=\"testSuiteTotal\">Total</td>\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 " <td class=\"resultOk\">"; } else { print INDEX " <td class=\"resultFailure\">"; 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"; } } diff --git a/source4/selftest/selftest.pl b/source4/selftest/selftest.pl index 14f4ce3a06..0e9b0174fd 100755 --- a/source4/selftest/selftest.pl +++ b/source4/selftest/selftest.pl @@ -165,11 +165,7 @@ my @includes = (); my @excludes = (); my $statistics = { - START_TIME => time(), - SUITES_FAIL => 0, - SUITES_OK => 0, - SUITES_SKIPPED => 0, TESTS_UNEXPECTED_OK => 0, TESTS_EXPECTED_OK => 0, @@ -276,8 +272,6 @@ sub run_testsuite($$$$$$) if ($ret != $expected_ret) { $statistics->{SUITES_FAIL}++; exit(1) if ($opt_one); - } else { - $statistics->{SUITES_OK}++; } return ($ret == $expected_ret); @@ -631,7 +625,6 @@ foreach (@available) { my $skipreason = skip($name); if ($skipreason) { $msg_ops->skip_testsuite($name, $skipreason); - $statistics->{SUITES_SKIPPED}++; } else { push(@todo, $_); } @@ -791,7 +784,6 @@ $envvarstr my $envvars = setup_env($envname); if (not defined($envvars)) { - $statistics->{SUITES_SKIPPED}++; $msg_ops->skip_testsuite($name, "unable to set up environment $envname"); next; } @@ -813,10 +805,7 @@ teardown_env($_) foreach (keys %running_envs); $target->stop(); -$statistics->{END_TIME} = time(); -my $duration = ($statistics->{END_TIME}-$statistics->{START_TIME}); $msg_ops->summary(); -print "DURATION: $duration seconds\n"; my $failed = 0; |