From 235cd3e5c462fd559f9ac58f6336e6a9de4b1000 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 28 Mar 2010 21:45:42 +0200 Subject: [PATCH] selftest: Remove html subunit formatter; it's too simple and really belongs in subunit or testrepository upstream. --- selftest/format-subunit | 20 +-- selftest/output/html.pm | 366 ---------------------------------------- selftest/output/testresults.css | 129 -------------- 3 files changed, 3 insertions(+), 512 deletions(-) delete mode 100644 selftest/output/html.pm delete mode 100644 selftest/output/testresults.css diff --git a/selftest/format-subunit b/selftest/format-subunit index 472f51a815b..2224b71191c 100755 --- a/selftest/format-subunit +++ b/selftest/format-subunit @@ -7,7 +7,7 @@ =head1 NAME -format-subunit [--format=] [--immediate] < instream > outstream +format-subunit [--immediate] < instream > outstream =head1 SYNOPSIS @@ -21,10 +21,6 @@ Format the output of a subunit stream. Show errors as soon as they happen rather than at the end of the test run. -=item I<--format>=FORMAT - -Choose the format to print. Currently supported are plain or html. - =head1 LICENSE GNU General Public License, version 3 or later. @@ -41,7 +37,6 @@ use FindBin qw($RealBin $Script); use lib "$RealBin"; use Subunit qw(parse_results); -my $opt_format = "plain"; my $opt_help = undef; my $opt_verbose = 0; my $opt_immediate = 0; @@ -49,7 +44,6 @@ my $opt_prefix = "."; my $result = GetOptions ( 'help|h|?' => \$opt_help, - 'format=s' => \$opt_format, 'verbose' => \$opt_verbose, 'immediate' => \$opt_immediate, 'prefix:s' => \$opt_prefix, @@ -73,16 +67,8 @@ my $statistics = { TESTS_SKIP => 0, }; -if ($opt_format eq "plain") { - require output::plain; - $msg_ops = new output::plain("$opt_prefix/summary", $opt_verbose, $opt_immediate, $statistics, undef); -} elsif ($opt_format eq "html") { - require output::html; - mkdir("test-results", 0777); - $msg_ops = new output::html("test-results", $statistics); -} else { - die("Invalid output format '$opt_format'"); -} +require output::plain; +$msg_ops = new output::plain("$opt_prefix/summary", $opt_verbose, $opt_immediate, $statistics, undef); my $expected_ret = parse_results($msg_ops, $statistics, *STDIN); diff --git a/selftest/output/html.pm b/selftest/output/html.pm deleted file mode 100644 index 8e42b65649c..00000000000 --- a/selftest/output/html.pm +++ /dev/null @@ -1,366 +0,0 @@ -#!/usr/bin/perl -# HTML output for selftest -# Copyright (C) 2008 Jelmer Vernooij -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -package output::html; -use Exporter; -@ISA = qw(Exporter); - -use strict; -use warnings; - -use FindBin qw($RealBin); -use lib "$RealBin/.."; - -sub new($$$) { - my ($class, $dirname, $statistics) = @_; - my $self = { - dirname => $dirname, - active_test => undef, - local_statistics => {}, - statistics => $statistics, - msg => "", - error_summary => { - skip => [], - expected_success => [], - unexpected_success => [], - expected_failure => [], - unexpected_failure => [], - skip_testsuites => [], - error => [] - } - }; - - link("$RealBin/output/testresults.css", "$dirname/testresults.css"); - - open(INDEX, ">$dirname/index.html"); - - bless($self, $class); - - $self->print_html_header("Samba Testsuite Run", *INDEX); - - print INDEX "
"; - print INDEX " \n"; - print INDEX " \n"; - print INDEX " \n"; - print INDEX " \n"; - print INDEX " \n"; - - return $self; -} - -sub testsuite_count($$) -{ -} - -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 "
TestResult
\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($$); - -sub start_testsuite($$) -{ - my ($self, $name) = @_; - - $self->{START_TIME} = $self->{last_time}; - - $self->{local_statistics} = { - success => 0, - skip => 0, - error => 0, - failure => 0 - }; - - $self->{NAME} = $name; - $self->{HTMLFILE} = "$name.html"; - $self->{HTMLFILE} =~ s/[:\t\n \/]/_/g; - - open(TEST, ">$self->{dirname}/$self->{HTMLFILE}") or die("Unable to open $self->{HTMLFILE} for writing"); - - $self->print_html_header("Test Results for $name", *TEST); - - print TEST "

Tests

\n"; - - print TEST " \n"; -} - -sub control_msg($$) -{ - my ($self, $output) = @_; - - # Perhaps the CSS should hide this by default? - $self->{msg} .= "$output
\n"; -} - -sub output_msg($$) -{ - my ($self, $output) = @_; - - unless (defined($self->{active_test})) { - if (defined($self->{NAME})) { - print TEST "$output
"; - } - } else { - $self->{msg} .= "$output
"; - } -} - -sub end_testsuite($$$) -{ - my ($self, $name, $result, $reason) = @_; - - print TEST "
\n"; - - print TEST "
Duration: " . ($self->{last_time} - $self->{START_TIME}) . "s
\n"; - - $self->print_html_footer(*TEST); - - close(TEST); - - print INDEX "\n"; - print INDEX " {HTMLFILE}\">$name\n"; - my $st = $self->{local_statistics}; - - if ($result eq "xfail") { - print INDEX " "; - } elsif ($result eq "success") { - print INDEX " "; - } else { - print INDEX " "; - } - - 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) { - print INDEX uc($result); - } - - print INDEX ""; - - print INDEX "\n"; - - $self->{NAME} = undef; -} - -sub report_time($$) -{ - my ($self, $time) = @_; - $self->{last_time} = $time; -} - -sub start_test($$) -{ - my ($self, $testname) = @_; - - $self->{active_test} = $testname; - $self->{msg} = ""; -} - -sub end_test($$$$) -{ - my ($self, $testname, $result, $unexpected, $reason) = @_; - - print 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 { - if ($result eq "failure") { - print TEST "\n"; - } else { - print TEST "\n"; - } - $track_class = "expected_$result"; - } - - push(@{$self->{error_summary}->{$track_class}}, , - [$self->{HTMLFILE}, $testname, $self->{NAME}, - $reason]); - - print TEST "

$testname

\n"; - - print TEST $self->{msg}; - - if (defined($reason)) { - print TEST "
$reason
\n"; - } - - print TEST "\n"; - - $self->{active_test} = undef; -} - -sub summary($) -{ - my ($self) = @_; - - my $st = $self->{statistics}; - print INDEX "\n"; - print INDEX " Total\n"; - - if ($st->{TESTS_UNEXPECTED_OK} == 0 and - $st->{TESTS_UNEXPECTED_FAIL} == 0 and - $st->{TESTS_ERROR} == 0) { - print INDEX " "; - } else { - print INDEX " "; - } - print INDEX ($st->{TESTS_EXPECTED_OK} + $st->{TESTS_UNEXPECTED_OK}) . " ok"; - if ($st->{TESTS_UNEXPECTED_OK} > 0) { - print INDEX " ($st->{TESTS_UNEXPECTED_OK} unexpected)"; - } - if ($st->{TESTS_SKIP} > 0) { - print INDEX ", $st->{TESTS_SKIP} skipped"; - } - 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"; - } - - print INDEX ""; - - print INDEX "\n"; - - print INDEX "\n"; - print INDEX "Summary\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"; - if (defined($$_[3])) { - print SUMMARY " \n"; - } else { - 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}); - - 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($$_[1])) { - print SUMMARY " \n"; - } else { - print SUMMARY " \n"; - } - print SUMMARY "\n"; - } - - print SUMMARY "
TestsuiteReason
$$_[0]$$_[1]
"; - - $self->print_html_footer(*SUMMARY); - close(SUMMARY); -} - -sub skip_testsuite($$$$) -{ - my ($self, $name, $reason) = @_; - - push (@{$self->{error_summary}->{skip_testsuites}}, - [$name, $reason]); -} - -1; diff --git a/selftest/output/testresults.css b/selftest/output/testresults.css deleted file mode 100644 index 66d1d6b2ad2..00000000000 --- a/selftest/output/testresults.css +++ /dev/null @@ -1,129 +0,0 @@ -/* 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; -} - -/* Expected failure */ -td.resultExpectedFailure -{ - text-align: right; - padding-left: 10px; - padding-right: 10px; - background-color: #FFA500; - font-weight: bold; -} - -/* Skipped */ -td.resultSkipped -{ - text-align: center; - 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; -} - -td.outputExpectedFailure -{ - background-color: #FFA500; -} - -div.reason -{ - text-align: center; - font-weight: bold; -} - -span.control -{ - display: none; -} - -div.duration -{ - text-align: right; - font-weight: bold; -} - -div.command -{ - background-color: gray; -} -- 2.11.4.GIT