From f8ee0cdf186bfb30bdeb487b63d42f274c1073ce Mon Sep 17 00:00:00 2001 From: Brian Ewins Date: Sat, 10 Nov 2007 01:34:01 +0000 Subject: [PATCH] [test] Link to the correct reference image. The generated test html guesses the names of the reference images used in the tests. This is quite often wrong, and makes it harder to change policy in cairo-test. Teach make-html.pl to parse the log for the path to the reference image. --- test/make-html.pl | 102 ++++++++++++++++++++-------------------------- 1 file changed, 45 insertions(+), 57 deletions(-) diff --git a/test/make-html.pl b/test/make-html.pl index 9720c0674..8bc961e57 100755 --- a/test/make-html.pl +++ b/test/make-html.pl @@ -54,20 +54,40 @@ 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 () { + 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} = $6; + $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, "XFAIL" => 0, "UNTESTED" => 0, "CRASHED" =>0} unless $teststats->{$2}; ($teststats->{$2}->{$6})++; + + undef $out_path; + undef $diff_path; + undef $ref_path; } close LOG; @@ -158,7 +178,6 @@ printl ''; printl ''; print ''; -print '' if $config_show_ref; foreach my $target (@targets) { print ''; @@ -166,7 +185,6 @@ foreach my $target (@targets) { printl ''; print ''; -print '' if $config_show_ref; foreach my $target (@targets) { print ''; -sub testref { - my ($test, $format, $rest) = @_; - my $fmtstr = ""; - if ($format eq "rgb24") { - $fmtstr = "-rgb24"; - } - - return "$test$fmtstr-ref.png"; -} - -sub testfiles { - my ($test, $target, $format, $offset, $similar, $rest) = @_; - my $fmtstr = ""; - my $offstr = ""; - my $simstr = ""; - if ($format eq "rgb24") { - $fmtstr = "-rgb24"; - } elsif ($format eq "argb32") { - $fmtstr = "-argb32"; - } - if ($similar ne "0") { - $simstr = "-similar"; - } - if ($offset ne "0") { - $offstr = "-" . $offset; - } - - return ("out" => "$test-$target$fmtstr$simstr$offstr-out.png", - "diff" => "$test-$target$fmtstr$simstr$offstr-diff.png"); -} - sub img_for { my ($fn, $withlink) = @_; @@ -237,35 +224,42 @@ foreach my $test (sort(keys %$tests)) { if ($tgtdata) { my $testres = $tgtdata->{$format}->{$offset}->{$similar}; if ($testres) { - my %testfiles = testfiles($test, $target, $format, - $offset, $similar); - $testline .= ""; } else { @@ -275,23 +269,18 @@ foreach my $test (sort(keys %$tests)) { $testline .= ''; } } - my $testref = testref($test, $format); print ''; - if ($config_show_ref) { - print ""; - } - print $testline; print "\n"; @@ -301,4 +290,3 @@ foreach my $test (sort(keys %$tests)) { } print "
TestRef', $target, '
'; @@ -178,37 +196,6 @@ foreach my $target (@targets) { } printl '
"; + my %testfiles; + $testfiles{'out'} = $testres->{'out'}; + $testfiles{'diff'} = $testres->{'diff'}; + $testfiles{'ref'} = $testres->{'ref'}; + + $testline .= "{'result'}\">"; $teststats{$target}{$testres}++; - if ($testres eq "PASS") { + if ($testres->{'result'} eq "PASS") { if ($config_show_all) { - $testline .= img_for($testfiles{'out'},1); + $testline .= img_for($testfiles{'out'},1); } - } elsif ($testres eq "FAIL") { + } elsif ($testres->{'result'} eq "FAIL") { if ($config_show_fail || $config_show_all) { - $testline .= img_for($testfiles{'out'},1); + $testline .= img_for($testfiles{'out'},1); $testline .= " "; - $testline .= img_for($testfiles{'diff'},1); + $testline .= img_for($testfiles{'diff'},1); + $testline .= " "; + $testline .= img_for($testfiles{'ref'},1); } - } elsif ($testres eq "CRASHED") { - $testline .= "!!!CRASHED!!!"; - } elsif ($testres eq "XFAIL") { + } elsif ($testres->{'result'} eq "CRASHED") { + $testline .= "!!!CRASHED!!!"; + } elsif ($testres->{'result'} eq "XFAIL") { #nothing if ($config_show_all) { - $testline .= img_for($testfiles{'out'},1); + $testline .= img_for($testfiles{'out'},1); #$testline .= "
"; $testline .= " "; - $testline .= img_for($testfiles{'diff'},1); + $testline .= img_for($testfiles{'diff'},1); + $testline .= " "; + $testline .= img_for($testfiles{'ref'},1); } - } elsif ($testres eq "UNTESTED") { + } elsif ($testres->{'result'} eq "UNTESTED") { #nothing } else { - $testline .= "UNSUPPORTED STATUS (update make-html.pl)"; - } + $testline .= "UNSUPPORTED STATUS '$testres->{'result'}' (update make-html.pl)"; + } $testline .= "
'; if ($config_show_inline) { print "$test ($format/$offset) "; print "({$test}) . "\">log)"; } else { - print "", $test, ' (', $format, '/', $offset, ($similar ? ' similar' : ''), ') '; + print $test, ' (', $format, '/', $offset, ($similar ? ' similar' : ''), ') '; print "(log)"; } print '" . img_for($testref,1) . "
\n"; -