summaryrefslogtreecommitdiff
path: root/source4/selftest/output
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-08-26 19:07:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:02:36 -0500
commit04e8c10f9e1dcd9edf94ae071a51f5e93ecc2a2e (patch)
tree7b8ad1ce3beb2776ea22a6aace2fbb2c4d23e7de /source4/selftest/output
parentd981c69a18599ce7848afc3e77ad8ab14e6efbe8 (diff)
downloadsamba-04e8c10f9e1dcd9edf94ae071a51f5e93ecc2a2e.tar.gz
samba-04e8c10f9e1dcd9edf94ae071a51f5e93ecc2a2e.tar.bz2
samba-04e8c10f9e1dcd9edf94ae071a51f5e93ecc2a2e.zip
r24671: More improvements to the HTML test suite results: hide
control messages, improve summary, stylesheet. (This used to be commit fcc2320417707ec803d706a923a231fbd1bb72a7)
Diffstat (limited to 'source4/selftest/output')
-rw-r--r--source4/selftest/output/buildfarm.pm11
-rw-r--r--source4/selftest/output/html.pm103
-rw-r--r--source4/selftest/output/plain.pm11
-rw-r--r--source4/selftest/output/testresults.css19
4 files changed, 131 insertions, 13 deletions
diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm
index a605f1736c..7d6c3a987a 100644
--- a/source4/selftest/output/buildfarm.pm
+++ b/source4/selftest/output/buildfarm.pm
@@ -41,6 +41,13 @@ sub output_msg($$$)
$self->{test_output}->{$state->{NAME}} .= $output;
}
+sub control_msg($$$)
+{
+ my ($self, $state, $output) = @_;
+
+ $self->{test_output}->{$state->{NAME}} .= $output;
+}
+
sub end_testsuite($$$$$)
{
my ($self, $state, $expected_ret, $ret, $envlog) = @_;
@@ -75,9 +82,9 @@ sub start_test($$$)
my ($self, $state, $testname) = @_;
}
-sub end_test($$$$$)
+sub end_test($$$$$$)
{
- my ($self, $state, $testname, $result, $expected) = @_;
+ my ($self, $state, $testname, $result, $expected, $reason) = @_;
}
sub summary($)
diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm
index 5a7ee15af2..afbe63177a 100644
--- a/source4/selftest/output/html.pm
+++ b/source4/selftest/output/html.pm
@@ -13,6 +13,7 @@ sub new($$$$) {
dirname => $dirname,
statistics => $statistics,
active_test => undef,
+ local_statistics => {},
msg => ""
};
@@ -35,7 +36,6 @@ sub new($$$$) {
print INDEX " <td class=\"tableHead\">Test</td>\n";
print INDEX " <td class=\"tableHead\">Environment</td>\n";
print INDEX " <td class=\"tableHead\">Result</td>\n";
- print INDEX " <td class=\"tableHead\">Duration</td>\n";
print INDEX " </tr>\n";
bless($self, $class);
@@ -47,6 +47,13 @@ sub start_testsuite($$)
{
my ($self, $state) = @_;
+ $self->{local_statistics} = {
+ success => 0,
+ skip => 0,
+ error => 0,
+ failure => 0
+ };
+
$state->{HTMLFILE} = "$state->{NAME}.html";
$state->{HTMLFILE} =~ s/[:\t\n \/]/_/g;
@@ -66,6 +73,13 @@ sub start_testsuite($$)
print TEST " <table>\n";
}
+sub control_msg($$$)
+{
+ my ($self, $state, $output) = @_;
+
+ $self->{msg} .= "<span class=\"control\">$output<br/></span>\n";
+}
+
sub output_msg($$$)
{
my ($self, $state, $output) = @_;
@@ -82,21 +96,55 @@ sub end_testsuite($$$$$)
my ($self, $state, $expected_ret, $ret, $envlog) = @_;
print TEST "</table>\n";
+
+ print TEST "<div class=\"duration\">Duration: " . (time() - $state->{START_TIME}) . "s</div>\n";
print TEST "</body>\n";
print TEST "</html>\n";
close(TEST);
- print INDEX "<tr><td class=\"testSuite\"><a href=\"$state->{HTMLFILE}\">$state->{NAME}</a></td><td class=\"environment\">$state->{ENVNAME}</td>";
+ print INDEX "<tr>\n";
+ print INDEX " <td class=\"testSuite\"><a href=\"$state->{HTMLFILE}\">$state->{NAME}</a></td>\n";
+ print INDEX " <td class=\"environment\">$state->{ENVNAME}</td>\n";
+ my $st = $self->{local_statistics};
if ($ret == $expected_ret) {
- print INDEX "<td class=\"resultOk\">OK</td>";
+ print INDEX " <td class=\"resultOk\">";
} else {
- print INDEX "<td class=\"resultFailure\">FAIL</td>";
+ print INDEX " <td class=\"resultFailure\">";
}
- print INDEX "<td class=\"duration\">" . (time() - $state->{START_TIME}) . "</td>\n";
+ my $l = 0;
+ if ($st->{success} > 0) {
+ print INDEX "$st->{success} ok";
+ $l++;
+ }
+ if ($st->{skip} > 0) {
+ print INDEX ", " if ($l);
+ print INDEX "$st->{skip} skipped";
+ $l++;
+ }
+ if ($st->{failure} > 0) {
+ print INDEX ", " if ($l);
+ print INDEX "$st->{failure} failures";
+ $l++;
+ }
+ if ($st->{error} > 0) {
+ print INDEX ", " if ($l);
+ print INDEX "$st->{error} errors";
+ $l++;
+ }
+ if ($l == 0) {
+ if ($ret == $expected_ret) {
+ print INDEX "OK";
+ } else {
+ print INDEX "FAIL";
+ }
+ }
+
+ print INDEX "</td>";
+
print INDEX "</tr>\n";
}
@@ -108,12 +156,14 @@ sub start_test($$$)
$self->{msg} = "";
}
-sub end_test($$$$$)
+sub end_test($$$$$$)
{
- my ($self, $state, $testname, $result, $unexpected) = @_;
+ my ($self, $state, $testname, $result, $unexpected, $reason) = @_;
print TEST "<tr>";
+ $self->{local_statistics}->{$result}++;
+
if ($result eq "skip") {
print TEST "<td class=\"outputSkipped\">\n";
} elsif ($unexpected) {
@@ -126,6 +176,10 @@ sub end_test($$$$$)
print TEST $self->{msg};
+ if (defined($reason)) {
+ print TEST "<div class=\"reason\">$reason</div>\n";
+ }
+
print TEST "</td></tr>\n";
$self->{active_test} = undef;
@@ -135,6 +189,36 @@ sub summary($)
{
my ($self) = @_;
+ my $st = $self->{statistics};
+ print INDEX "<tr>\n";
+ print INDEX " <td class=\"testSuiteTotal\">Total</td>\n";
+ print INDEX " <td></td>\n";
+
+ if ($st->{SUITES_FAIL} == 0) {
+ print INDEX " <td class=\"resultOk\">";
+ } else {
+ print INDEX " <td class=\"resultFailure\">";
+ }
+ print INDEX "$st->{TESTS_EXPECTED_OK} ok";
+ if ($st->{TESTS_UNEXPECTED_OK} > 0) {
+ print INDEX " ($st->{TESTS_UNEXPECTED_OK})";
+ }
+ print INDEX "</td>";
+ if ($st->{TESTS_SKIP} > 0) {
+ print INDEX ", $st->{TESTS_SKIP} skipped";
+ }
+ print INDEX ", $st->{TESTS_EXPECTED_FAIL} failures";
+ if ($st->{TESTS_UNEXPECTED_OK} > 0) {
+ print INDEX " ($st->{TESTS_UNEXPECTED_FAIL})";
+ }
+ if ($st->{TESTS_ERROR} > 0) {
+ print INDEX ", $st->{TESTS_ERROR} errors";
+ }
+
+ print INDEX "</td>";
+
+ print INDEX "</tr>\n";
+
print INDEX "</table>\n";
print INDEX "</center>\n";
print INDEX "</td></tr>\n";
@@ -155,7 +239,10 @@ sub skip_testsuite($$)
{
my ($self, $name) = @_;
- print INDEX "<tr><td class=\"testSuite\">$name</td><td class=\"environmentSkipped\">N/A</td><td class=\"resultSkipped\">SKIPPED</td><td class=\"durationSkipped\">N/A</td></tr>\n";
+ 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";
}
1;
diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm
index 2aa01145d0..10d6eee215 100644
--- a/source4/selftest/output/plain.pm
+++ b/source4/selftest/output/plain.pm
@@ -49,6 +49,13 @@ sub output_msg($$$)
}
}
+sub control_msg($$$)
+{
+ my ($self, $state, $output) = @_;
+
+ $self->output_msg($state, $output);
+}
+
sub end_testsuite($$$$$)
{
my ($self, $state, $expected_ret, $ret, $envlog) = @_;
@@ -70,9 +77,9 @@ sub start_test($$)
my ($state, $testname) = @_;
}
-sub end_test($$$$)
+sub end_test($$$$$)
{
- my ($state, $testname, $result, $unexpected) = @_;
+ my ($state, $testname, $result, $unexpected, $reason) = @_;
}
sub summary($)
diff --git a/source4/selftest/output/testresults.css b/source4/selftest/output/testresults.css
index b37f881f20..9f3b6c9e82 100644
--- a/source4/selftest/output/testresults.css
+++ b/source4/selftest/output/testresults.css
@@ -59,7 +59,7 @@ td.resultFailure
/* Skipped */
td.resultSkipped
{
- text-align: right;
+ text-align: center;
padding-left: 10px;
padding-right: 10px;
background-color: #FFEA20;
@@ -90,3 +90,20 @@ td.outputFailure
{
background-color: #FF0000;
}
+
+div.reason
+{
+ text-align: center;
+ font-weight: bold;
+}
+
+span.control
+{
+ display: none;
+}
+
+div.duration
+{
+ text-align: right;
+ font-weight: bold;
+}