diff -r 000000000000 -r 6474c204b198 layout/tools/reftest/reftest-to-html.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layout/tools/reftest/reftest-to-html.pl Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,118 @@ +#!/usr/bin/perl + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +print < + +reftest output + + + +

+PASS  +UNEXPECTED FAIL  +KNOWN FAIL  +UNEXPECTED PASS  +PASS (Random)  +FAIL (Random)  +

+ +EOD +; + +sub readcleanline { + my $l = <>; + chomp $l; + chop $l if ($l =~ /\r$/); + return $l; +} + +sub do_html { + my ($l) = @_; + + $l =~ s,(file:[^ ]*),\1,g; + $l =~ s,(data:[^ ]*),\1,g; + + return $l; +} + +$l = 0; + +while (<>) { + $l++; + next unless /^REFTEST/; + + chomp; + chop if /\r$/; + + s/^REFTEST *//; + + my $randomresult = 0; + if (/EXPECTED RANDOM/) { + s/\(EXPECTED RANDOM\)//; + $randomresult = 1; + } + + if (/^TEST-PASS \| (.*)$/) { + my $class = $randomresult ? "PASSRANDOM" : "PASS"; + print '\n"; + } elsif (/^TEST-UNEXPECTED-(....) \| (.*)$/) { + if ($randomresult) { + die "Error on line $l: UNEXPECTED with test marked random?!"; + } + my $class = ($1 eq "PASS") ? "WEIRDPASS" : "FAIL"; + print '\n"; + + # UNEXPECTED results can be followed by one or two images + $testline = &readcleanline; + + print '\n"; + } elsif (/^TEST-KNOWN-FAIL \| (.*$)/) { + my $class = $randomresult ? "XFAILRANDOM" : "XFAIL"; + print '\n"; + } else { + print STDERR "Unknown Line: " . $_ . "\n"; + print "\n"; + } +} + +print < + + +EOD +;
' . do_html($1) . "
' . do_html($2) . "
'; + + if ($testline =~ /REFTEST IMAGE: (data:.*)$/) { + print ''; + } elsif ($testline =~ /REFTEST IMAGE 1 \(TEST\): (data:.*)$/) { + $refline = &readcleanline; + print ''; + { + die "Error on line $l" unless $refline =~ /REFTEST IMAGE 2 \(REFERENCE\): (data:.*)$/; + print ''; + } + + } else { + die "Error on line $l"; + } + + print "
' . do_html($1) . "
" . $_ . "