diff options
Diffstat (limited to 'source4/selftest/output')
-rw-r--r-- | source4/selftest/output/buildfarm.pm | 25 | ||||
-rw-r--r-- | source4/selftest/output/html.pm | 66 | ||||
-rw-r--r-- | source4/selftest/output/plain.pm | 34 | ||||
-rw-r--r-- | source4/selftest/output/testresults.css | 5 |
4 files changed, 102 insertions, 28 deletions
diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm index 7d6c3a987a..efb1e3ef5b 100644 --- a/source4/selftest/output/buildfarm.pm +++ b/source4/selftest/output/buildfarm.pm @@ -7,10 +7,10 @@ use Exporter; use strict; -sub new($$) { - my ($class) = @_; - my $self = { - start => time(), +sub new($$$$) { + my ($class, $statistics) = @_; + my $self = { + statistics => $statistics, test_output => {} }; bless($self, $class); @@ -21,11 +21,12 @@ sub start_testsuite($$) my ($self, $state) = @_; my $out = ""; + my $duration = $state->{START_TIME} - $self->{statistics}->{START_TIME}; $out .= "--==--==--==--==--==--==--==--==--==--==--\n"; $out .= "Running test $state->{NAME} (level 0 stdout)\n"; $out .= "--==--==--==--==--==--==--==--==--==--==--\n"; $out .= scalar(localtime())."\n"; - $out .= "SELFTEST RUNTIME: " . ($state->{START_TIME} - $self->{START_TIME}) . "s\n"; + $out .= "SELFTEST RUNTIME: " . $duration . "s\n"; $out .= "NAME: $state->{NAME}\n"; $out .= "CMD: $state->{CMD}\n"; @@ -58,7 +59,7 @@ sub end_testsuite($$$$$) if ($ret == $expected_ret) { $out .= "ALL OK\n"; } else { - $out .= "ERROR: $ret"; + $out .= "ERROR: $ret\n"; $out .= $self->{test_output}->{$state->{NAME}}; } @@ -84,7 +85,11 @@ sub start_test($$$) sub end_test($$$$$$) { - my ($self, $state, $testname, $result, $expected, $reason) = @_; + my ($self, $state, $testname, $result, $unexpected, $reason) = @_; + + return unless ($unexpected); + + $self->{test_output}->{$state->{NAME}} .= "UNEXPECTED($result): $testname\n"; } sub summary($) @@ -99,11 +104,11 @@ sub missing_env($$$) print "FAIL: $name (ENV[$envname] not available!)\n"; } -sub skip_testsuite($$) +sub skip_testsuite($$$$) { - my ($self, $name) = @_; + my ($self, $envname, $name, $reason) = @_; - print "SKIPPED: $name\n"; + # Ignore skipped tests } 1; diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index 156b5b98c7..22488576b4 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -7,6 +7,8 @@ use Exporter; use strict; use warnings; +use FindBin qw($RealBin); + sub new($$$$) { my ($class, $dirname, $statistics) = @_; my $self = { @@ -21,11 +23,12 @@ sub new($$$$) { unexpected_success => [], expected_failure => [], unexpected_failure => [], + skip_testsuites => [], error => [] } }; - link("selftest/output/testresults.css", "$dirname/testresults.css"); + link("$RealBin/output/testresults.css", "$dirname/testresults.css"); open(INDEX, ">$dirname/index.html"); @@ -89,6 +92,29 @@ sub start_testsuite($$) $self->print_html_header("Test Results for $state->{NAME}", *TEST); + + if ($state->{ENVNAME} ne "none") { + print TEST "<h2>Environment settings</h2>\n"; + + print TEST " <table>\n"; + print TEST " <tr><td><b>Variable name</b></td><td><b>Variable value</b></td></tr>\n"; + foreach (keys %{$state->{ENVVARS}}) { + print TEST " <tr><td>$_</td><td>"; + my $val = $state->{ENVVARS}->{$_}; + if ($val =~ /^\.\// and -r $val) { + print TEST "<a href=\"../$val\">$val</a>"; + } elsif (-r $val) { + print TEST "<a href=\"$val\">$val</a>"; + } else { + print TEST $val; + } + print TEST "</td></tr>\n"; + } + print TEST " </table>\n"; + } + + print TEST "<h2>Tests</h2>\n"; + print TEST " <table>\n"; } @@ -116,6 +142,7 @@ sub end_testsuite($$$$$) print TEST "</table>\n"; + print TEST "<div class=\"command\">$state->{CMD}</div>\n"; print TEST "<div class=\"duration\">Duration: " . (time() - $state->{START_TIME}) . "s</div>\n"; $self->print_html_footer(*TEST); @@ -261,6 +288,7 @@ sub summary($) print INDEX "</tr>\n"; print INDEX "</table>\n"; + print INDEX "<a href=\"summary.html\">Summary</a>\n"; print INDEX "</center>\n"; $self->print_html_footer(*INDEX); close(INDEX); @@ -298,6 +326,27 @@ sub summary($) print_table("Unexpected failures", $summ->{unexpected_failure}); print_table("Skipped tests", $summ->{skip}); print_table("Expected failures", $summ->{expected_failure}); + + print SUMMARY "<h3>Skipped testsuites</h3>\n"; + print SUMMARY "<table>\n"; + print SUMMARY "<tr>\n"; + print SUMMARY " <td class=\"tableHead\">Testsuite</td>\n"; + print SUMMARY " <td class=\"tableHead\">Reason</td>\n"; + print SUMMARY "</tr>\n"; + + foreach (@{$summ->{skip_testsuites}}) { + print SUMMARY "<tr>\n"; + print SUMMARY " <td>$$_[1]</td>\n"; + if (defined($$_[2])) { + print SUMMARY " <td>$$_[2]</td>\n"; + } else { + print SUMMARY " <td></td>\n"; + } + print SUMMARY "</tr>\n"; + } + + print SUMMARY "</table>"; + $self->print_html_footer(*SUMMARY); close(SUMMARY); } @@ -306,20 +355,15 @@ sub missing_env($$$) { my ($self, $name, $envname) = @_; - print INDEX "<tr>\n"; - print INDEX " <td class=\"testSuite\">$name</td>\n"; - print INDEX " <td class=\"resultSkipped\" colspan=\"2\">SKIPPED - environment `$envname` not available!</td>\n"; - print INDEX "</tr>\n"; + $self->skip_testsuite($envname, $name, "environment `$envname` not available!"); } -sub skip_testsuite($$) +sub skip_testsuite($$$$) { - my ($self, $name) = @_; + my ($self, $envname, $name, $reason) = @_; - print INDEX "<tr>\n"; - print INDEX " <td class=\"testSuite\">$name</td>\n"; - print INDEX " <td class=\"resultSkipped\" colspan=\"2\">SKIPPED</td>\n"; - print INDEX "</tr>\n"; + push (@{$self->{error_summary}->{skip_testsuites}}, + [$envname, $name, $reason]); } 1; diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index 10d6eee215..e4abb2d05a 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -13,8 +13,7 @@ sub new($$$$) { immediate => $immediate, statistics => $statistics, test_output => {}, - suitesfailed => [], - start => time() + suitesfailed => [] }; bless($self, $class); } @@ -61,6 +60,8 @@ sub end_testsuite($$$$$) my ($self, $state, $expected_ret, $ret, $envlog) = @_; my $out = ""; + $self->output_msg($state, "ENVLOG: $envlog\n") if ($envlog ne ""); + if ($ret != $expected_ret) { $self->output_msg($state, "ERROR: $ret\n"); } @@ -77,9 +78,24 @@ sub start_test($$) my ($state, $testname) = @_; } -sub end_test($$$$$) +sub end_test($$$$$$) { - my ($state, $testname, $result, $unexpected, $reason) = @_; + my ($self, $state, $testname, $result, $unexpected, $reason) = @_; + my $append = ""; + + unless ($unexpected) { + $self->{test_output}->{$state->{NAME}} = ""; + return; + } + + $append = "UNEXPECTED($result): $testname\n"; + + $self->{test_output}->{$state->{NAME}} .= $append; + + if ($self->{immediate} and not $self->{verbose}) { + print $self->{test_output}->{$state->{NAME}}; + $self->{test_output}->{$state->{NAME}} = ""; + } } sub summary($) @@ -111,11 +127,15 @@ sub missing_env($$$) print "FAIL: $name (ENV[$envname] not available!)\n"; } -sub skip_testsuite($$) +sub skip_testsuite($$$) { - my ($self, $name) = @_; + my ($self, $envname, $name, $reason) = @_; - print "SKIPPED: $name\n"; + if ($reason) { + print "SKIPPED: $name [$reason]\n"; + } else { + print "SKIPPED: $name\n"; + } } 1; diff --git a/source4/selftest/output/testresults.css b/source4/selftest/output/testresults.css index 56c4b0ead4..66d1d6b2ad 100644 --- a/source4/selftest/output/testresults.css +++ b/source4/selftest/output/testresults.css @@ -122,3 +122,8 @@ div.duration text-align: right; font-weight: bold; } + +div.command +{ + background-color: gray; +} |