From 4da477d4fa891703497608c6b93402c4fc278f95 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 12 Aug 2007 00:50:25 +0000 Subject: r24339: Move output functions to separate files. (This used to be commit f4ff4c5f61189c71ab60a5455272302add9e1d97) --- source4/selftest/output/buildfarm.pm | 95 ++++++++++++++++++++++++++++++++ source4/selftest/output/plain.pm | 101 +++++++++++++++++++++++++++++++++++ 2 files changed, 196 insertions(+) create mode 100644 source4/selftest/output/buildfarm.pm create mode 100644 source4/selftest/output/plain.pm (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm new file mode 100644 index 0000000000..11d65d7306 --- /dev/null +++ b/source4/selftest/output/buildfarm.pm @@ -0,0 +1,95 @@ +#!/usr/bin/perl + +package output::buildfarm; + +use Exporter; +@ISA = qw(Exporter); + +use strict; + +sub new($$) { + my ($class) = @_; + my $self = { + start => time(), + test_output => {} + }; + bless($self, $class); +} + +sub start_testsuite($$) +{ + my ($self, $state) = @_; + my $out = ""; + + $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 .= "NAME: $state->{NAME}\n"; + $out .= "CMD: $state->{CMD}\n"; + + $self->{test_output}->{$state->{NAME}} = ""; + + print $out; +} + +sub output_msg($$$) +{ + my ($self, $state, $output) = @_; + + $self->{test_output}->{$state->{NAME}} .= $output; +} + +sub end_testsuite($$$$$) +{ + my ($self, $state, $expected_ret, $ret, $envlog) = @_; + my $out = ""; + + $out .= "TEST RUNTIME: " . (time() - $state->{START_TIME}) . "s\n"; + + if ($ret == $expected_ret) { + $out .= "ALL OK\n"; + } else { + $out .= "ERROR: $ret"; + $out .= $self->{test_output}->{$state->{NAME}}; + } + + $out .= "PCAP FILE: $state->{PCAP_FILE}\n" if defined($state->{PCAP_FILE}); + + $out .= $envlog; + + $out .= "==========================================\n"; + if ($ret == $expected_ret) { + $out .= "TEST PASSED: $state->{NAME}\n"; + } else { + $out .= "TEST FAILED: $state->{NAME} (status $ret)\n"; + } + $out .= "==========================================\n"; + + print $out; +} + +sub start_test($$$) +{ + my ($self, $state, $testname) = @_; +} + +sub end_test($$$$$) +{ + my ($self, $state, $testname, $result, $expected) = @_; +} + +sub summary($) +{ + my ($self) = @_; +} + +sub missing_env($$$) +{ + my ($self, $name, $envname) = @_; + + print "FAIL: $name (ENV[$envname] not available!)\n"; +} + +1; diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm new file mode 100644 index 0000000000..05a8bcce18 --- /dev/null +++ b/source4/selftest/output/plain.pm @@ -0,0 +1,101 @@ +#!/usr/bin/perl + +package output::plain; +use Exporter; +@ISA = qw(Exporter); + +use strict; + +sub new($$$$) { + my ($class, $verbose, $immediate, $statistics) = @_; + my $self = { + verbose => $verbose, + immediate => $immediate, + statistics => $statistics, + test_output => {}, + suitesfailed => [], + start => time() + }; + bless($self, $class); +} + +sub output_msg($$$); + +sub start_testsuite($$) +{ + my ($self, $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 .= "] $state->{NAME}\n", + + $self->{test_output}->{$state->{NAME}} = "" unless($self->{verbose}); + + $self->output_msg($state, "CMD: $state->{CMD}\n"); + + print $out; +} + +sub output_msg($$$) +{ + my ($self, $state, $output) = @_; + + if ($self->{verbose}) { + print $output; + } else { + $self->{test_output}->{$state->{NAME}} .= $output; + } +} + +sub end_testsuite($$$$$) +{ + my ($self, $state, $expected_ret, $ret, $envlog) = @_; + my $out = ""; + + if ($ret != $expected_ret) { + $self->output_msg($state, "ERROR: $ret\n"); + } + + if ($ret != $expected_ret and $self->{immediate} and not $self->{verbose}) { + $out .= $self->{test_output}->{$state->{NAME}}; + } + + print $out; +} + +sub start_test($$) +{ + my ($state, $testname) = @_; +} + +sub end_test($$$$) +{ + my ($state, $testname, $result, $unexpected) = @_; +} + +sub summary($) +{ + my ($self) = @_; + + if (not $self->{immediate} and not $self->{verbose}) { + foreach (@{$self->{suitesfailed}}) { + print "===============================================================================\n"; + print "FAIL: $_\n"; + print $self->{test_output}->{$_}; + print "\n"; + } + } + + print "FAILED ($self->{statistics}->{TESTS_UNEXPECTED_FAIL} failures and $self->{statistics}->{TESTS_ERROR} errors in $self->{statistics}->{SUITES_FAIL} testsuites)\n"; +} + +sub missing_env($$$) +{ + my ($self, $name, $envname) = @_; + + print "FAIL: $name (ENV[$envname] not available!)\n"; +} + +1; -- cgit From b5e36e528155854be1b30cfd1e08d35e3e76f7b2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 12 Aug 2007 04:00:15 +0000 Subject: r24345: Add --format=html option to selftest. (This used to be commit de66bced9468b338e94d430a474616016c6078a5) --- source4/selftest/output/buildfarm.pm | 7 ++ source4/selftest/output/html.pm | 130 +++++++++++++++++++++++++++++++++++ source4/selftest/output/plain.pm | 7 ++ 3 files changed, 144 insertions(+) create mode 100644 source4/selftest/output/html.pm (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm index 11d65d7306..a605f1736c 100644 --- a/source4/selftest/output/buildfarm.pm +++ b/source4/selftest/output/buildfarm.pm @@ -92,4 +92,11 @@ sub missing_env($$$) print "FAIL: $name (ENV[$envname] not available!)\n"; } +sub skip_testsuite($$) +{ + my ($self, $name) = @_; + + print "SKIPPED: $name\n"; +} + 1; diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm new file mode 100644 index 0000000000..6e83d811e8 --- /dev/null +++ b/source4/selftest/output/html.pm @@ -0,0 +1,130 @@ +#!/usr/bin/perl + +package output::html; +use Exporter; +@ISA = qw(Exporter); + +use strict; + +sub new($$$$) { + my ($class, $dirname, $statistics) = @_; + my $self = { + dirname => $dirname, + statistics => $statistics, + active_test => undef, + msg => "" + }; + + open(INDEX, ">$dirname/index.html"); + + print INDEX "\n"; + print INDEX "\n"; + print INDEX "\n"; + print INDEX "\n"; + + $self->{INDEX} = *INDEX; + + bless($self, $class); +} + +sub output_msg($$$); + +sub start_testsuite($$) +{ + my ($self, $state) = @_; + + $state->{HTMLFILE} = "$state->{NAME}.html"; + + $state->{HTMLFILE} =~ s/[:\t\n ]/_/g; + + open(TEST, ">$self->{dirname}/$state->{HTMLFILE}"); + + print TEST "\n"; + print TEST "\n"; +} + +sub output_msg($$$) +{ + my ($self, $state, $output) = @_; + + unless (defined($self->{active_test})) { + print TEST "$output
"; + } else { + $self->{msg} .= "$output
"; + } +} + +sub end_testsuite($$$$$) +{ + my ($self, $state, $expected_ret, $ret, $envlog) = @_; + + print TEST "\n"; + print TEST "\n"; + + close(TEST); + + print {$self->{INDEX}} ""; + + if ($ret == $expected_ret) { + print {$self->{INDEX}} ""; + } else { + print {$self->{INDEX}} ""; + } + + print {$self->{INDEX}} "\n"; + + print {$self->{INDEX}} "\n"; +} + +sub start_test($$$) +{ + my ($self, $state, $testname) = @_; + + print TEST "

$testname

\n"; + + $self->{active_test} = $testname; + $self->{msg} = ""; +} + +sub end_test($$$$$) +{ + my ($self, $state, $testname, $result, $unexpected) = @_; + + if ($result eq "skip") { + print TEST "
\n"; + } elsif ($unexpected) { + print TEST "
\n"; + } + + print TEST $self->{msg}; + + print TEST "
\n"; + + $self->{active_test} = undef; +} + +sub summary($) +{ + my ($self) = @_; + print {$self->{INDEX}} "
TestEnvironmentResultDuration
{HTMLFILE}\">$state->{NAME}$state->{ENVNAME}OKFAIL" . (time() - $state->{START_TIME}) . "
\n"; + print {$self->{INDEX}} "FAILED ($self->{statistics}->{TESTS_UNEXPECTED_FAIL} failures and $self->{statistics}->{TESTS_ERROR} errors in $self->{statistics}->{SUITES_FAIL} testsuites)\n"; + + print {$self->{INDEX}} "\n"; + print {$self->{INDEX}} "\n"; +} + +sub missing_env($$$) +{ + my ($self, $name, $envname) = @_; + + print "FAIL: $name (ENV[$envname] not available!)\n"; +} + +sub skip_testsuite($$) +{ + my ($self, $name) = @_; + + print {$self->{INDEX}} "$nameN/ASKIPPEDN/A\n"; +} + +1; diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index 05a8bcce18..d3ffe228a7 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -98,4 +98,11 @@ sub missing_env($$$) print "FAIL: $name (ENV[$envname] not available!)\n"; } +sub skip_testsuite($$) +{ + my ($self, $name) = @_; + + print "SKIPPED: $name\n"; +} + 1; -- cgit From 8e789517b723955f1530837058d5e9fe98aba19f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 26 Aug 2007 14:07:23 +0000 Subject: r24665: Close file handles properly. (This used to be commit 7f914b08a77c6035918d9f4463990f1dd8f3efb9) --- source4/selftest/output/html.pm | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index 6e83d811e8..d181516002 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -5,6 +5,7 @@ use Exporter; @ISA = qw(Exporter); use strict; +use warnings; sub new($$$$) { my ($class, $dirname, $statistics) = @_; @@ -48,9 +49,9 @@ sub output_msg($$$) my ($self, $state, $output) = @_; unless (defined($self->{active_test})) { - print TEST "$output
"; + print TEST "$output
"; } else { - $self->{msg} .= "$output
"; + $self->{msg} .= "$output
"; } } @@ -63,17 +64,17 @@ sub end_testsuite($$$$$) close(TEST); - print {$self->{INDEX}} "{HTMLFILE}\">$state->{NAME}$state->{ENVNAME}"; + print INDEX "{HTMLFILE}\">$state->{NAME}$state->{ENVNAME}"; if ($ret == $expected_ret) { - print {$self->{INDEX}} "OK"; + print INDEX "OK"; } else { - print {$self->{INDEX}} "FAIL"; + print INDEX "FAIL"; } - print {$self->{INDEX}} "" . (time() - $state->{START_TIME}) . "\n"; + print INDEX "" . (time() - $state->{START_TIME}) . "\n"; - print {$self->{INDEX}} "\n"; + print INDEX "\n"; } sub start_test($$$) @@ -106,11 +107,13 @@ sub end_test($$$$$) sub summary($) { my ($self) = @_; - print {$self->{INDEX}} "\n"; - print {$self->{INDEX}} "FAILED ($self->{statistics}->{TESTS_UNEXPECTED_FAIL} failures and $self->{statistics}->{TESTS_ERROR} errors in $self->{statistics}->{SUITES_FAIL} testsuites)\n"; + print INDEX "\n"; + print INDEX "FAILED ($self->{statistics}->{TESTS_UNEXPECTED_FAIL} failures and $self->{statistics}->{TESTS_ERROR} errors in $self->{statistics}->{SUITES_FAIL} testsuites)\n"; - print {$self->{INDEX}} "\n"; - print {$self->{INDEX}} "\n"; + print INDEX "\n"; + print INDEX "\n"; + + close(INDEX); } sub missing_env($$$) @@ -124,7 +127,7 @@ sub skip_testsuite($$) { my ($self, $name) = @_; - print {$self->{INDEX}} "$nameN/ASKIPPEDN/A\n"; + print INDEX "$nameN/ASKIPPEDN/A\n"; } 1; -- cgit From 3f6cf9672ba1d25f10cbd0bb8ce1525c592a8e78 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 26 Aug 2007 16:56:41 +0000 Subject: r24669: Add CSS to the test run HTML output. See http://samba.org/~jelmer/ for an example of the current output. (This used to be commit 1e57394e865a9122bddb3413088a19d4f57a3e3d) --- source4/selftest/output/html.pm | 70 +++++++++++++++++-------- source4/selftest/output/plain.pm | 8 ++- source4/selftest/output/testresults.css | 92 +++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+), 22 deletions(-) create mode 100644 source4/selftest/output/testresults.css (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index d181516002..5a7ee15af2 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -16,14 +16,27 @@ sub new($$$$) { msg => "" }; + link("selftest/output/testresults.css", "$dirname/testresults.css"); + open(INDEX, ">$dirname/index.html"); - print INDEX "\n"; + print INDEX "\n"; + print INDEX "\n"; + print INDEX " Samba Testsuite Run\n"; + print INDEX " \n"; + print INDEX "\n"; print INDEX "\n"; - print INDEX "\n"; - print INDEX "\n"; - - $self->{INDEX} = *INDEX; + print INDEX "
TestEnvironmentResultDuration
\n"; + print INDEX " \n"; + print INDEX "
Samba Testsuite Run
\n"; + print INDEX "
"; + print INDEX " \n"; + print INDEX " \n"; + print INDEX " \n"; + print INDEX " \n"; + print INDEX " \n"; + print INDEX " \n"; + print INDEX " \n"; bless($self, $class); } @@ -35,13 +48,22 @@ sub start_testsuite($$) my ($self, $state) = @_; $state->{HTMLFILE} = "$state->{NAME}.html"; + $state->{HTMLFILE} =~ s/[:\t\n \/]/_/g; - $state->{HTMLFILE} =~ s/[:\t\n ]/_/g; + open(TEST, ">$self->{dirname}/$state->{HTMLFILE}") or die("Unable to open $state->{HTMLFILE} for writing"); - open(TEST, ">$self->{dirname}/$state->{HTMLFILE}"); + my $title = "Test Results for $state->{NAME}"; - print TEST "\n"; + print TEST "\n"; + print TEST "\n"; + print TEST " $title\n"; + print TEST " \n"; + print TEST "\n"; print TEST "\n"; + print TEST "
TestEnvironmentResultDuration
\n"; + print TEST " \n"; + print TEST " "; + print INDEX ""; if ($ret == $expected_ret) { - print INDEX ""; + print INDEX ""; } else { - print INDEX ""; + print INDEX ""; } - print INDEX "\n"; + print INDEX "\n"; print INDEX "\n"; } @@ -81,8 +104,6 @@ sub start_test($$$) { my ($self, $state, $testname) = @_; - print TEST "

$testname

\n"; - $self->{active_test} = $testname; $self->{msg} = ""; } @@ -91,15 +112,21 @@ sub end_test($$$$$) { my ($self, $state, $testname, $result, $unexpected) = @_; + print TEST ""; + if ($result eq "skip") { - print TEST "
\n"; + print TEST "
\n"; $self->{active_test} = undef; } @@ -107,12 +134,13 @@ sub end_test($$$$$) sub summary($) { my ($self) = @_; - print INDEX "
$title
\n"; + print TEST " \n"; } sub output_msg($$$) @@ -59,20 +81,21 @@ sub end_testsuite($$$$$) { my ($self, $state, $expected_ret, $ret, $envlog) = @_; + print TEST "
\n"; print TEST "\n"; print TEST "\n"; close(TEST); - print INDEX "
{HTMLFILE}\">$state->{NAME}$state->{ENVNAME}
{HTMLFILE}\">$state->{NAME}$state->{ENVNAME}OKOKFAILFAIL" . (time() - $state->{START_TIME}) . "" . (time() - $state->{START_TIME}) . "
\n"; } elsif ($unexpected) { - print TEST "
\n"; + print TEST "
\n"; + } else { + print TEST "\n"; } + print TEST "

$testname

\n"; + print TEST $self->{msg}; - print TEST "\n"; + print TEST "
\n"; - print INDEX "FAILED ($self->{statistics}->{TESTS_UNEXPECTED_FAIL} failures and $self->{statistics}->{TESTS_ERROR} errors in $self->{statistics}->{SUITES_FAIL} testsuites)\n"; + print INDEX "
\n"; + print INDEX "\n"; + print INDEX "\n"; + print INDEX "\n"; print INDEX "\n"; print INDEX "\n"; - close(INDEX); } @@ -127,7 +155,7 @@ sub skip_testsuite($$) { my ($self, $name) = @_; - print INDEX "$nameN/ASKIPPEDN/A\n"; + print INDEX "$nameN/ASKIPPEDN/A\n"; } 1; diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index d3ffe228a7..2aa01145d0 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -88,7 +88,13 @@ sub summary($) } } - print "FAILED ($self->{statistics}->{TESTS_UNEXPECTED_FAIL} failures and $self->{statistics}->{TESTS_ERROR} errors in $self->{statistics}->{SUITES_FAIL} testsuites)\n"; + if ($self->{statistics}->{SUITES_FAIL} == 0) { + my $ok = $self->{statistics}->{TESTS_EXPECTED_OK} + + $self->{statistics}->{TESTS_EXPECTED_FAIL}; + print "ALL OK ($ok tests in $self->{statistics}->{SUITES_OK} testsuites)\n"; + } else { + print "FAILED ($self->{statistics}->{TESTS_UNEXPECTED_FAIL} failures and $self->{statistics}->{TESTS_ERROR} errors in $self->{statistics}->{SUITES_FAIL} testsuites)\n"; + } } sub missing_env($$$) diff --git a/source4/selftest/output/testresults.css b/source4/selftest/output/testresults.css new file mode 100644 index 0000000000..b37f881f20 --- /dev/null +++ b/source4/selftest/output/testresults.css @@ -0,0 +1,92 @@ +/* Stylesheet for Samba test results. + * + * Partially based on the CSS file from lcov. + */ + +/* All views: main title format */ +td.title +{ + text-align: center; + padding-bottom: 10px; + font-family: sans-serif; + font-size: 20pt; + font-style: italic; + font-weight: bold; +} + +/* Index table headers */ +td.tableHead +{ + text-align: center; + color: #FFFFFF; + background-color: #6688D4; + font-family: sans-serif; + font-size: 120%; + font-weight: bold; +} + +/* Testsuite names */ +td.testSuite +{ + text-align: left; + padding-left: 10px; + padding-right: 20px; + color: #284FA8; + background-color: #DAE7FE; + font-family: monospace; +} + +/* Successful */ +td.resultOk +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #A7FC9D; + font-weight: bold; +} + +/* Failure */ +td.resultFailure +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #FF0000; + font-weight: bold; +} + +/* Skipped */ +td.resultSkipped +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #FFEA20; + font-weight: bold; +} + +td.duration +{ + text-align: right; +} + +td.durationSkipped +{ + text-align: right; +} + +td.outputSkipped +{ + background-color: #FFEA20; +} + +td.outputOk +{ + background-color: #A7FC9D; +} + +td.outputFailure +{ + background-color: #FF0000; +} -- cgit From 04e8c10f9e1dcd9edf94ae071a51f5e93ecc2a2e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 26 Aug 2007 19:07:46 +0000 Subject: r24671: More improvements to the HTML test suite results: hide control messages, improve summary, stylesheet. (This used to be commit fcc2320417707ec803d706a923a231fbd1bb72a7) --- source4/selftest/output/buildfarm.pm | 11 +++- source4/selftest/output/html.pm | 103 +++++++++++++++++++++++++++++--- source4/selftest/output/plain.pm | 11 +++- source4/selftest/output/testresults.css | 19 +++++- 4 files changed, 131 insertions(+), 13 deletions(-) (limited to 'source4/selftest/output') 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 " Test\n"; print INDEX " Environment\n"; print INDEX " Result\n"; - print INDEX " Duration\n"; print INDEX " \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 " \n"; } +sub control_msg($$$) +{ + my ($self, $state, $output) = @_; + + $self->{msg} .= "$output
\n"; +} + sub output_msg($$$) { my ($self, $state, $output) = @_; @@ -82,21 +96,55 @@ sub end_testsuite($$$$$) my ($self, $state, $expected_ret, $ret, $envlog) = @_; print TEST "
\n"; + + print TEST "
Duration: " . (time() - $state->{START_TIME}) . "s
\n"; print TEST "\n"; print TEST "\n"; close(TEST); - print INDEX "{HTMLFILE}\">$state->{NAME}$state->{ENVNAME}"; + print INDEX "\n"; + print INDEX " {HTMLFILE}\">$state->{NAME}\n"; + print INDEX " $state->{ENVNAME}\n"; + my $st = $self->{local_statistics}; if ($ret == $expected_ret) { - print INDEX "OK"; + print INDEX " "; } else { - print INDEX "FAIL"; + print INDEX " "; } - print INDEX "" . (time() - $state->{START_TIME}) . "\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 ""; + print INDEX "\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 ""; + $self->{local_statistics}->{$result}++; + if ($result eq "skip") { print TEST "\n"; } elsif ($unexpected) { @@ -126,6 +176,10 @@ sub end_test($$$$$) print TEST $self->{msg}; + if (defined($reason)) { + print TEST "
$reason
\n"; + } + print TEST "\n"; $self->{active_test} = undef; @@ -135,6 +189,36 @@ sub summary($) { my ($self) = @_; + my $st = $self->{statistics}; + print INDEX "\n"; + print INDEX " Total\n"; + print INDEX " \n"; + + if ($st->{SUITES_FAIL} == 0) { + print INDEX " "; + } else { + print INDEX " "; + } + print INDEX "$st->{TESTS_EXPECTED_OK} ok"; + if ($st->{TESTS_UNEXPECTED_OK} > 0) { + print INDEX " ($st->{TESTS_UNEXPECTED_OK})"; + } + print INDEX ""; + 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 ""; + + print INDEX "\n"; + print INDEX "\n"; print INDEX "\n"; print INDEX "\n"; @@ -155,7 +239,10 @@ sub skip_testsuite($$) { my ($self, $name) = @_; - print INDEX "$nameN/ASKIPPEDN/A\n"; + print INDEX "\n"; + print INDEX " $name\n"; + print INDEX " SKIPPED\n"; + print INDEX "\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; +} -- cgit From 90870011435a09e806767b555f178e17b1b4c313 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 26 Aug 2007 20:14:28 +0000 Subject: r24678: More improvements to html output; list unexpected successes and failures seperately from expected ones. (This used to be commit 14fda5260d49a89d7e74302958fe27b73415e6a1) --- source4/selftest/output/html.pm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index afbe63177a..3b95a3d9b8 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -199,17 +199,16 @@ sub summary($) } else { print INDEX " "; } - print INDEX "$st->{TESTS_EXPECTED_OK} ok"; + print INDEX ($st->{TESTS_EXPECTED_OK} + $st->{TESTS_UNEXPECTED_OK}) + " ok"; if ($st->{TESTS_UNEXPECTED_OK} > 0) { - print INDEX " ($st->{TESTS_UNEXPECTED_OK})"; + print INDEX " ($st->{TESTS_UNEXPECTED_OK} unexpected)"; } - print INDEX ""; if ($st->{TESTS_SKIP} > 0) { print INDEX ", $st->{TESTS_SKIP} skipped"; } - print INDEX ", $st->{TESTS_EXPECTED_FAIL} failures"; + print INDEX ", " . ($st->{TESTS_UNEXPECTED_FAIL} + $st->{TESTS_EXPECTED_FAIL}) . " failures"; if ($st->{TESTS_UNEXPECTED_OK} > 0) { - print INDEX " ($st->{TESTS_UNEXPECTED_FAIL})"; + print INDEX " ($st->{TESTS_EXPECTED_FAIL} expected)"; } if ($st->{TESTS_ERROR} > 0) { print INDEX ", $st->{TESTS_ERROR} errors"; @@ -232,7 +231,10 @@ sub missing_env($$$) { my ($self, $name, $envname) = @_; - print "FAIL: $name (ENV[$envname] not available!)\n"; + print INDEX "\n"; + print INDEX " $name\n"; + print INDEX " SKIPPED - environment `$envname` not available!\n"; + print INDEX "\n"; } sub skip_testsuite($$) -- cgit From c021c7d648944c1e4fed3946470c9b74591a4278 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 26 Aug 2007 23:22:54 +0000 Subject: r24687: Registry tests are succeeding now so remove from known failure list, add summary page with failures and skipped tests to html output. (This used to be commit 227659c2c05f76a37e1c9d20dc3f8b6966a111df) --- source4/selftest/output/html.pm | 121 ++++++++++++++++++++++++++++++---------- 1 file changed, 91 insertions(+), 30 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index 3b95a3d9b8..383556903d 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -14,22 +14,25 @@ sub new($$$$) { statistics => $statistics, active_test => undef, local_statistics => {}, - msg => "" + msg => "", + error_summary => { + skip => [], + expected_success => [], + unexpected_success => [], + expected_failure => [], + unexpected_failure => [], + error => [] + } }; link("selftest/output/testresults.css", "$dirname/testresults.css"); open(INDEX, ">$dirname/index.html"); - print INDEX "\n"; - print INDEX "\n"; - print INDEX " Samba Testsuite Run\n"; - print INDEX " \n"; - print INDEX "\n"; - print INDEX "\n"; - print INDEX "\n"; - print INDEX " \n"; - print INDEX " \n"; - print INDEX "
Samba Testsuite Run
\n"; + bless($self, $class); + + $self->print_html_header("Samba Testsuite Run", *INDEX); + print INDEX "
"; print INDEX " \n"; print INDEX " \n"; @@ -38,7 +41,32 @@ sub new($$$$) { print INDEX " \n"; print INDEX " \n"; - bless($self, $class); + return $self; +} + +sub print_html_header($$$) +{ + my ($self, $title, $fh) = @_; + + print $fh "\n"; + print $fh "\n"; + print $fh " $title\n"; + print $fh " \n"; + print $fh "\n"; + print $fh "\n"; + print $fh "
Result
\n"; + print $fh " \n"; + print $fh " \n"; + print $fh "
$title
\n"; +} + +sub print_html_footer($$) +{ + my ($self, $fh) = @_; + + print $fh "
\n"; + print $fh "\n"; + print $fh "\n"; } sub output_msg($$$); @@ -59,17 +87,8 @@ sub start_testsuite($$) open(TEST, ">$self->{dirname}/$state->{HTMLFILE}") or die("Unable to open $state->{HTMLFILE} for writing"); - my $title = "Test Results for $state->{NAME}"; - - print TEST "\n"; - print TEST "\n"; - print TEST " $title\n"; - print TEST " \n"; - print TEST "\n"; - print TEST "\n"; - print TEST "\n"; - print TEST " \n"; - print TEST "
$title
\n"; + $self->print_html_header("Test Results for $state->{NAME}", + *TEST); print TEST " \n"; } @@ -98,8 +117,8 @@ sub end_testsuite($$$$$) print TEST "
\n"; print TEST "
Duration: " . (time() - $state->{START_TIME}) . "s
\n"; - print TEST "\n"; - print TEST "\n"; + + $self->print_html_footer(*TEST); close(TEST); @@ -164,15 +183,28 @@ sub end_test($$$$$$) $self->{local_statistics}->{$result}++; + my $track_class; + if ($result eq "skip") { print TEST "
\n"; + $track_class = "skip"; } elsif ($unexpected) { print TEST "\n"; + if ($result eq "error") { + $track_class = "error"; + } else { + $track_class = "unexpected_$result"; + } } else { print TEST "\n"; + $track_class = "expected_$result"; } - print TEST "

$testname

\n"; + push(@{$self->{error_summary}->{$track_class}}, , + [$state->{HTMLFILE}, $testname, $state->{NAME}, + $reason]); + + print TEST "

$testname

\n"; print TEST $self->{msg}; @@ -199,7 +231,7 @@ sub summary($) } else { print INDEX "
"; } - print INDEX ($st->{TESTS_EXPECTED_OK} + $st->{TESTS_UNEXPECTED_OK}) + " ok"; + print INDEX ($st->{TESTS_EXPECTED_OK} + $st->{TESTS_UNEXPECTED_OK}) . " ok"; if ($st->{TESTS_UNEXPECTED_OK} > 0) { print INDEX " ($st->{TESTS_UNEXPECTED_OK} unexpected)"; } @@ -220,11 +252,40 @@ sub summary($) print INDEX "
\n"; print INDEX "
\n"; - print INDEX "
\n"; - print INDEX "\n"; - print INDEX "\n"; + $self->print_html_footer(*INDEX); close(INDEX); + + my $summ = $self->{error_summary}; + open(SUMMARY, ">$self->{dirname}/summary.html"); + $self->print_html_header("Summary", *SUMMARY); + sub print_table($$) { + my ($title, $list) = @_; + return if ($#$list == -1); + print SUMMARY "

$title

\n"; + print SUMMARY "\n"; + print SUMMARY "\n"; + print SUMMARY " \n"; + print SUMMARY " \n"; + print SUMMARY " \n"; + print SUMMARY "\n"; + + foreach (@$list) { + print SUMMARY "\n"; + print SUMMARY " \n"; + print SUMMARY " \n"; + print SUMMARY " \n"; + print SUMMARY "\n"; + } + + print SUMMARY "
TestsuiteTestReason
$$_[2]$$_[1]$$_[3]
"; + } + print_table("Errors", $summ->{error}); + print_table("Unexpected successes", $summ->{unexpected_success}); + print_table("Unexpected failures", $summ->{unexpected_failure}); + print_table("Skipped tests", $summ->{skip}); + print_table("Expected failures", $summ->{expected_failure}); + $self->print_html_footer(*SUMMARY); + close(SUMMARY); } sub missing_env($$$) -- cgit From bae97f1631d9722294c30eb35552a61b75f25c30 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 27 Aug 2007 00:38:42 +0000 Subject: r24692: Color expected fialures orange rather than green. (This used to be commit cadfc0a7a1a86122f9dc5f127c0cd8be89cdaf46) --- source4/selftest/output/html.pm | 20 +++++++++++++++----- source4/selftest/output/testresults.css | 15 +++++++++++++++ 2 files changed, 30 insertions(+), 5 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index 383556903d..a88788fd14 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -128,7 +128,11 @@ sub end_testsuite($$$$$) my $st = $self->{local_statistics}; if ($ret == $expected_ret) { - print INDEX " "; + if ($ret == 0) { + print INDEX " "; + } else { + print INDEX " "; + } } else { print INDEX " "; } @@ -196,7 +200,11 @@ sub end_test($$$$$$) $track_class = "unexpected_$result"; } } else { - print TEST "\n"; + if ($result eq "failure") { + print TEST "\n"; + } else { + print TEST "\n"; + } $track_class = "expected_$result"; } @@ -238,9 +246,11 @@ sub summary($) if ($st->{TESTS_SKIP} > 0) { print INDEX ", $st->{TESTS_SKIP} skipped"; } - print INDEX ", " . ($st->{TESTS_UNEXPECTED_FAIL} + $st->{TESTS_EXPECTED_FAIL}) . " failures"; - if ($st->{TESTS_UNEXPECTED_OK} > 0) { - print INDEX " ($st->{TESTS_EXPECTED_FAIL} expected)"; + if (($st->{TESTS_UNEXPECTED_FAIL} + $st->{TESTS_EXPECTED_FAIL}) > 0) { + print INDEX ", " . ($st->{TESTS_UNEXPECTED_FAIL} + $st->{TESTS_EXPECTED_FAIL}) . " failures"; + if ($st->{TESTS_UNEXPECTED_FAIL} > 0) { + print INDEX " ($st->{TESTS_EXPECTED_FAIL} expected)"; + } } if ($st->{TESTS_ERROR} > 0) { print INDEX ", $st->{TESTS_ERROR} errors"; diff --git a/source4/selftest/output/testresults.css b/source4/selftest/output/testresults.css index 9f3b6c9e82..56c4b0ead4 100644 --- a/source4/selftest/output/testresults.css +++ b/source4/selftest/output/testresults.css @@ -56,6 +56,16 @@ td.resultFailure font-weight: bold; } +/* Expected failure */ +td.resultExpectedFailure +{ + text-align: right; + padding-left: 10px; + padding-right: 10px; + background-color: #FFA500; + font-weight: bold; +} + /* Skipped */ td.resultSkipped { @@ -91,6 +101,11 @@ td.outputFailure background-color: #FF0000; } +td.outputExpectedFailure +{ + background-color: #FFA500; +} + div.reason { text-align: center; -- cgit From bcfef9f04b694d38130beaf6184db7064132c9f3 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 27 Aug 2007 14:06:25 +0000 Subject: r24705: Avoid undefined value warnings. (This used to be commit 10f266e4d6a821a91bfa612d744eb7a4bab4ba6a) --- source4/selftest/output/html.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index a88788fd14..156b5b98c7 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -283,7 +283,11 @@ sub summary($) print SUMMARY "\n"; print SUMMARY " $$_[2]\n"; print SUMMARY " $$_[1]\n"; - print SUMMARY " $$_[3]\n"; + if (defined($$_[3])) { + print SUMMARY " $$_[3]\n"; + } else { + print SUMMARY " \n"; + } print SUMMARY "\n"; } -- cgit From 51cdf8bc042835edbf8d08bd729193fab9bd5b35 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 31 Aug 2007 13:24:59 +0000 Subject: r24834: Pass environment name on to skip_testsuite(). (This used to be commit 2ac1f32506c9fdfbe836f605b2152a9e094dc733) --- source4/selftest/output/buildfarm.pm | 4 ++-- source4/selftest/output/html.pm | 7 ++++--- source4/selftest/output/plain.pm | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm index 7d6c3a987a..d35fe9f250 100644 --- a/source4/selftest/output/buildfarm.pm +++ b/source4/selftest/output/buildfarm.pm @@ -99,9 +99,9 @@ sub missing_env($$$) print "FAIL: $name (ENV[$envname] not available!)\n"; } -sub skip_testsuite($$) +sub skip_testsuite($$$) { - my ($self, $name) = @_; + my ($self, $envname, $name) = @_; print "SKIPPED: $name\n"; } diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index 156b5b98c7..79775961c0 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -312,13 +312,14 @@ sub missing_env($$$) print INDEX "\n"; } -sub skip_testsuite($$) +sub skip_testsuite($$$) { - my ($self, $name) = @_; + my ($self, $envname, $name) = @_; print INDEX "\n"; print INDEX " $name\n"; - print INDEX " SKIPPED\n"; + print INDEX " $envname\n"; + print INDEX " SKIPPED\n"; print INDEX "\n"; } diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index 10d6eee215..736a138b07 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -111,9 +111,9 @@ sub missing_env($$$) print "FAIL: $name (ENV[$envname] not available!)\n"; } -sub skip_testsuite($$) +sub skip_testsuite($$$) { - my ($self, $name) = @_; + my ($self, $envname, $name) = @_; print "SKIPPED: $name\n"; } -- cgit From c3077a9e4bd3fd61055a1824946f6f2fb4aec583 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 1 Sep 2007 00:36:01 +0000 Subject: r24860: Make it easier to run selftest.pl in a Samba3 source tree. (This used to be commit 53ec879e3168e9f56e774f0b0d70aeebb3795f8e) --- source4/selftest/output/html.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index 79775961c0..c4f94fb6b0 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 = { @@ -25,7 +27,7 @@ sub new($$$$) { } }; - link("selftest/output/testresults.css", "$dirname/testresults.css"); + link("$RealBin/output/testresults.css", "$dirname/testresults.css"); open(INDEX, ">$dirname/index.html"); -- cgit From 2aea6fe95f2788b080cb0261a1efd6907cf4d6d1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 1 Sep 2007 21:02:57 +0000 Subject: r24869: Print command that was executed. (This used to be commit 9aabcafba612afafb1c3260b79a899ea463f8d32) --- source4/selftest/output/html.pm | 1 + source4/selftest/output/testresults.css | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index c4f94fb6b0..44846dc9dd 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -118,6 +118,7 @@ sub end_testsuite($$$$$) print TEST "\n"; + print TEST "
$state->{CMD}
\n"; print TEST "
Duration: " . (time() - $state->{START_TIME}) . "s
\n"; $self->print_html_footer(*TEST); 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; +} -- cgit From 0271566a5b3211735faad67e37e2d0474996b710 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 2 Sep 2007 00:24:38 +0000 Subject: r24878: Support specifying a reason for skips/expected failures (This used to be commit 84c94b37fed837c7a45f59746de80d20063d93e8) --- source4/selftest/output/buildfarm.pm | 10 +++++++--- source4/selftest/output/html.pm | 10 +++++++--- source4/selftest/output/plain.pm | 8 ++++++-- 3 files changed, 20 insertions(+), 8 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm index d35fe9f250..97c2ec0c40 100644 --- a/source4/selftest/output/buildfarm.pm +++ b/source4/selftest/output/buildfarm.pm @@ -99,11 +99,15 @@ sub missing_env($$$) print "FAIL: $name (ENV[$envname] not available!)\n"; } -sub skip_testsuite($$$) +sub skip_testsuite($$$$) { - my ($self, $envname, $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/html.pm b/source4/selftest/output/html.pm index 44846dc9dd..2a2a12b63d 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -315,14 +315,18 @@ sub missing_env($$$) print INDEX "\n"; } -sub skip_testsuite($$$) +sub skip_testsuite($$$$) { - my ($self, $envname, $name) = @_; + my ($self, $envname, $name, $reason) = @_; print INDEX "\n"; print INDEX " $name\n"; print INDEX " $envname\n"; - print INDEX " SKIPPED\n"; + if ($reason) { + print INDEX " SKIPPED - $reason\n"; + } else { + print INDEX " SKIPPED\n"; + } print INDEX "\n"; } diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index 736a138b07..bbf0f8f414 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -113,9 +113,13 @@ sub missing_env($$$) sub skip_testsuite($$$) { - my ($self, $envname, $name) = @_; + my ($self, $envname, $name, $reason) = @_; - print "SKIPPED: $name\n"; + if ($reason) { + print "SKIPPED: $name [$reason]\n"; + } else { + print "SKIPPED: $name\n"; + } } 1; -- cgit From ac2a7014837b1ce135e732fd7a9b950d9fbc1401 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 2 Sep 2007 02:07:55 +0000 Subject: r24882: Use the torture API in BASE-CHARSET. (This used to be commit 93910d92cd431add876e98a12712253bee8c52e7) --- source4/selftest/output/html.pm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index 2a2a12b63d..7f5d128983 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -309,10 +309,7 @@ sub missing_env($$$) { my ($self, $name, $envname) = @_; - print INDEX "\n"; - print INDEX " $name\n"; - print INDEX " SKIPPED - environment `$envname` not available!\n"; - print INDEX "\n"; + $self->skip_testsuite($envname, $name, "environment `$envname` not available!"); } sub skip_testsuite($$$$) -- cgit From 5def5048ca059b550a27f991a70365ecbc80f19d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 14:12:45 +0000 Subject: r25031: Use pointers to services rather than service numbers when possible. (This used to be commit dde12060ea07ba34fd3f96594559696d52127e7c) --- source4/selftest/output/plain.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index bbf0f8f414..2cb510b7e8 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -77,9 +77,15 @@ 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) = @_; + + if ($unexpected and $self->{immediate} and not $self->{verbose}) { + print "$testname: $result [ $reason ]\n"; + print $self->{test_output}->{$state->{NAME}}."\n"; + } + $self->{test_output}->{$state->{NAME}} = ""; } sub summary($) -- cgit From 98b57d5eb61094a9c88e2f7d90d3e21b7e74e9d8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 16:46:30 +0000 Subject: r25035: Fix some more warnings, use service pointer rather than service number in more places. (This used to be commit df9cebcb97e20564359097148665bd519f31bc6f) --- source4/selftest/output/plain.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index 2cb510b7e8..5cd8e076cb 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -82,7 +82,11 @@ sub end_test($$$$$$) my ($self, $state, $testname, $result, $unexpected, $reason) = @_; if ($unexpected and $self->{immediate} and not $self->{verbose}) { - print "$testname: $result [ $reason ]\n"; + if ($reason) { + print "$testname: $result [ $reason ]\n"; + } else { + print "$testname: $result\n"; + } print $self->{test_output}->{$state->{NAME}}."\n"; } $self->{test_output}->{$state->{NAME}} = ""; -- cgit From 2e6f0016d12000d7b8d8f5094d66e65ef618045b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 11 Sep 2007 23:53:25 +0000 Subject: r25110: Show environment variables in HTML output. (This used to be commit 62e770ace32f0e38863d4020773562e74117fc65) --- source4/selftest/output/html.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index 7f5d128983..52fe241156 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -91,6 +91,27 @@ sub start_testsuite($$) $self->print_html_header("Test Results for $state->{NAME}", *TEST); + + print TEST "

Environment settings

\n"; + + print TEST " \n"; + print TEST " \n"; + foreach (keys %{$state->{ENVVARS}}) { + print TEST " \n"; + } + print TEST "
Variable nameVariable value
$_"; + my $val = $state->{ENVVARS}->{$_}; + if ($val =~ /^\.\// and -r $val) { + print TEST "$val"; + } elsif (-r $val) { + print TEST "$val"; + } else { + print TEST $val; + } + print TEST "
\n"; + + print TEST "

Tests

\n"; + print TEST " \n"; } -- cgit From 44500d6d98eecb5190da35be0a88a4287c08f3d1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 13 Sep 2007 12:22:08 +0000 Subject: r25124: Include link to summary page, hide environment variables for 'none' environment. (This used to be commit 9fac2bd884bc325792d65bcdd166d785269655df) --- source4/selftest/output/html.pm | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index 52fe241156..c96e3e5c5f 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -92,23 +92,25 @@ sub start_testsuite($$) $self->print_html_header("Test Results for $state->{NAME}", *TEST); - print TEST "

Environment settings

\n"; - - print TEST "
\n"; - print TEST " \n"; - foreach (keys %{$state->{ENVVARS}}) { - print TEST "
Variable nameVariable value
$_"; - my $val = $state->{ENVVARS}->{$_}; - if ($val =~ /^\.\// and -r $val) { - print TEST "$val"; - } elsif (-r $val) { - print TEST "$val"; - } else { - print TEST $val; + if ($state->{ENVNAME} ne "none") { + print TEST "

Environment settings

\n"; + + print TEST " \n"; + print TEST " \n"; + foreach (keys %{$state->{ENVVARS}}) { + print TEST " \n"; } - print TEST "\n"; + print TEST "
Variable nameVariable value
$_"; + my $val = $state->{ENVVARS}->{$_}; + if ($val =~ /^\.\// and -r $val) { + print TEST "$val"; + } elsif (-r $val) { + print TEST "$val"; + } else { + print TEST $val; + } + print TEST "
\n"; } - print TEST "
\n"; print TEST "

Tests

\n"; @@ -285,6 +287,7 @@ sub summary($) print INDEX "\n"; print INDEX "\n"; + print INDEX "Summary\n"; print INDEX "\n"; $self->print_html_footer(*INDEX); close(INDEX); -- cgit From 020683680c8999b7e53ed39f9e8c5ff692989d21 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 15 Sep 2007 20:11:28 +0000 Subject: r25182: don't hide the envlog in plain mode metze (This used to be commit 77050171ae1c8157ff2c7722fb0b046efb82411d) --- source4/selftest/output/plain.pm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index 5cd8e076cb..d52c4846c0 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -61,6 +61,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"); } -- cgit From 79e59dfdf278ce9beb751c3b4a69fe88181649d0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 26 Sep 2007 23:36:07 +0000 Subject: r25364: List skipped testsuites in summary only. (This used to be commit cc22be4530f56d8cb862ccf91f386dd587bf9536) --- source4/selftest/output/html.pm | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index c96e3e5c5f..22488576b4 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -23,6 +23,7 @@ sub new($$$$) { unexpected_success => [], expected_failure => [], unexpected_failure => [], + skip_testsuites => [], error => [] } }; @@ -325,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 "

Skipped testsuites

\n"; + print SUMMARY "\n"; + print SUMMARY "\n"; + print SUMMARY " \n"; + print SUMMARY " \n"; + print SUMMARY "\n"; + + foreach (@{$summ->{skip_testsuites}}) { + print SUMMARY "\n"; + print SUMMARY " \n"; + if (defined($$_[2])) { + print SUMMARY " \n"; + } else { + print SUMMARY " \n"; + } + print SUMMARY "\n"; + } + + print SUMMARY "
TestsuiteReason
$$_[1]$$_[2]
"; + $self->print_html_footer(*SUMMARY); close(SUMMARY); } @@ -340,15 +362,8 @@ sub skip_testsuite($$$$) { my ($self, $envname, $name, $reason) = @_; - print INDEX "\n"; - print INDEX " $name\n"; - print INDEX " $envname\n"; - if ($reason) { - print INDEX " SKIPPED - $reason\n"; - } else { - print INDEX " SKIPPED\n"; - } - print INDEX "\n"; + push (@{$self->{error_summary}->{skip_testsuites}}, + [$envname, $name, $reason]); } 1; -- cgit From 08aba81a3675a5a69a0e87e3d08365b7ac00de2f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 27 Sep 2007 22:18:06 +0000 Subject: r25385: Don't clutter the buildfarm output with SKIP: lines. (This used to be commit 70810484eaab1ff5bc15ce312edce556c976423a) --- source4/selftest/output/buildfarm.pm | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm index 97c2ec0c40..953f009c7d 100644 --- a/source4/selftest/output/buildfarm.pm +++ b/source4/selftest/output/buildfarm.pm @@ -103,11 +103,7 @@ sub skip_testsuite($$$$) { my ($self, $envname, $name, $reason) = @_; - if ($reason) { - print "SKIPPED: $name [$reason]\n"; - } else { - print "SKIPPED: $name\n"; - } + # Ignore skipped tests } 1; -- cgit From 59f43d2b58271c4beeab14104014dcd1ae059997 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 29 Sep 2007 08:57:02 +0000 Subject: r25427: fix SELFTEST RUNTIME calculation for the build-farm metze (This used to be commit 554d56aa16c147bbb383e4a40d7fc11fa405a3a8) --- source4/selftest/output/buildfarm.pm | 9 +++++---- source4/selftest/output/plain.pm | 3 +-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm index 953f009c7d..cf30bce6c8 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) = @_; +sub new($$$$) { + my ($class, $verbose, $immediate, $statistics) = @_; my $self = { - start => time(), + 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"; diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index d52c4846c0..12236e518f 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); } -- cgit From 0988b807f65d0d4f4905b9a12598d29eee4f22c1 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 30 Sep 2007 08:26:53 +0000 Subject: r25435: actually pass the statistics to the buildfarm output module to calculate the SELFTEST RUNTIME correct metze (This used to be commit 12e485170909c8e09962aa2080b86455ad6509e5) --- source4/selftest/output/buildfarm.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm index cf30bce6c8..a9077c3372 100644 --- a/source4/selftest/output/buildfarm.pm +++ b/source4/selftest/output/buildfarm.pm @@ -8,8 +8,8 @@ use Exporter; use strict; sub new($$$$) { - my ($class, $verbose, $immediate, $statistics) = @_; - my $self = { + my ($class, $statistics) = @_; + my $self = { statistics => $statistics, test_output => {} }; -- cgit From f069623aceeb74b4e19abc4e81f899f6ada390e5 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 2 Oct 2007 15:52:23 +0000 Subject: r25464: improve build-farm output... metze (This used to be commit 7b5d5777cb8cef5e502ae0851f600c7019eefa17) --- source4/selftest/output/buildfarm.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm index a9077c3372..efb1e3ef5b 100644 --- a/source4/selftest/output/buildfarm.pm +++ b/source4/selftest/output/buildfarm.pm @@ -59,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}}; } @@ -85,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($) -- cgit From 00d2a195547f639b631f95431edc1484a0acd9de Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 2 Oct 2007 15:53:26 +0000 Subject: r25465: improve plain output... metze (This used to be commit 8deb2f068c7574618467859d9335fbd1ca6e49a1) --- source4/selftest/output/plain.pm | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index 12236e518f..e4abb2d05a 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -81,16 +81,21 @@ sub start_test($$) sub end_test($$$$$$) { my ($self, $state, $testname, $result, $unexpected, $reason) = @_; + my $append = ""; - if ($unexpected and $self->{immediate} and not $self->{verbose}) { - if ($reason) { - print "$testname: $result [ $reason ]\n"; - } else { - print "$testname: $result\n"; - } - print $self->{test_output}->{$state->{NAME}}."\n"; + 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}} = ""; } - $self->{test_output}->{$state->{NAME}} = ""; } sub summary($) -- cgit From 90964021eb10264b3df6be9e9d1ea7ab45c7c1da Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 26 Oct 2007 17:13:42 +0200 Subject: r25740: More consistent naming for tests, always include environment name in test name. (This used to be commit 9cfa44b43857df252336b6f88cfc0f7fcd557533) --- source4/selftest/output/html.pm | 2 -- 1 file changed, 2 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index 22488576b4..fbf433e8d1 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -40,7 +40,6 @@ sub new($$$$) { print INDEX " \n"; print INDEX " \n"; print INDEX " \n"; - print INDEX " \n"; print INDEX " \n"; print INDEX " \n"; @@ -151,7 +150,6 @@ sub end_testsuite($$$$$) print INDEX "\n"; print INDEX " \n"; - print INDEX " \n"; my $st = $self->{local_statistics}; if ($ret == $expected_ret) { -- cgit From e690c56ab7180f135ba0e67a24f53282c3f0d144 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 26 Oct 2007 21:15:04 +0200 Subject: r25741: Simplify calls to Subunit functions. (This used to be commit e42de5d8346a12c3fcdb8f9af1efa650c368a442) --- source4/selftest/output/buildfarm.pm | 11 ++--------- source4/selftest/output/html.pm | 11 ++--------- source4/selftest/output/plain.pm | 11 ++--------- 3 files changed, 6 insertions(+), 27 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm index efb1e3ef5b..b5971e47ad 100644 --- a/source4/selftest/output/buildfarm.pm +++ b/source4/selftest/output/buildfarm.pm @@ -97,18 +97,11 @@ sub summary($) my ($self) = @_; } -sub missing_env($$$) -{ - my ($self, $name, $envname) = @_; - - print "FAIL: $name (ENV[$envname] not available!)\n"; -} - sub skip_testsuite($$$$) { - my ($self, $envname, $name, $reason) = @_; + my ($self, $name, $reason) = @_; - # Ignore skipped tests + print "SKIPPED: $name\n"; } 1; diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index fbf433e8d1..b8ee60edf7 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -349,19 +349,12 @@ sub summary($) close(SUMMARY); } -sub missing_env($$$) -{ - my ($self, $name, $envname) = @_; - - $self->skip_testsuite($envname, $name, "environment `$envname` not available!"); -} - sub skip_testsuite($$$$) { - my ($self, $envname, $name, $reason) = @_; + my ($self, $name, $reason) = @_; push (@{$self->{error_summary}->{skip_testsuites}}, - [$envname, $name, $reason]); + [$name, $reason]); } 1; diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index e4abb2d05a..0f70c6085e 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -120,16 +120,9 @@ sub summary($) } } -sub missing_env($$$) +sub skip_testsuite($$) { - my ($self, $name, $envname) = @_; - - print "FAIL: $name (ENV[$envname] not available!)\n"; -} - -sub skip_testsuite($$$) -{ - my ($self, $envname, $name, $reason) = @_; + my ($self, $name, $reason) = @_; if ($reason) { print "SKIPPED: $name [$reason]\n"; -- cgit From 9d4addadc089b52867c98d714894192e832a27d2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 26 Oct 2007 21:25:43 +0200 Subject: r25742: Start trimming down hash size for start_testsuite. (This used to be commit f2319fbe9be76966c81f3d4279f6bc2a631a3a5a) --- source4/selftest/output/buildfarm.pm | 20 ++++++++++---------- source4/selftest/output/html.pm | 13 ++++++------- source4/selftest/output/plain.pm | 14 +++++++------- 3 files changed, 23 insertions(+), 24 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm index b5971e47ad..f3ad9319b4 100644 --- a/source4/selftest/output/buildfarm.pm +++ b/source4/selftest/output/buildfarm.pm @@ -16,21 +16,21 @@ sub new($$$$) { bless($self, $class); } -sub start_testsuite($$) +sub start_testsuite($$$) { - my ($self, $state) = @_; + my ($self, $name, $state) = @_; my $out = ""; my $duration = $state->{START_TIME} - $self->{statistics}->{START_TIME}; $out .= "--==--==--==--==--==--==--==--==--==--==--\n"; - $out .= "Running test $state->{NAME} (level 0 stdout)\n"; + $out .= "Running test $name (level 0 stdout)\n"; $out .= "--==--==--==--==--==--==--==--==--==--==--\n"; $out .= scalar(localtime())."\n"; $out .= "SELFTEST RUNTIME: " . $duration . "s\n"; - $out .= "NAME: $state->{NAME}\n"; + $out .= "NAME: $name\n"; $out .= "CMD: $state->{CMD}\n"; - $self->{test_output}->{$state->{NAME}} = ""; + $self->{test_output}->{$name} = ""; print $out; } @@ -49,9 +49,9 @@ sub control_msg($$$) $self->{test_output}->{$state->{NAME}} .= $output; } -sub end_testsuite($$$$$) +sub end_testsuite($$$$$$) { - my ($self, $state, $expected_ret, $ret, $envlog) = @_; + my ($self, $name, $state, $expected_ret, $ret, $envlog) = @_; my $out = ""; $out .= "TEST RUNTIME: " . (time() - $state->{START_TIME}) . "s\n"; @@ -60,7 +60,7 @@ sub end_testsuite($$$$$) $out .= "ALL OK\n"; } else { $out .= "ERROR: $ret\n"; - $out .= $self->{test_output}->{$state->{NAME}}; + $out .= $self->{test_output}->{$name}; } $out .= "PCAP FILE: $state->{PCAP_FILE}\n" if defined($state->{PCAP_FILE}); @@ -69,9 +69,9 @@ sub end_testsuite($$$$$) $out .= "==========================================\n"; if ($ret == $expected_ret) { - $out .= "TEST PASSED: $state->{NAME}\n"; + $out .= "TEST PASSED: $name\n"; } else { - $out .= "TEST FAILED: $state->{NAME} (status $ret)\n"; + $out .= "TEST FAILED: $name (status $ret)\n"; } $out .= "==========================================\n"; diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index b8ee60edf7..9e83821bc1 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -73,9 +73,9 @@ sub print_html_footer($$) sub output_msg($$$); -sub start_testsuite($$) +sub start_testsuite($$$) { - my ($self, $state) = @_; + my ($self, $name, $state) = @_; $self->{local_statistics} = { success => 0, @@ -84,13 +84,12 @@ sub start_testsuite($$) failure => 0 }; - $state->{HTMLFILE} = "$state->{NAME}.html"; + $state->{HTMLFILE} = "$name.html"; $state->{HTMLFILE} =~ s/[:\t\n \/]/_/g; open(TEST, ">$self->{dirname}/$state->{HTMLFILE}") or die("Unable to open $state->{HTMLFILE} for writing"); - $self->print_html_header("Test Results for $state->{NAME}", - *TEST); + $self->print_html_header("Test Results for $name", *TEST); if ($state->{ENVNAME} ne "none") { print TEST "

Environment settings

\n"; @@ -137,7 +136,7 @@ sub output_msg($$$) sub end_testsuite($$$$$) { - my ($self, $state, $expected_ret, $ret, $envlog) = @_; + my ($self, $name, $state, $expected_ret, $ret, $envlog) = @_; print TEST "
TestEnvironmentResult
{HTMLFILE}\">$state->{NAME}$state->{ENVNAME}
\n"; @@ -149,7 +148,7 @@ sub end_testsuite($$$$$) close(TEST); print INDEX "\n"; - print INDEX " {HTMLFILE}\">$state->{NAME}\n"; + print INDEX " {HTMLFILE}\">$name\n"; my $st = $self->{local_statistics}; if ($ret == $expected_ret) { diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index 0f70c6085e..59b89f84c9 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -20,17 +20,17 @@ sub new($$$$) { sub output_msg($$$); -sub start_testsuite($$) +sub start_testsuite($$$) { - my ($self, $state) = @_; + 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 .= "] $state->{NAME}\n", + $out .= "] $name\n", - $self->{test_output}->{$state->{NAME}} = "" unless($self->{verbose}); + $self->{test_output}->{$name} = "" unless($self->{verbose}); $self->output_msg($state, "CMD: $state->{CMD}\n"); @@ -55,9 +55,9 @@ sub control_msg($$$) $self->output_msg($state, $output); } -sub end_testsuite($$$$$) +sub end_testsuite($$$$$$) { - my ($self, $state, $expected_ret, $ret, $envlog) = @_; + my ($self, $name, $state, $expected_ret, $ret, $envlog) = @_; my $out = ""; $self->output_msg($state, "ENVLOG: $envlog\n") if ($envlog ne ""); @@ -67,7 +67,7 @@ sub end_testsuite($$$$$) } if ($ret != $expected_ret and $self->{immediate} and not $self->{verbose}) { - $out .= $self->{test_output}->{$state->{NAME}}; + $out .= $self->{test_output}->{$name}; } print $out; -- cgit From a7eedba7c4c86356a8453158e59eb95471dd270f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 26 Oct 2007 23:28:36 +0200 Subject: r25743: Write short summary of failed tests and skipped tests to file. (This used to be commit 22cb93e5c00c9bd2a9288ba13336389d45c9987f) --- source4/selftest/output/plain.pm | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index 59b89f84c9..6b196090a1 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -6,14 +6,16 @@ use Exporter; use strict; -sub new($$$$) { - my ($class, $verbose, $immediate, $statistics) = @_; +sub new($$$$$) { + my ($class, $summaryfile, $verbose, $immediate, $statistics) = @_; my $self = { verbose => $verbose, immediate => $immediate, statistics => $statistics, test_output => {}, - suitesfailed => [] + suitesfailed => [], + skips => {}, + summaryfile => $summaryfile, }; bless($self, $class); } @@ -102,12 +104,21 @@ sub summary($) { my ($self) = @_; + open(SUMMARY, ">$self->{summaryfile}"); + + if ($#{$self->{suitesfailed}} > -1) { + print SUMMARY "= Failed tests =\n"; + } + if (not $self->{immediate} and not $self->{verbose}) { foreach (@{$self->{suitesfailed}}) { print "===============================================================================\n"; print "FAIL: $_\n"; print $self->{test_output}->{$_}; print "\n"; + + print SUMMARY "= $_ =\n"; + print SUMMARY $self->{test_output}->{$_}."\n\n"; } } @@ -118,17 +129,25 @@ sub summary($) } else { print "FAILED ($self->{statistics}->{TESTS_UNEXPECTED_FAIL} failures and $self->{statistics}->{TESTS_ERROR} errors in $self->{statistics}->{SUITES_FAIL} testsuites)\n"; } + + print SUMMARY "= Skipped tests =\n"; + foreach my $reason (keys %{$self->{skips}}) { + print SUMMARY "$reason\n"; + foreach my $name (@{$self->{skips}->{$reason}}) { + print SUMMARY "\t$name\n"; + } + print SUMMARY "\n"; + } + close(SUMMARY); + + print "A summary can be found in $self->{summaryfile}\n"; } sub skip_testsuite($$) { my ($self, $name, $reason) = @_; - if ($reason) { - print "SKIPPED: $name [$reason]\n"; - } else { - print "SKIPPED: $name\n"; - } + push (@{$self->{skips}->{$reason}}, $name); } 1; -- cgit From 09ec68baddb5d17a0eb9e142c1f1bbe0603d465e Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 27 Oct 2007 10:00:44 +0200 Subject: r25746: [selftest] make plain output more readable metze (This used to be commit b9363755ee9f6ca7e04729519991f9ba0163ff2f) --- source4/selftest/output/plain.pm | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index 6b196090a1..0406ca7d3d 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -122,14 +122,6 @@ sub summary($) } } - if ($self->{statistics}->{SUITES_FAIL} == 0) { - my $ok = $self->{statistics}->{TESTS_EXPECTED_OK} + - $self->{statistics}->{TESTS_EXPECTED_FAIL}; - print "ALL OK ($ok tests in $self->{statistics}->{SUITES_OK} testsuites)\n"; - } else { - print "FAILED ($self->{statistics}->{TESTS_UNEXPECTED_FAIL} failures and $self->{statistics}->{TESTS_ERROR} errors in $self->{statistics}->{SUITES_FAIL} testsuites)\n"; - } - print SUMMARY "= Skipped tests =\n"; foreach my $reason (keys %{$self->{skips}}) { print SUMMARY "$reason\n"; @@ -140,7 +132,16 @@ sub summary($) } close(SUMMARY); - print "A summary can be found in $self->{summaryfile}\n"; + print "\nA summary with detailed informations can be found in:\n $self->{summaryfile}\n"; + + if ($self->{statistics}->{SUITES_FAIL} == 0) { + my $ok = $self->{statistics}->{TESTS_EXPECTED_OK} + + $self->{statistics}->{TESTS_EXPECTED_FAIL}; + print "\nALL OK ($ok tests in $self->{statistics}->{SUITES_OK} testsuites)\n"; + } else { + print "\nFAILED ($self->{statistics}->{TESTS_UNEXPECTED_FAIL} failures and $self->{statistics}->{TESTS_ERROR} errors in $self->{statistics}->{SUITES_FAIL} testsuites)\n"; + } + } sub skip_testsuite($$) -- cgit From 7267b3505889e00e0f13cd1b7fa9c5bb8dedb4e4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 31 Oct 2007 14:48:48 +0100 Subject: r25764: Fix total number of tests count to not include skipped tests. (This used to be commit d90b058cd48d8b08bb0a0cd6e97ad95062f8259e) --- source4/selftest/output/html.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index 9e83821bc1..fc034cc95f 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -256,7 +256,6 @@ sub summary($) my $st = $self->{statistics}; print INDEX "\n"; print INDEX " Total\n"; - print INDEX " \n"; if ($st->{SUITES_FAIL} == 0) { print INDEX " "; @@ -333,9 +332,9 @@ sub summary($) foreach (@{$summ->{skip_testsuites}}) { print SUMMARY "\n"; - print SUMMARY " $$_[1]\n"; - if (defined($$_[2])) { - print SUMMARY " $$_[2]\n"; + print SUMMARY " $$_[0]\n"; + if (defined($$_[1])) { + print SUMMARY " $$_[1]\n"; } else { print SUMMARY " \n"; } -- cgit From 78a4f5eadad447cd92f27a5fe4311eceea12f1f9 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 11 Dec 2007 14:24:20 +0100 Subject: r26398: Fix writing the output of failed tests to st/summary. (This used to be commit 34b9ddddaffe67de821a19219bcceec75f9d8fdd) --- source4/selftest/output/plain.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index 0406ca7d3d..8a56d1c922 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -70,6 +70,7 @@ sub end_testsuite($$$$$$) if ($ret != $expected_ret and $self->{immediate} and not $self->{verbose}) { $out .= $self->{test_output}->{$name}; + push (@{$self->{suitesfailed}}, $name); } print $out; @@ -108,6 +109,13 @@ sub summary($) if ($#{$self->{suitesfailed}} > -1) { print SUMMARY "= Failed tests =\n"; + + foreach (@{$self->{suitesfailed}}) { + print SUMMARY "== $_ ==\n"; + print SUMMARY $self->{test_output}->{$_}."\n\n"; + } + + print SUMMARY "\n"; } if (not $self->{immediate} and not $self->{verbose}) { @@ -116,9 +124,6 @@ sub summary($) print "FAIL: $_\n"; print $self->{test_output}->{$_}; print "\n"; - - print SUMMARY "= $_ =\n"; - print SUMMARY $self->{test_output}->{$_}."\n\n"; } } -- cgit From 254f1c6fee18dd14d2f9f97d65e6fe9ef04c26f2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 20 Dec 2007 15:54:02 +0100 Subject: r26547: Make testsuites less special during subunit handling. (This used to be commit 0bf6bdcd7f21740853ae852193d51bdf14201782) --- source4/selftest/output/buildfarm.pm | 32 +++++++++++++++++++------------- source4/selftest/output/html.pm | 24 +++++++++++++++++------- source4/selftest/output/plain.pm | 36 ++++++++++++++++++++++-------------- 3 files changed, 58 insertions(+), 34 deletions(-) (limited to 'source4/selftest/output') 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 "\n"; @@ -151,8 +151,8 @@ sub end_testsuite($$$$$) print INDEX " {HTMLFILE}\">$name\n"; my $st = $self->{local_statistics}; - if ($ret == $expected_ret) { - if ($ret == 0) { + if (not $unexpected) { + if ($result eq "failure") { print INDEX " "; } else { print INDEX " "; @@ -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 ""; 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) { -- cgit From 70c9374305fdb39ca92b3490bfdbc23043960637 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 20 Dec 2007 15:54:05 +0100 Subject: r26548: Remove remaining variables from state hash. (This used to be commit 84f5b3e257241f699f3e51d8f282fa00cfd1000a) --- source4/selftest/output/buildfarm.pm | 4 +++- source4/selftest/output/html.pm | 23 ++--------------------- source4/selftest/output/plain.pm | 16 +++++++++++----- 3 files changed, 16 insertions(+), 27 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm index 958124259e..81ffd5012c 100644 --- a/source4/selftest/output/buildfarm.pm +++ b/source4/selftest/output/buildfarm.pm @@ -21,6 +21,9 @@ sub start_testsuite($$$) my ($self, $name, $state) = @_; my $out = ""; + $state->{NAME} = $name; + $state->{START_TIME} = time(); + my $duration = $state->{START_TIME} - $self->{statistics}->{START_TIME}; $out .= "--==--==--==--==--==--==--==--==--==--==--\n"; $out .= "Running test $name (level 0 stdout)\n"; @@ -28,7 +31,6 @@ sub start_testsuite($$$) $out .= scalar(localtime())."\n"; $out .= "SELFTEST RUNTIME: " . $duration . "s\n"; $out .= "NAME: $name\n"; - $out .= "CMD: $state->{CMD}\n"; $self->{test_output}->{$name} = ""; diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index 7f3cfac8cd..13d2f10938 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -84,6 +84,7 @@ sub start_testsuite($$$) failure => 0 }; + $state->{NAME} = $name; $state->{HTMLFILE} = "$name.html"; $state->{HTMLFILE} =~ s/[:\t\n \/]/_/g; @@ -91,26 +92,6 @@ sub start_testsuite($$$) $self->print_html_header("Test Results for $name", *TEST); - if ($state->{ENVNAME} ne "none") { - print TEST "

Environment settings

\n"; - - print TEST " \n"; - print TEST " \n"; - foreach (keys %{$state->{ENVVARS}}) { - print TEST " \n"; - } - print TEST "
Variable nameVariable value
$_"; - my $val = $state->{ENVVARS}->{$_}; - if ($val =~ /^\.\// and -r $val) { - print TEST "$val"; - } elsif (-r $val) { - print TEST "$val"; - } else { - print TEST $val; - } - print TEST "
\n"; - } - print TEST "

Tests

\n"; print TEST " \n"; @@ -140,7 +121,6 @@ sub end_testsuite($$$$$) print TEST "
\n"; - print TEST "
$state->{CMD}
\n"; print TEST "
Duration: " . (time() - $state->{START_TIME}) . "s
\n"; $self->print_html_footer(*TEST); @@ -200,6 +180,7 @@ sub start_test($$$) my ($self, $state, $parents, $testname) = @_; if ($#$parents == -1) { + $state->{START_TIME} = time(); $self->start_testsuite($testname, $state); return; } diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index a11ada871a..af353c3cff 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -6,8 +6,8 @@ use Exporter; use strict; -sub new($$$$$) { - my ($class, $summaryfile, $verbose, $immediate, $statistics) = @_; +sub new($$$$$$) { + my ($class, $summaryfile, $verbose, $immediate, $statistics, $totaltests) = @_; my $self = { verbose => $verbose, immediate => $immediate, @@ -16,6 +16,8 @@ sub new($$$$$) { suitesfailed => [], skips => {}, summaryfile => $summaryfile, + index => 0, + totalsuites => $totaltests, }; bless($self, $class); } @@ -26,14 +28,16 @@ sub start_testsuite($$$) { my ($self, $name, $state) = @_; + $self->{index}++; + $state->{NAME} = $name; + $state->{START_TIME} = time(); + my $duration = $state->{START_TIME} - $self->{statistics}->{START_TIME}; $self->{test_output}->{$name} = "" unless($self->{verbose}); - $self->output_msg($state, "CMD: $state->{CMD}\n"); - my $out = ""; - $out .= "[$state->{INDEX}/$state->{TOTAL} in ".$duration."s"; + $out .= "[$self->{index}/$self->{totalsuites} in ".$duration."s"; $out .= sprintf(", %d errors", $self->{statistics}->{SUITES_FAIL}) if ($self->{statistics}->{SUITES_FAIL} > 0); $out .= "] $name\n", print "$out"; @@ -162,6 +166,8 @@ sub skip_testsuite($$) my ($self, $name, $reason) = @_; push (@{$self->{skips}->{$reason}}, $name); + + $self->{totalsuites}--; } 1; -- cgit From 1ae762d3bc924245aa96378929a9a048d385a61e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 20 Dec 2007 15:54:08 +0100 Subject: r26549: Remove suite-specific bits. (This used to be commit ac01d515b71ce44a0d98e50d58a76e1ce9e1f5d9) --- source4/selftest/output/buildfarm.pm | 12 +++++++----- source4/selftest/output/html.pm | 8 +++++--- source4/selftest/output/plain.pm | 19 ++++++++++++------- 3 files changed, 24 insertions(+), 15 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/buildfarm.pm b/source4/selftest/output/buildfarm.pm index 81ffd5012c..af61376446 100644 --- a/source4/selftest/output/buildfarm.pm +++ b/source4/selftest/output/buildfarm.pm @@ -7,11 +7,11 @@ use Exporter; use strict; -sub new($$$$) { - my ($class, $statistics) = @_; +sub new($$$) { + my ($class) = @_; my $self = { - statistics => $statistics, - test_output => {} + test_output => {}, + start_time => time() }; bless($self, $class); } @@ -24,7 +24,7 @@ sub start_testsuite($$$) $state->{NAME} = $name; $state->{START_TIME} = time(); - my $duration = $state->{START_TIME} - $self->{statistics}->{START_TIME}; + my $duration = $state->{START_TIME} - $self->{start_time}; $out .= "--==--==--==--==--==--==--==--==--==--==--\n"; $out .= "Running test $name (level 0 stdout)\n"; $out .= "--==--==--==--==--==--==--==--==--==--==--\n"; @@ -103,6 +103,8 @@ sub end_test($$$$$$) sub summary($) { my ($self) = @_; + + print "DURATION: " . (time() - $self->{start_time}) . " seconds\n"; } sub skip_testsuite($$$$) diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index 13d2f10938..1e2dacac6f 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -9,13 +9,13 @@ use warnings; use FindBin qw($RealBin); -sub new($$$$) { +sub new$($$$) { my ($class, $dirname, $statistics) = @_; my $self = { dirname => $dirname, - statistics => $statistics, active_test => undef, local_statistics => {}, + statistics => {}, msg => "", error_summary => { skip => [], @@ -248,7 +248,9 @@ sub summary($) print INDEX "\n"; print INDEX " Total\n"; - if ($st->{SUITES_FAIL} == 0) { + if ($st->{TESTS_UNEXPECTED_OK} == 0 and + $st->{TESTS_UNEXPECTED_FAIL} == 0 and + $st->{TESTS_ERROR} == 0) { print INDEX " "; } else { print INDEX " "; diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index af353c3cff..086bd2b0e5 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -6,14 +6,16 @@ use Exporter; use strict; -sub new($$$$$$) { +sub new($$$$$$$) { my ($class, $summaryfile, $verbose, $immediate, $statistics, $totaltests) = @_; my $self = { verbose => $verbose, immediate => $immediate, statistics => $statistics, + start_time => time(), test_output => {}, suitesfailed => [], + suites_ok => 0, skips => {}, summaryfile => $summaryfile, index => 0, @@ -32,13 +34,13 @@ sub start_testsuite($$$) $state->{NAME} = $name; $state->{START_TIME} = time(); - my $duration = $state->{START_TIME} - $self->{statistics}->{START_TIME}; + my $duration = $state->{START_TIME} - $self->{start_time}; $self->{test_output}->{$name} = "" unless($self->{verbose}); my $out = ""; $out .= "[$self->{index}/$self->{totalsuites} in ".$duration."s"; - $out .= sprintf(", %d errors", $self->{statistics}->{SUITES_FAIL}) if ($self->{statistics}->{SUITES_FAIL} > 0); + $out .= sprintf(", %d errors", ($#{$self->{suitesfailed}}+1)) if ($#{$self->{suitesfailed}} > -1); $out .= "] $name\n", print "$out"; } @@ -68,13 +70,16 @@ sub end_testsuite($$$$$$) if ($unexpected) { $self->output_msg($state, "ERROR: $reason\n"); + push (@{$self->{suitesfailed}}, $name); + } else { + $self->{suites_ok}++; } if ($unexpected and $self->{immediate} and not $self->{verbose}) { $out .= $self->{test_output}->{$name}; - push (@{$self->{suitesfailed}}, $name); } + print $out; } @@ -151,12 +156,12 @@ sub summary($) print "\nA summary with detailed informations can be found in:\n $self->{summaryfile}\n"; - if ($self->{statistics}->{SUITES_FAIL} == 0) { + if ($#{$self->{suitesfailed}} == -1) { my $ok = $self->{statistics}->{TESTS_EXPECTED_OK} + $self->{statistics}->{TESTS_EXPECTED_FAIL}; - print "\nALL OK ($ok tests in $self->{statistics}->{SUITES_OK} testsuites)\n"; + print "\nALL OK ($ok tests in $self->{suites_ok} testsuites)\n"; } else { - print "\nFAILED ($self->{statistics}->{TESTS_UNEXPECTED_FAIL} failures and $self->{statistics}->{TESTS_ERROR} errors in $self->{statistics}->{SUITES_FAIL} testsuites)\n"; + print "\nFAILED ($self->{statistics}->{TESTS_UNEXPECTED_FAIL} failures and $self->{statistics}->{TESTS_ERROR} errors in ". ($#{$self->{suitesfailed}}+1) ." testsuites)\n"; } } -- cgit From b3b3af05f14c2d8d946ea024fcba1852949cb484 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 20 Dec 2007 17:07:21 +0100 Subject: r26552: remove unused state variable, use dot as path separator for test names. (This used to be commit a84975610c2825e9ceecdd47d744282bd55220be) --- source4/selftest/output/buildfarm.pm | 49 +++++++++++++++++--------------- source4/selftest/output/html.pm | 49 +++++++++++++++++--------------- source4/selftest/output/plain.pm | 55 ++++++++++++++++++++---------------- 3 files changed, 82 insertions(+), 71 deletions(-) (limited to 'source4/selftest/output') 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 "\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 " \n"; } -sub control_msg($$$) +sub control_msg($$) { - my ($self, $state, $output) = @_; + my ($self, $output) = @_; $self->{msg} .= "$output
\n"; } -sub output_msg($$$) +sub output_msg($$) { - my ($self, $state, $output) = @_; + my ($self, $output) = @_; unless (defined($self->{active_test})) { print TEST "$output
"; @@ -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 "
\n"; - print TEST "
Duration: " . (time() - $state->{START_TIME}) . "s
\n"; + print TEST "
Duration: " . (time() - $self->{START_TIME}) . "s
\n"; $self->print_html_footer(*TEST); close(TEST); print INDEX "\n"; - print INDEX " {HTMLFILE}\">$name\n"; + print INDEX " {HTMLFILE}\">$name\n"; my $st = $self->{local_statistics}; if (not $unexpected) { @@ -175,13 +178,13 @@ sub end_testsuite($$$$$) print INDEX "\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 "

$testname

\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}} = ""; } } -- cgit From 9f1e4c2b3a566066038f53b280d9d7e6f5979627 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 20 Dec 2007 17:07:28 +0100 Subject: r26553: Fix html output. (This used to be commit 769ac782f30805b725ed9aba532a976b2892ab03) --- source4/selftest/output/html.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/html.pm b/source4/selftest/output/html.pm index c97926c7a8..1049527129 100644 --- a/source4/selftest/output/html.pm +++ b/source4/selftest/output/html.pm @@ -12,13 +12,13 @@ use lib "$RealBin/.."; use Subunit qw(parse_results); -sub new$($$$) { +sub new($$$) { my ($class, $dirname, $statistics) = @_; my $self = { dirname => $dirname, active_test => undef, local_statistics => {}, - statistics => {}, + statistics => $statistics, msg => "", error_summary => { skip => [], -- cgit From b136033421eb045b28f5928e4d2f9604cf704690 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 18 Feb 2008 21:52:23 +0100 Subject: When not using --immediate, use a one-line progress indicator in selftest. (This used to be commit 16b4af184187f29f1f710609ee37029a3f15a294) --- source4/selftest/output/plain.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index 1e6dead326..e491a999ab 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -46,8 +46,15 @@ sub start_testsuite($$) my $out = ""; $out .= "[$self->{index}/$self->{totalsuites} in ".$duration."s"; $out .= sprintf(", %d errors", ($#{$self->{suitesfailed}}+1)) if ($#{$self->{suitesfailed}} > -1); - $out .= "] $name\n", - print "$out"; + $out .= "] $name"; + if ($self->{immediate}) { + print "$out\n"; + } else { + require Term::ReadKey; + my ($wchar, $hchar, $wpixels, $hpixels) = Term::ReadKey::GetTerminalSize(); + foreach (1..$wchar) { $out.= " "; } + print "\r".substr($out, 0, $wchar); + } } sub output_msg($$) -- cgit From 0de47f6b577fdb1e93395b56960951b32cca48c0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 17 Mar 2008 15:17:19 +0100 Subject: selftest: handle progress output in verbose mode metze (This used to be commit 9196213c49532ac60349ff55e66430b7c80b09c2) --- source4/selftest/output/plain.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index e491a999ab..25ff74792e 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -7,8 +7,6 @@ use Exporter; use FindBin qw($RealBin); use lib "$RealBin/.."; -use Subunit qw(parse_results); - use strict; sub new($$$$$$$) { @@ -62,7 +60,9 @@ sub output_msg($$) my ($self, $output) = @_; if ($self->{verbose}) { + require FileHandle; print $output; + STDOUT->flush(); } else { $self->{test_output}->{$self->{NAME}} .= $output; } -- cgit From 8eb6d59a466cf7d9c79b1a271737873c8744ed16 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 00:03:45 +0200 Subject: Properly warn about exit codes that indicate success while tests claim failure. (This used to be commit 92873264d707bed88beac54a73a29d66c011f80c) --- source4/selftest/output/plain.pm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index 25ff74792e..f14e26b38d 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -81,6 +81,9 @@ sub end_testsuite($$$$$) my $out = ""; if ($unexpected) { + if ($result eq "success" and not defined($reason)) { + $reason = "Expected negative exit code, got positive exit code"; + } $self->output_msg("ERROR: $reason\n"); push (@{$self->{suitesfailed}}, $name); } else { -- cgit From 33231f44da6c4eeb5dbf5e7d6d04237d32a63457 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 23 May 2008 16:17:23 +0200 Subject: Report full 'path' of unexpected test results for easier inclusion in knownfailure file. (This used to be commit 33cc9b0f5fae7510d490928195016cf7fe3bbe42) --- source4/selftest/output/plain.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source4/selftest/output') diff --git a/source4/selftest/output/plain.pm b/source4/selftest/output/plain.pm index f14e26b38d..4bec4e0fdc 100644 --- a/source4/selftest/output/plain.pm +++ b/source4/selftest/output/plain.pm @@ -123,7 +123,9 @@ sub end_test($$$$$) return; } - $append = "UNEXPECTED($result): $testname\n"; + my $fullname = join(".", @$parents).".$testname"; + + $append = "UNEXPECTED($result): $testname ($fullname)\n"; $self->{test_output}->{$self->{NAME}} .= $append; -- cgit