diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-12-20 17:07:21 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 06:28:50 +0100 |
commit | b3b3af05f14c2d8d946ea024fcba1852949cb484 (patch) | |
tree | 74ab9024a40390a1266616fe943293754d048c03 /source4/selftest/output | |
parent | bf20aa02e6dc5934d693eacfa0b30a771f03bc63 (diff) | |
download | samba-b3b3af05f14c2d8d946ea024fcba1852949cb484.tar.gz samba-b3b3af05f14c2d8d946ea024fcba1852949cb484.tar.bz2 samba-b3b3af05f14c2d8d946ea024fcba1852949cb484.zip |
r26552: remove unused state variable, use dot as path separator for test names.
(This used to be commit a84975610c2825e9ceecdd47d744282bd55220be)
Diffstat (limited to 'source4/selftest/output')
-rw-r--r-- | source4/selftest/output/buildfarm.pm | 49 | ||||
-rw-r--r-- | source4/selftest/output/html.pm | 49 | ||||
-rw-r--r-- | source4/selftest/output/plain.pm | 55 |
3 files changed, 82 insertions, 71 deletions
diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm index af61376446..cee6c1e63a 100644 --- a/source4/selftest/output/buildfarm.pm +++ b/source4/selftest/output/buildfarm.pm @@ -5,6 +5,11 @@ package output::buildfarm; use Exporter; @ISA = qw(Exporter); +use FindBin qw($RealBin); +use lib "$RealBin/.."; + +use Subunit qw(parse_results); + use strict; sub new($$$) { @@ -16,15 +21,15 @@ sub new($$$) { bless($self, $class); } -sub start_testsuite($$$) +sub start_testsuite($$) { - my ($self, $name, $state) = @_; + my ($self, $name) = @_; my $out = ""; - $state->{NAME} = $name; - $state->{START_TIME} = time(); + $self->{NAME} = $name; + $self->{START_TIME} = time(); - my $duration = $state->{START_TIME} - $self->{start_time}; + my $duration = $self->{START_TIME} - $self->{start_time}; $out .= "--==--==--==--==--==--==--==--==--==--==--\n"; $out .= "Running test $name (level 0 stdout)\n"; $out .= "--==--==--==--==--==--==--==--==--==--==--\n"; @@ -37,26 +42,26 @@ sub start_testsuite($$$) print $out; } -sub output_msg($$$) +sub output_msg($$) { - my ($self, $state, $output) = @_; + my ($self, $output) = @_; - $self->{test_output}->{$state->{NAME}} .= $output; + $self->{test_output}->{$self->{NAME}} .= $output; } -sub control_msg($$$) +sub control_msg($$) { - my ($self, $state, $output) = @_; + my ($self, $output) = @_; - $self->{test_output}->{$state->{NAME}} .= $output; + $self->{test_output}->{$self->{NAME}} .= $output; } -sub end_testsuite($$$$$$$) +sub end_testsuite($$$$$$) { - my ($self, $name, $state, $result, $unexpected, $reason) = @_; + my ($self, $name, $result, $unexpected, $reason) = @_; my $out = ""; - $out .= "TEST RUNTIME: " . (time() - $state->{START_TIME}) . "s\n"; + $out .= "TEST RUNTIME: " . (time() - $self->{START_TIME}) . "s\n"; if (not $unexpected) { $out .= "ALL OK\n"; @@ -65,8 +70,6 @@ sub end_testsuite($$$$$$$) $out .= $self->{test_output}->{$name}; } - $out .= "PCAP FILE: $state->{PCAP_FILE}\n" if defined($state->{PCAP_FILE}); - $out .= "==========================================\n"; if (not $unexpected) { $out .= "TEST PASSED: $name\n"; @@ -78,25 +81,25 @@ sub end_testsuite($$$$$$$) print $out; } -sub start_test($$$$) +sub start_test($$$) { - my ($self, $state, $parents, $testname) = @_; + my ($self, $parents, $testname) = @_; if ($#$parents == -1) { - $self->start_testsuite($testname, $state); + $self->start_testsuite($testname); } } -sub end_test($$$$$$) +sub end_test($$$$$) { - my ($self, $state, $parents, $testname, $result, $unexpected, $reason) = @_; + my ($self, $parents, $testname, $result, $unexpected, $reason) = @_; if ($unexpected) { - $self->{test_output}->{$state->{NAME}} .= "UNEXPECTED($result): $testname\n"; + $self->{test_output}->{$self->{NAME}} .= "UNEXPECTED($result): $testname\n"; } if ($#$parents == -1) { - $self->end_testsuite($testname, $state, $result, $unexpected, $reason); + $self->end_testsuite($testname, $result, $unexpected, $reason); } } diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index 1e2dacac6f..c97926c7a8 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -8,6 +8,9 @@ use strict; use warnings; use FindBin qw($RealBin); +use lib "$RealBin/.."; + +use Subunit qw(parse_results); sub new$($$$) { my ($class, $dirname, $statistics) = @_; @@ -71,11 +74,11 @@ sub print_html_footer($$) print $fh "</html>\n"; } -sub output_msg($$$); +sub output_msg($$); -sub start_testsuite($$$) +sub start_testsuite($$) { - my ($self, $name, $state) = @_; + my ($self, $name) = @_; $self->{local_statistics} = { success => 0, @@ -84,11 +87,11 @@ sub start_testsuite($$$) failure => 0 }; - $state->{NAME} = $name; - $state->{HTMLFILE} = "$name.html"; - $state->{HTMLFILE} =~ s/[:\t\n \/]/_/g; + $self->{NAME} = $name; + $self->{HTMLFILE} = "$name.html"; + $self->{HTMLFILE} =~ s/[:\t\n \/]/_/g; - open(TEST, ">$self->{dirname}/$state->{HTMLFILE}") or die("Unable to open $state->{HTMLFILE} for writing"); + open(TEST, ">$self->{dirname}/$self->{HTMLFILE}") or die("Unable to open $self->{HTMLFILE} for writing"); $self->print_html_header("Test Results for $name", *TEST); @@ -97,16 +100,16 @@ sub start_testsuite($$$) print TEST " <table>\n"; } -sub control_msg($$$) +sub control_msg($$) { - my ($self, $state, $output) = @_; + my ($self, $output) = @_; $self->{msg} .= "<span class=\"control\">$output<br/></span>\n"; } -sub output_msg($$$) +sub output_msg($$) { - my ($self, $state, $output) = @_; + my ($self, $output) = @_; unless (defined($self->{active_test})) { print TEST "$output<br/>"; @@ -115,20 +118,20 @@ sub output_msg($$$) } } -sub end_testsuite($$$$$) +sub end_testsuite($$$$) { - my ($self, $name, $state, $result, $unexpected, $reason) = @_; + my ($self, $name, $result, $unexpected, $reason) = @_; print TEST "</table>\n"; - print TEST "<div class=\"duration\">Duration: " . (time() - $state->{START_TIME}) . "s</div>\n"; + print TEST "<div class=\"duration\">Duration: " . (time() - $self->{START_TIME}) . "s</div>\n"; $self->print_html_footer(*TEST); close(TEST); print INDEX "<tr>\n"; - print INDEX " <td class=\"testSuite\"><a href=\"$state->{HTMLFILE}\">$name</a></td>\n"; + print INDEX " <td class=\"testSuite\"><a href=\"$self->{HTMLFILE}\">$name</a></td>\n"; my $st = $self->{local_statistics}; if (not $unexpected) { @@ -175,13 +178,13 @@ sub end_testsuite($$$$$) print INDEX "</tr>\n"; } -sub start_test($$$) +sub start_test($$) { - my ($self, $state, $parents, $testname) = @_; + my ($self, $parents, $testname) = @_; if ($#$parents == -1) { - $state->{START_TIME} = time(); - $self->start_testsuite($testname, $state); + $self->{START_TIME} = time(); + $self->start_testsuite($testname); return; } @@ -189,12 +192,12 @@ sub start_test($$$) $self->{msg} = ""; } -sub end_test($$$$$$$) +sub end_test($$$$$$) { - my ($self, $state, $parents, $testname, $result, $unexpected, $reason) = @_; + my ($self, $parents, $testname, $result, $unexpected, $reason) = @_; if ($#$parents == -1) { - $self->end_testsuite($testname, $state, $result, $unexpected, $reason); + $self->end_testsuite($testname, $result, $unexpected, $reason); return; } @@ -224,7 +227,7 @@ sub end_test($$$$$$$) } push(@{$self->{error_summary}->{$track_class}}, , - [$state->{HTMLFILE}, $testname, $state->{NAME}, + [$self->{HTMLFILE}, $testname, $self->{NAME}, $reason]); print TEST "<a name=\"$testname\"><h3>$testname</h3></a>\n"; diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index 086bd2b0e5..1e6dead326 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -4,6 +4,11 @@ package output::plain; use Exporter; @ISA = qw(Exporter); +use FindBin qw($RealBin); +use lib "$RealBin/.."; + +use Subunit qw(parse_results); + use strict; sub new($$$$$$$) { @@ -24,17 +29,17 @@ sub new($$$$$$$) { bless($self, $class); } -sub output_msg($$$); +sub output_msg($$); -sub start_testsuite($$$) +sub start_testsuite($$) { - my ($self, $name, $state) = @_; + my ($self, $name) = @_; $self->{index}++; - $state->{NAME} = $name; - $state->{START_TIME} = time(); + $self->{NAME} = $name; + $self->{START_TIME} = time(); - my $duration = $state->{START_TIME} - $self->{start_time}; + my $duration = $self->{START_TIME} - $self->{start_time}; $self->{test_output}->{$name} = "" unless($self->{verbose}); @@ -45,31 +50,31 @@ sub start_testsuite($$$) print "$out"; } -sub output_msg($$$) +sub output_msg($$) { - my ($self, $state, $output) = @_; + my ($self, $output) = @_; if ($self->{verbose}) { print $output; } else { - $self->{test_output}->{$state->{NAME}} .= $output; + $self->{test_output}->{$self->{NAME}} .= $output; } } -sub control_msg($$$) +sub control_msg($$) { - my ($self, $state, $output) = @_; + my ($self, $output) = @_; - $self->output_msg($state, $output); + $self->output_msg($output); } -sub end_testsuite($$$$$$) +sub end_testsuite($$$$$) { - my ($self, $name, $state, $result, $unexpected, $reason) = @_; + my ($self, $name, $result, $unexpected, $reason) = @_; my $out = ""; if ($unexpected) { - $self->output_msg($state, "ERROR: $reason\n"); + $self->output_msg("ERROR: $reason\n"); push (@{$self->{suitesfailed}}, $name); } else { $self->{suites_ok}++; @@ -83,38 +88,38 @@ sub end_testsuite($$$$$$) print $out; } -sub start_test($$$$) +sub start_test($$$) { - my ($self, $state, $parents, $testname) = @_; + my ($self, $parents, $testname) = @_; if ($#$parents == -1) { - $self->start_testsuite($testname, $state); + $self->start_testsuite($testname); } } -sub end_test($$$$$$) +sub end_test($$$$$) { - my ($self, $state, $parents, $testname, $result, $unexpected, $reason) = @_; + my ($self, $parents, $testname, $result, $unexpected, $reason) = @_; if ($#$parents == -1) { - $self->end_testsuite($testname, $state, $result, $unexpected, $reason); + $self->end_testsuite($testname, $result, $unexpected, $reason); return; } my $append = ""; unless ($unexpected) { - $self->{test_output}->{$state->{NAME}} = ""; + $self->{test_output}->{$self->{NAME}} = ""; return; } $append = "UNEXPECTED($result): $testname\n"; - $self->{test_output}->{$state->{NAME}} .= $append; + $self->{test_output}->{$self->{NAME}} .= $append; if ($self->{immediate} and not $self->{verbose}) { - print $self->{test_output}->{$state->{NAME}}; - $self->{test_output}->{$state->{NAME}} = ""; + print $self->{test_output}->{$self->{NAME}}; + $self->{test_output}->{$self->{NAME}} = ""; } } |