summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-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
-rwxr-xr-xsource4/selftest/selftest.pl36
5 files changed, 156 insertions, 24 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;
+}
diff --git a/source4/selftest/selftest.pl b/source4/selftest/selftest.pl
index a10baebcf4..b0b53a16f1 100755
--- a/source4/selftest/selftest.pl
+++ b/source4/selftest/selftest.pl
@@ -156,7 +156,8 @@ my $statistics = {
TESTS_EXPECTED_OK => 0,
TESTS_UNEXPECTED_FAIL => 0,
TESTS_EXPECTED_FAIL => 0,
- TESTS_ERROR => 0
+ TESTS_ERROR => 0,
+ TESTS_SKIP => 0,
};
sub expecting_failure($)
@@ -218,45 +219,58 @@ sub parse_subunit_results($$$$)
my $open_tests = {};
while(<$fh>) {
- $msg_ops->output_msg($msg_state, $_);
if (/^test: (.+)\n/) {
+ $msg_ops->control_msg($msg_state, $_);
$open_tests->{$1} = 1;
$msg_ops->start_test($msg_state, $1);
- } elsif (/^(success|failure|skip|error): (.*?)( \[)?\n/) {
+ } elsif (/^(success|failure|skip|error): (.*?)( \[)?([ \t]*)\n/) {
+ $msg_ops->control_msg($msg_state, $_);
+ my $reason = undef;
+ if ($3) {
+ $reason = "";
+ # reason may be specified in next lines
+ while(<$fh>) {
+ $msg_ops->control_msg($msg_state, $_);
+ if ($_ eq "]\n") { last; } else { $reason .= $_; }
+ }
+ }
my $result = $1;
if ($1 eq "success") {
delete $open_tests->{$2};
if (expecting_failure("$msg_state->{NAME}/$2")) {
$statistics->{TESTS_UNEXPECTED_OK}++;
- $msg_ops->end_test($msg_state, $2, $1, 1);
+ $msg_ops->end_test($msg_state, $2, $1, 1, $reason);
} else {
$statistics->{TESTS_EXPECTED_OK}++;
- $msg_ops->end_test($msg_state, $2, $1, 0);
+ $msg_ops->end_test($msg_state, $2, $1, 0, $reason);
}
} elsif ($1 eq "failure") {
delete $open_tests->{$2};
if (expecting_failure("$msg_state->{NAME}/$2")) {
$statistics->{TESTS_EXPECTED_FAIL}++;
- $msg_ops->end_test($msg_state, $2, $1, 0);
+ $msg_ops->end_test($msg_state, $2, $1, 0, $reason);
$expected_ret = 0;
} else {
$statistics->{TESTS_UNEXPECTED_FAIL}++;
- $msg_ops->end_test($msg_state, $2, $1, 1);
+ $msg_ops->end_test($msg_state, $2, $1, 1, $reason);
}
} elsif ($1 eq "skip") {
+ $statistics->{TESTS_SKIP}++;
delete $open_tests->{$2};
- $msg_ops->end_test($msg_state, $2, $1, 0);
+ $msg_ops->end_test($msg_state, $2, $1, 0, $reason);
} elsif ($1 eq "error") {
$statistics->{TESTS_ERROR}++;
delete $open_tests->{$2};
- $msg_ops->end_test($msg_state, $2, $1, 1);
+ $msg_ops->end_test($msg_state, $2, $1, 1, $reason);
}
+ } else {
+ $msg_ops->output_msg($msg_state, $_);
}
}
foreach (keys %$open_tests) {
- $msg_ops->end_test($msg_state, $_, "error", 1);
- $msg_ops->output_msg($msg_state, "$_ was started but never finished!");
+ $msg_ops->end_test($msg_state, $_, "error", 1,
+ "was started but never finished!");
$statistics->{TESTS_ERROR}++;
}