summaryrefslogtreecommitdiff
path: root/source4/selftest/output
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-20 15:54:02 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 06:28:47 +0100
commit254f1c6fee18dd14d2f9f97d65e6fe9ef04c26f2 (patch)
tree2c298314e59ed3db7e3dbecb6c66e465800e9afb /source4/selftest/output
parent9ca5a267466f7b1b83a906b1f3b8b1b953222f21 (diff)
downloadsamba-254f1c6fee18dd14d2f9f97d65e6fe9ef04c26f2.tar.gz
samba-254f1c6fee18dd14d2f9f97d65e6fe9ef04c26f2.tar.bz2
samba-254f1c6fee18dd14d2f9f97d65e6fe9ef04c26f2.zip
r26547: Make testsuites less special during subunit handling.
(This used to be commit 0bf6bdcd7f21740853ae852193d51bdf14201782)
Diffstat (limited to 'source4/selftest/output')
-rw-r--r--source4/selftest/output/buildfarm.pm32
-rw-r--r--source4/selftest/output/html.pm24
-rw-r--r--source4/selftest/output/plain.pm36
3 files changed, 58 insertions, 34 deletions
diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm
index f3ad9319b4..958124259e 100644
--- a/source4/selftest/output/buildfarm.pm
+++ b/source4/selftest/output/buildfarm.pm
@@ -49,47 +49,53 @@ sub control_msg($$$)
$self->{test_output}->{$state->{NAME}} .= $output;
}
-sub end_testsuite($$$$$$)
+sub end_testsuite($$$$$$$)
{
- my ($self, $name, $state, $expected_ret, $ret, $envlog) = @_;
+ my ($self, $name, $state, $result, $unexpected, $reason) = @_;
my $out = "";
$out .= "TEST RUNTIME: " . (time() - $state->{START_TIME}) . "s\n";
- if ($ret == $expected_ret) {
+ if (not $unexpected) {
$out .= "ALL OK\n";
} else {
- $out .= "ERROR: $ret\n";
+ $out .= "ERROR: $reason\n";
$out .= $self->{test_output}->{$name};
}
$out .= "PCAP FILE: $state->{PCAP_FILE}\n" if defined($state->{PCAP_FILE});
- $out .= $envlog;
-
$out .= "==========================================\n";
- if ($ret == $expected_ret) {
+ if (not $unexpected) {
$out .= "TEST PASSED: $name\n";
} else {
- $out .= "TEST FAILED: $name (status $ret)\n";
+ $out .= "TEST FAILED: $name (status $reason)\n";
}
$out .= "==========================================\n";
print $out;
}
-sub start_test($$$)
+sub start_test($$$$)
{
- my ($self, $state, $testname) = @_;
+ my ($self, $state, $parents, $testname) = @_;
+
+ if ($#$parents == -1) {
+ $self->start_testsuite($testname, $state);
+ }
}
sub end_test($$$$$$)
{
- my ($self, $state, $testname, $result, $unexpected, $reason) = @_;
+ my ($self, $state, $parents, $testname, $result, $unexpected, $reason) = @_;
- return unless ($unexpected);
+ if ($unexpected) {
+ $self->{test_output}->{$state->{NAME}} .= "UNEXPECTED($result): $testname\n";
+ }
- $self->{test_output}->{$state->{NAME}} .= "UNEXPECTED($result): $testname\n";
+ if ($#$parents == -1) {
+ $self->end_testsuite($testname, $state, $result, $unexpected, $reason);
+ }
}
sub summary($)
diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm
index fc034cc95f..7f3cfac8cd 100644
--- a/source4/selftest/output/html.pm
+++ b/source4/selftest/output/html.pm
@@ -136,7 +136,7 @@ sub output_msg($$$)
sub end_testsuite($$$$$)
{
- my ($self, $name, $state, $expected_ret, $ret, $envlog) = @_;
+ my ($self, $name, $state, $result, $unexpected, $reason) = @_;
print TEST "</table>\n";
@@ -151,8 +151,8 @@ sub end_testsuite($$$$$)
print INDEX " <td class=\"testSuite\"><a href=\"$state->{HTMLFILE}\">$name</a></td>\n";
my $st = $self->{local_statistics};
- if ($ret == $expected_ret) {
- if ($ret == 0) {
+ if (not $unexpected) {
+ if ($result eq "failure") {
print INDEX " <td class=\"resultExpectedFailure\">";
} else {
print INDEX " <td class=\"resultOk\">";
@@ -183,7 +183,7 @@ sub end_testsuite($$$$$)
}
if ($l == 0) {
- if ($ret == $expected_ret) {
+ if (not $unexpected) {
print INDEX "OK";
} else {
print INDEX "FAIL";
@@ -197,15 +197,25 @@ sub end_testsuite($$$$$)
sub start_test($$$)
{
- my ($self, $state, $testname) = @_;
+ my ($self, $state, $parents, $testname) = @_;
+
+ if ($#$parents == -1) {
+ $self->start_testsuite($testname, $state);
+ return;
+ }
$self->{active_test} = $testname;
$self->{msg} = "";
}
-sub end_test($$$$$$)
+sub end_test($$$$$$$)
{
- my ($self, $state, $testname, $result, $unexpected, $reason) = @_;
+ my ($self, $state, $parents, $testname, $result, $unexpected, $reason) = @_;
+
+ if ($#$parents == -1) {
+ $self->end_testsuite($testname, $state, $result, $unexpected, $reason);
+ return;
+ }
print TEST "<tr>";
diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm
index 8a56d1c922..a11ada871a 100644
--- a/source4/selftest/output/plain.pm
+++ b/source4/selftest/output/plain.pm
@@ -25,18 +25,18 @@ sub output_msg($$$);
sub start_testsuite($$$)
{
my ($self, $name, $state) = @_;
- my $out = "";
my $duration = $state->{START_TIME} - $self->{statistics}->{START_TIME};
- $out .= "[$state->{INDEX}/$state->{TOTAL} in ".$duration."s";
- $out .= sprintf(", %d errors", $self->{statistics}->{SUITES_FAIL}) if ($self->{statistics}->{SUITES_FAIL} > 0);
- $out .= "] $name\n",
$self->{test_output}->{$name} = "" unless($self->{verbose});
$self->output_msg($state, "CMD: $state->{CMD}\n");
- print $out;
+ my $out = "";
+ $out .= "[$state->{INDEX}/$state->{TOTAL} in ".$duration."s";
+ $out .= sprintf(", %d errors", $self->{statistics}->{SUITES_FAIL}) if ($self->{statistics}->{SUITES_FAIL} > 0);
+ $out .= "] $name\n",
+ print "$out";
}
sub output_msg($$$)
@@ -59,16 +59,14 @@ sub control_msg($$$)
sub end_testsuite($$$$$$)
{
- my ($self, $name, $state, $expected_ret, $ret, $envlog) = @_;
+ my ($self, $name, $state, $result, $unexpected, $reason) = @_;
my $out = "";
- $self->output_msg($state, "ENVLOG: $envlog\n") if ($envlog ne "");
-
- if ($ret != $expected_ret) {
- $self->output_msg($state, "ERROR: $ret\n");
+ if ($unexpected) {
+ $self->output_msg($state, "ERROR: $reason\n");
}
- if ($ret != $expected_ret and $self->{immediate} and not $self->{verbose}) {
+ if ($unexpected and $self->{immediate} and not $self->{verbose}) {
$out .= $self->{test_output}->{$name};
push (@{$self->{suitesfailed}}, $name);
}
@@ -76,14 +74,24 @@ sub end_testsuite($$$$$$)
print $out;
}
-sub start_test($$)
+sub start_test($$$$)
{
- my ($state, $testname) = @_;
+ my ($self, $state, $parents, $testname) = @_;
+
+ if ($#$parents == -1) {
+ $self->start_testsuite($testname, $state);
+ }
}
sub end_test($$$$$$)
{
- my ($self, $state, $testname, $result, $unexpected, $reason) = @_;
+ my ($self, $state, $parents, $testname, $result, $unexpected, $reason) = @_;
+
+ if ($#$parents == -1) {
+ $self->end_testsuite($testname, $state, $result, $unexpected, $reason);
+ return;
+ }
+
my $append = "";
unless ($unexpected) {