2005-12-12 11:56:40 +00:00
|
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
#
|
|
|
|
|
|
# Copyright <20> 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>
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
##
|
2006-07-13 11:27:05 -04:00
|
|
|
|
## 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.
|
2005-12-12 11:56:40 +00:00
|
|
|
|
##
|
|
|
|
|
|
|
2006-01-03 07:29:57 +00:00
|
|
|
|
# show reference images
|
|
|
|
|
|
my $config_show_ref = 0;
|
|
|
|
|
|
|
|
|
|
|
|
# show fail images
|
|
|
|
|
|
my $config_show_fail = 1;
|
|
|
|
|
|
|
|
|
|
|
|
# show all results, even passes
|
|
|
|
|
|
my $config_show_all = 0;
|
|
|
|
|
|
|
|
|
|
|
|
# end of config options
|
|
|
|
|
|
|
2005-12-12 11:56:40 +00:00
|
|
|
|
my $tests = {};
|
|
|
|
|
|
|
|
|
|
|
|
my $teststats = {};
|
|
|
|
|
|
|
|
|
|
|
|
foreach (<*.log>) {
|
|
|
|
|
|
(open LOG, "$_") || next;
|
|
|
|
|
|
while (<LOG>) {
|
2006-02-15 13:46:52 -08:00
|
|
|
|
next unless /^TEST: (.*) TARGET: (.*) FORMAT: (.*) OFFSET: (.*) RESULT: (.*)$/;
|
2005-12-12 11:56:40 +00:00
|
|
|
|
$tests->{$1} = {} unless $tests->{$1};
|
|
|
|
|
|
$tests->{$1}->{$2} = {} unless $tests->{$1}->{$2};
|
2006-02-15 13:46:52 -08:00
|
|
|
|
$tests->{$1}->{$2}->{$3} = {} unless $tests->{$1}->{$2}->{$3};
|
|
|
|
|
|
$tests->{$1}->{$2}->{$3}->{$4} = $5;
|
2005-12-12 11:56:40 +00:00
|
|
|
|
|
2006-07-13 11:27:05 -04:00
|
|
|
|
$teststats->{$2} = {"PASS" => 0, "FAIL" => 0, "XFAIL" => 0, "UNTESTED" => 0, "CRASHED" =>0}
|
2005-12-12 11:56:40 +00:00
|
|
|
|
unless $teststats->{$2};
|
2006-02-15 13:46:52 -08:00
|
|
|
|
($teststats->{$2}->{$5})++;
|
2005-12-12 11:56:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
close LOG;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
my $targeth = {};
|
|
|
|
|
|
my $formath = {};
|
2006-02-15 13:46:52 -08:00
|
|
|
|
my $offseth = {};
|
2005-12-12 11:56:40 +00:00
|
|
|
|
|
|
|
|
|
|
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)) {
|
2006-02-15 13:46:52 -08:00
|
|
|
|
my $v2 = $v1->{$formatname};
|
|
|
|
|
|
|
2005-12-12 11:56:40 +00:00
|
|
|
|
$formath->{$formatname} = 1;
|
2006-02-15 13:46:52 -08:00
|
|
|
|
foreach my $offsetval (sort(keys %$v2)) {
|
|
|
|
|
|
$offseth->{$offsetval} = 1;
|
|
|
|
|
|
}
|
2005-12-12 11:56:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
my @targets = sort(keys %$targeth);
|
|
|
|
|
|
my @formats = sort(keys %$formath);
|
2006-02-15 13:46:52 -08:00
|
|
|
|
my @offsets = sort(keys %$offseth);
|
2005-12-12 11:56:40 +00:00
|
|
|
|
|
|
|
|
|
|
sub printl {
|
|
|
|
|
|
print @_, "\n";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
printl '<html><head>';
|
|
|
|
|
|
printl '<title>Cairo Test Results</title>';
|
|
|
|
|
|
printl '<style type="text/css">';
|
2006-07-13 11:27:05 -04:00
|
|
|
|
printl 'a img { border: solid 1px #FFF; }';
|
2006-07-13 13:16:10 -04:00
|
|
|
|
printl '.PASS { background-color: #0B0; min-width: 1em; }';
|
|
|
|
|
|
printl '.FAIL { background-color: #B00; }';
|
|
|
|
|
|
printl '.XFAIL { background-color: #BB0; }';
|
|
|
|
|
|
printl '.UNTESTED { background-color: #555; }';
|
2006-07-13 11:27:05 -04:00
|
|
|
|
printl '.CRASHED { background-color: #F00; color: #FF0; }';
|
2006-07-13 13:16:10 -04:00
|
|
|
|
printl '.PASSstr { color: #0B0; }';
|
|
|
|
|
|
printl '.FAILstr { color: #D00; }';
|
|
|
|
|
|
printl '.XFAILstr { color: #BB0; }';
|
2006-07-13 11:27:05 -04:00
|
|
|
|
printl '.CRASHEDstr { color: #F00; }';
|
2006-07-13 13:16:10 -04:00
|
|
|
|
printl '.UNTESTEDstr { color: #555; }';
|
2006-07-13 11:27:05 -04:00
|
|
|
|
printl 'img { max-width: 15em; min-width: 3em; margin: 3px; }';
|
2005-12-12 11:56:40 +00:00
|
|
|
|
printl 'td { vertical-align: top; }';
|
|
|
|
|
|
printl '</style>';
|
|
|
|
|
|
printl '<body>';
|
|
|
|
|
|
|
|
|
|
|
|
printl '<table border="1">';
|
2006-01-03 07:29:57 +00:00
|
|
|
|
print '<tr><th>Test</th>';
|
|
|
|
|
|
print '<th>Ref</th>' if $config_show_ref;
|
|
|
|
|
|
|
2005-12-12 11:56:40 +00:00
|
|
|
|
foreach my $target (@targets) {
|
|
|
|
|
|
print '<th>', $target, '</th>';
|
|
|
|
|
|
}
|
|
|
|
|
|
printl '</tr>';
|
|
|
|
|
|
|
2006-01-03 07:29:57 +00:00
|
|
|
|
print '<tr><td></td>';
|
|
|
|
|
|
print '<td></td>' if $config_show_ref;
|
|
|
|
|
|
|
2005-12-12 11:56:40 +00:00
|
|
|
|
foreach my $target (@targets) {
|
|
|
|
|
|
print '<td>';
|
2006-01-03 07:29:57 +00:00
|
|
|
|
print '<span class="PASSstr">', $teststats->{$target}->{"PASS"}, '</span>/';
|
2006-07-13 11:27:05 -04:00
|
|
|
|
print '<span class="FAILstr">', $teststats->{$target}->{"FAIL"} + $teststats->{$target}->{"CRASHED"}, '</span>/';
|
2006-01-03 07:29:57 +00:00
|
|
|
|
print '<span class="XFAILstr">', $teststats->{$target}->{"XFAIL"}, '</span>/';
|
|
|
|
|
|
print '<span class="UNTESTEDstr">', $teststats->{$target}->{"UNTESTED"}; '</span>';
|
2005-12-12 11:56:40 +00:00
|
|
|
|
print '</td>';
|
|
|
|
|
|
}
|
|
|
|
|
|
printl '</tr>';
|
|
|
|
|
|
|
|
|
|
|
|
sub testref {
|
|
|
|
|
|
my ($test, $format, $rest) = @_;
|
|
|
|
|
|
my $fmtstr = "";
|
|
|
|
|
|
if ($format eq "rgb24") {
|
|
|
|
|
|
$fmtstr = "-rgb24";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return "$test$fmtstr-ref.png";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sub testfiles {
|
2006-02-15 13:46:52 -08:00
|
|
|
|
my ($test, $target, $format, $offset, $rest) = @_;
|
2005-12-12 11:56:40 +00:00
|
|
|
|
my $fmtstr = "";
|
2006-02-15 13:46:52 -08:00
|
|
|
|
my $offstr = "";
|
2005-12-12 11:56:40 +00:00
|
|
|
|
if ($format eq "rgb24") {
|
|
|
|
|
|
$fmtstr = "-rgb24";
|
|
|
|
|
|
} elsif ($format eq "argb32") {
|
|
|
|
|
|
$fmtstr = "-argb32";
|
|
|
|
|
|
}
|
2006-02-15 13:46:52 -08:00
|
|
|
|
if ($offset ne "0") {
|
|
|
|
|
|
$offstr = "-" . $offset;
|
|
|
|
|
|
}
|
2005-12-12 11:56:40 +00:00
|
|
|
|
|
2006-02-15 13:46:52 -08:00
|
|
|
|
return ("out" => "$test-$target$fmtstr$offstr-out.png",
|
|
|
|
|
|
"diff" => "$test-$target$fmtstr$offstr-diff.png");
|
2005-12-12 11:56:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach my $test (sort(keys %$tests)) {
|
2006-02-15 13:46:52 -08:00
|
|
|
|
foreach my $offset (@offsets) {
|
|
|
|
|
|
foreach my $format (@formats) {
|
|
|
|
|
|
my $testline = "";
|
|
|
|
|
|
|
|
|
|
|
|
foreach my $target (@targets) {
|
|
|
|
|
|
my $tgtdata = $tests->{$test}->{$target};
|
|
|
|
|
|
if ($tgtdata) {
|
|
|
|
|
|
my $testres = $tgtdata->{$format}->{$offset};
|
|
|
|
|
|
if ($testres) {
|
|
|
|
|
|
my %testfiles = testfiles($test, $target, $format, $offset);
|
|
|
|
|
|
$testline .= "<td class=\"$testres\">";
|
|
|
|
|
|
$stats{$target}{$testres}++;
|
|
|
|
|
|
if ($testres eq "PASS") {
|
|
|
|
|
|
if ($config_show_all) {
|
|
|
|
|
|
$testline .= "<a href=\"" . $testfiles{"out"} . "\"><img src=\"" . $testfiles{"out"} . "\"></a>";
|
|
|
|
|
|
}
|
|
|
|
|
|
} elsif ($testres eq "FAIL") {
|
|
|
|
|
|
if ($config_show_fail || $config_show_all) {
|
|
|
|
|
|
$testline .= "<a href=\"" . $testfiles{"out"} . "\"><img src=\"" . $testfiles{"out"} . "\"></a>";
|
2006-07-13 11:27:05 -04:00
|
|
|
|
#$testline .= "<hr size=\"1\">";
|
|
|
|
|
|
$testline .= " ";
|
2006-02-15 13:46:52 -08:00
|
|
|
|
$testline .= "<a href=\"" . $testfiles{"diff"} . "\"><img src=\"" . $testfiles{"diff"} . "\"></a>";
|
|
|
|
|
|
}
|
2006-07-13 11:27:05 -04:00
|
|
|
|
} elsif ($testres eq "CRASHED") {
|
|
|
|
|
|
$testline .= "!!!CRASHED!!!";
|
2006-02-15 13:46:52 -08:00
|
|
|
|
} elsif ($testres eq "XFAIL") {
|
|
|
|
|
|
#nothing
|
|
|
|
|
|
if ($config_show_all) {
|
|
|
|
|
|
$testline .= "<a href=\"" . $testfiles{"out"} . "\"><img src=\"" . $testfiles{"out"} . "\"></a>";
|
2006-07-13 11:27:05 -04:00
|
|
|
|
#$testline .= "<hr size=\"1\">";
|
|
|
|
|
|
$testline .= " ";
|
2006-02-15 13:46:52 -08:00
|
|
|
|
$testline .= "<a href=\"" . $testfiles{"diff"} . "\"><img src=\"" . $testfiles{"diff"} . "\"></a>";
|
|
|
|
|
|
}
|
2006-07-13 11:27:05 -04:00
|
|
|
|
} elsif ($testres eq "UNTESTED") {
|
|
|
|
|
|
#nothing
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$testline .= "UNSUPPORTED STATUS (update make-html.pl)";
|
|
|
|
|
|
}
|
2006-02-15 13:46:52 -08:00
|
|
|
|
|
|
|
|
|
|
$testline .= "</td>";
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$testline .= '<td></td>';
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
$testline .= '<td></td>';
|
|
|
|
|
|
}
|
2005-12-12 11:56:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
2006-02-15 13:46:52 -08:00
|
|
|
|
my $testref = testref($test, $format);
|
|
|
|
|
|
print '<tr><td>', "<a href=\"$testref\">", $test, ' (', $format, '/', $offset, ')</a></td>';
|
2006-01-03 07:29:57 +00:00
|
|
|
|
|
2006-02-15 13:46:52 -08:00
|
|
|
|
if ($config_show_ref) {
|
|
|
|
|
|
print "<td><a href=\"$testref\"><img src=\"$testref\"></img></a></td>";
|
|
|
|
|
|
}
|
2006-01-03 07:29:57 +00:00
|
|
|
|
|
2006-02-15 13:46:52 -08:00
|
|
|
|
print $testline;
|
2006-01-03 07:29:57 +00:00
|
|
|
|
|
2006-02-15 13:46:52 -08:00
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
}
|
2005-12-12 11:56:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
print "</table></body></html>\n";
|
|
|
|
|
|
|