diff options
author | Andrea Canciani <ranma42@gmail.com> | 2010-09-26 11:05:35 +0200 |
---|---|---|
committer | Andrea Canciani <ranma42@gmail.com> | 2010-10-07 23:09:13 +0200 |
commit | 425e68590b94d4701d81b73ef2232ea76dd97f48 (patch) | |
tree | f81a98400abcec4764a9df9ad2676472500f201c | |
parent | f29e7d155f3a2ee75daf63719460348ea2ca0f76 (diff) |
test: Remove old html infrastructure
The new dynamic html page supersedes the old make-generated static
html page.
-rw-r--r-- | test/.gitignore | 1 | ||||
-rw-r--r-- | test/Makefile.am | 29 | ||||
-rw-r--r-- | test/Makefile.win32 | 13 | ||||
-rwxr-xr-x | test/make-html.pl | 303 |
4 files changed, 9 insertions, 337 deletions
diff --git a/test/.gitignore b/test/.gitignore index b34bc645..400ce923 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -5,7 +5,6 @@ tags output Makefile Makefile.in -index.html ref.hash any2ppm .any2ppm diff --git a/test/Makefile.am b/test/Makefile.am index a3c1f7a4..6984ce1b 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1413,14 +1413,15 @@ REFERENCE_IMAGES = \ EXTRA_DIST += \ 6x13.pcf \ -make-html.pl \ +index.html \ +jp2.jp2 \ jpeg.jpg \ png.png \ -jp2.jp2 \ romedalen.jpg \ romedalen.png \ scarab.jpg \ surface-source.c \ +testtable.js \ $(REFERENCE_IMAGES) # Any test for which the code committed to CVS is expected to fail @@ -1655,7 +1656,6 @@ VALGRIND_FLAGS = \ CLEANFILES += \ valgrind-log \ - index.html \ ref.hash \ png-test.png \ png.out.png \ @@ -1698,24 +1698,16 @@ recheck: @echo Re-checking failed tests @$(MAKE) $(AM_MAKEFLAGS) $(recheck) -# Checks tests and creates index.html. +# Checks tests. # Target doesn't fail if tests fail. test: - @$(MAKE) $(AM_MAKEFLAGS) check; \ - $(MAKE) $(AM_MAKEFLAGS) html + @$(MAKE) $(AM_MAKEFLAGS) check -# Re-checks tests and creates index.html. +# Re-checks tests. # Target doesn't fail if tests fail. retest: @CAIRO_TESTS="$(FAILED_TESTS)"; \ - $(MAKE) $(AM_MAKEFLAGS) check; \ - $(MAKE) $(AM_MAKEFLAGS) html - -html-local: index.html - -# Make index.html with no dependency tracking, containing only the failed tests. -rehtml: - @CAIRO_TESTS="$(FAILED_TESTS)" $(MAKE) $(AM_MAKEFLAGS) html + $(MAKE) $(AM_MAKEFLAGS) check # Run tests under a tool specified by TOOL. For example, make run TOOL=gdb run: @@ -1733,11 +1725,6 @@ NOLOG_TESTS_LOG = $(NOLOG_TESTS:=.log) $(NOLOG_TESTS_LOG): @echo dummy > $@ -index.html: $(srcdir)/make-html.pl - @echo Creating index.html - @perl $(srcdir)/make-html.pl > $@ - - # Identify identical reference images check-ref-dups: @LANG=C; \ @@ -1788,6 +1775,6 @@ check-ref-missing: release-verify-sane-tests: check-ref-missing -.PHONY: check-valgrind test recheck retest rehtml check-ref-dups check-ref-missing release-verify-sane-tests +.PHONY: check-valgrind test recheck retest check-ref-dups check-ref-missing release-verify-sane-tests EXTRA_DIST += Makefile.win32 diff --git a/test/Makefile.win32 b/test/Makefile.win32 index b45617bd..8d8f1f8b 100644 --- a/test/Makefile.win32 +++ b/test/Makefile.win32 @@ -33,20 +33,9 @@ cairo-test-suite.exe: $(OBJECTS) ./pdiff/pdiff.lib ../boilerplate/$(CFG)/boiler. ../boilerplate/$(CFG)/boiler.lib: (cd ../boilerplate ; $(MAKE) -f Makefile.win32) -.PHONY: check test html +.PHONY: check test check: cairo-test-suite.exe ./cairo-test-suite.exe -# define gen-html so that both 'test' and 'html' targets -# can generate html while having different dependencies -define gen-html -@echo Creating index.html... -@perl make-html.pl > index.html -endef - test: check - $(gen-html) - -html: - $(gen-html) diff --git a/test/make-html.pl b/test/make-html.pl deleted file mode 100755 index 9c0626dd..00000000 --- a/test/make-html.pl +++ /dev/null @@ -1,303 +0,0 @@ -#!/usr/bin/perl -# -# Copyright © 2005 Mozilla Corporation -# -# Permission to use, copy, modify, distribute, and sell this software -# and its documentation for any purpose is hereby granted without -# fee, provided that the above copyright notice appear in all copies -# and that both that copyright notice and this permission notice -# appear in supporting documentation, and that the name of -# Mozilla Corporation not be used in advertising or publicity pertaining to -# distribution of the software without specific, written prior -# permission. Mozilla Corporation makes no representations about the -# suitability of this software for any purpose. It is provided "as -# is" without express or implied warranty. -# -# MOZILLA CORPORTAION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -# SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -# FITNESS, IN NO EVENT SHALL MOZILLA CORPORATION BE LIABLE FOR ANY SPECIAL, -# INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER -# RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION -# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -# IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# Author: Vladimir Vukicevic <vladimir@pobox.com> -# - -use MIME::Base64; - -## -## Takes all the *.log files in the current directory (or those provided -## on the command line) and spits out html to stdout that can be used to -## view all the test results at once. -## - -# show reference images -$config_show_ref = $ENV{'CAIRO_TEST_SHOW_REF'} || 0; - -# show fail images -$config_show_fail = $ENV{'CAIRO_TEST_SHOW_FAIL'} || 1; - -# show all results, even passes -$config_show_all = $ENV{'CAIRO_TEST_SHOW_ALL'} || 0; - -# include test results inline -$config_show_inline = $ENV{'CAIRO_TEST_SHOW_INLINE'} || 0; - -# end of config options - -$tests = {}; -$teststats = {}; -$logs = {}; - -if ($#ARGV >= 0) { @files = @ARGV; } else { @files = <*.log>; } - -foreach (<@files>) { - my $testname; - my $out_path, $diff_path, $ref_path; - my $fn = $_; - (open LOG, $fn) || next; - while (<LOG>) { - if (/^OUTPUT: (.*)$/) { - $out_path = $1; - next; - } - if (/^DIFFERENCE: (.*)$/) { - $diff_path = $1; - next; - } - if (/^REFERENCE: (.*)$/) { - $ref_path = $1; - next; - } - next unless /^TEST: (.*) TARGET: (.*) FORMAT: (.*) OFFSET: (.*) SIMILAR: (.*) RESULT: ([A-Z]*).*$/; - $testname = $1 if !defined($testname); - $tests->{$1} = {} unless $tests->{$1}; - $tests->{$1}->{$2} = {} unless $tests->{$1}->{$2}; - $tests->{$1}->{$2}->{$3} = {} unless $tests->{$1}->{$2}->{$3}; - $tests->{$1}->{$2}->{$3}->{$4} = {} unless $tests->{$1}->{$2}->{$3}->{$4}; - $tests->{$1}->{$2}->{$3}->{$4}->{$5}->{'out'} = $out_path; - $tests->{$1}->{$2}->{$3}->{$4}->{$5}->{'diff'} = $diff_path; - $tests->{$1}->{$2}->{$3}->{$4}->{$5}->{'ref'} = $ref_path; - $tests->{$1}->{$2}->{$3}->{$4}->{$5}->{'result'} = $6; - - $teststats->{$2} = {"PASS" => 0, "FAIL" => 0, "NEW" => 0, "XFAIL" => 0, "UNTESTED" => 0, "CRASHED" =>0} - unless $teststats->{$2}; - ($teststats->{$2}->{$6})++; - - undef $out_path; - undef $diff_path; - undef $ref_path; - } - close LOG; - - (open LOG, $fn) || die "I could open it earlier, but I can't now: $!"; - { - local $/; - $logs->{$testname} = <LOG>; - } - close LOG; -} - -my $targeth = {}; -my $formath = {}; -my $offseth = {}; -my $similarh = {}; - -foreach my $testname (sort(keys %$tests)) { - my $v0 = $tests->{$testname}; - foreach my $targetname (sort(keys %$v0)) { - my $v1 = $v0->{$targetname}; - - $targeth->{$targetname} = 1; - foreach my $formatname (sort(keys %$v1)) { - my $v2 = $v1->{$formatname}; - - $formath->{$formatname} = 1; - foreach my $offsetval (sort(keys %$v2)) { - my $v3 = $v2->{$offsetval}; - - $offseth->{$offsetval} = 1; - foreach my $similarval (sort(keys %$v3)) { - $similarh->{$similarval} = 1; - } - } - } - } -} - -my @targets = sort(keys %$targeth); -my @formats = sort(keys %$formath); -my @offsets = sort(keys %$offseth); -my @similars = sort(keys %$similarh); - -sub printl { - print @_, "\n"; -} - -# convert file into a data URI -sub file_to_data { - my ($ctype,$fname) = @_; - my $fdata; - open FILE, $fname || return "data:" . $ctype . ","; - { - local $/; - $fdata = encode_base64(<FILE>); - } - close FILE; - return "data:" . $ctype . ";base64," . $fdata; -} - -# convert string into a data URI -sub string_to_data { - my ($ctype,$str) = @_; - $str =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; - return "data:" . $ctype . "," . $str; -} - -printl '<html><head>'; -printl '<title>Cairo Test Results</title>'; -printl '<style type="text/css">'; -printl 'a img { border: solid 1px #FFF; }'; -printl '.PASS { background-color: #0B0; min-width: 1em; }'; -printl '.NEW { background-color: #B70; }'; -printl '.FAIL { background-color: #B00; }'; -printl '.XFAIL { background-color: #BB0; }'; -printl '.UNTESTED { background-color: #555; }'; -printl '.CRASHED { background-color: #F00; color: #FF0; }'; -printl '.PASSstr { color: #0B0; }'; -printl '.FAILstr { color: #D00; }'; -printl '.XFAILstr { color: #BB0; }'; -printl '.CRASHEDstr { color: #F00; }'; -printl '.UNTESTEDstr { color: #555; }'; -printl 'img { max-width: 15em; min-width: 3em; min-height: 3em; margin: 3px; }'; -printl 'td { vertical-align: top; }'; -printl '</style>'; -printl '</script>'; -printl '</head>'; -printl '<body>'; - -printl '<table border="1">'; -print '<tr><th>Test</th>'; - -foreach my $target (@targets) { - print '<th>', $target, '</th>'; -} -printl '</tr>'; - -print '<tr><td></td>'; - -foreach my $target (@targets) { - print '<td>'; - print '<span class="PASSstr">', $teststats->{$target}->{"PASS"}, '</span>/'; - print '<span class="FAILstr">', - $teststats->{$target}->{"FAIL"} + - $teststats->{$target}->{"NEW"} + - $teststats->{$target}->{"CRASHED"}, - '</span>/'; - print '<span class="XFAILstr">', $teststats->{$target}->{"XFAIL"}, '</span>/'; - print '<span class="UNTESTEDstr">', $teststats->{$target}->{"UNTESTED"}, '</span>'; - print '</td>'; -} -printl '</tr>'; - -sub img_for { - my ($fn, $withlink) = @_; - - return "" unless defined $fn; - - if ($config_show_inline) { - $fn = file_to_data("image/png", $fn); - # never return links, people can just right-click view image, - # and we don't clutter the document - return '<img src="' . $fn . '">'; - } else { - if ($withlink) { - return '<a href="' . $fn . '"><img src="' . $fn . '"></a>'; - } else { - return '<img src="' . $fn . '">'; - } - } -} - -foreach my $test (sort(keys %$tests)) { - foreach my $offset (@offsets) { - foreach my $similar (@similars) { - foreach my $format (@formats) { - my $testline = ""; - - foreach my $target (@targets) { - my $tgtdata = $tests->{$test}->{$target}; - if ($tgtdata) { - my $testres = $tgtdata->{$format}->{$offset}->{$similar}; - if ($testres) { - my %testfiles; - $testfiles{'out'} = $testres->{'out'}; - $testfiles{'diff'} = $testres->{'diff'}; - $testfiles{'ref'} = $testres->{'ref'}; - - $testline .= "<td class=\"$testres->{'result'}\">"; - $teststats{$target}{$testres}++; - if ($testres->{'result'} eq "PASS") { - if ($config_show_all) { - $testline .= img_for($testfiles{'out'},1); - } - } elsif ($testres->{'result'} eq "FAIL") { - if ($config_show_fail || $config_show_all) { - $testline .= img_for($testfiles{'out'},1); - $testline .= " "; - $testline .= img_for($testfiles{'diff'},1); - $testline .= " "; - $testline .= img_for($testfiles{'ref'},1); - } - } elsif ($testres->{'result'} eq "NEW") { - if ($config_show_fail || $config_show_all) { - $testline .= img_for($testfiles{'new'},1); - } - } elsif ($testres->{'result'} eq "CRASHED") { - $testline .= "!!!CRASHED!!!"; - } elsif ($testres->{'result'} eq "XFAIL") { - #nothing - if ($config_show_all) { - $testline .= img_for($testfiles{'out'},1); - #$testline .= "<hr size=\"1\">"; - $testline .= " "; - $testline .= img_for($testfiles{'diff'},1); - $testline .= " "; - $testline .= img_for($testfiles{'ref'},1); - } - } elsif ($testres->{'result'} eq "UNTESTED") { - #nothing - } else { - $testline .= "UNSUPPORTED STATUS '$testres->{'result'}' (update make-html.pl)"; - } - - $testline .= "</td>"; - } else { - $testline .= '<td></td>'; - } - } else { - $testline .= '<td></td>'; - } - } - print '<tr><td>'; - - if ($config_show_inline) { - print "$test ($format/$offset) "; - print "(<a href=\"" . string_to_data("text/plain",$logs->{$test}) . "\">log</a>)"; - } else { - print $test, ' (', $format, '/', $offset, ($similar ? ' similar' : ''), ') '; - print "(<a href=\"$test.log\">log</a>)"; - } - - print '</td>'; - - print $testline; - - print "</tr>\n"; - } - } - } -} - -print "</table></body></html>\n"; |