From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- layout/tools/reftest/reftest-to-html.pl | 118 ++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100755 layout/tools/reftest/reftest-to-html.pl (limited to 'layout/tools/reftest/reftest-to-html.pl') diff --git a/layout/tools/reftest/reftest-to-html.pl b/layout/tools/reftest/reftest-to-html.pl new file mode 100755 index 0000000000..3fc2380e9e --- /dev/null +++ b/layout/tools/reftest/reftest-to-html.pl @@ -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 +; -- cgit v1.2.3
' . 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) . "
" . $_ . "