Commit b9d590e3 authored by aroben@apple.com's avatar aroben@apple.com
Browse files

Refactor test results page generation

        Reviewed by Eric Seidel.

        * Scripts/run-webkit-tests:
        (sub htmlForResultsSection): Added. Takes a set of tests, a
        description, and a subroutine to generate the links for each test, and
        creates a HTML string containing a table of the tests and their
        links.
        (sub linksForExpectedAndActualResults): Added. Replaces the
        htmlForExpectedAndActualResults subroutine.
        (sub linksForMismatchTest): Added.
        (sub linksForCrashOrErrorTest): Added.
        (sub linksForNewTest): Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@32027 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f1bee74f
2008-04-17 Adam Roben <aroben@apple.com>
Refactor test results page generation
Reviewed by Eric Seidel.
* Scripts/run-webkit-tests:
(sub htmlForResultsSection): Added. Takes a set of tests, a
description, and a subroutine to generate the links for each test, and
creates a HTML string containing a table of the tests and their
links.
(sub linksForExpectedAndActualResults): Added. Replaces the
htmlForExpectedAndActualResults subroutine.
(sub linksForMismatchTest): Added.
(sub linksForCrashOrErrorTest): Added.
(sub linksForNewTest): Added.
2008-04-17 Adam Roben <aroben@apple.com>
 
Print the extension for all tests in the test results page
......
......@@ -88,7 +88,7 @@ sub toURL($);
sub toWindowsPath($);
sub closeCygpaths();
sub validateSkippedArg($$;$);
sub htmlForExpectedAndActualResults($);
sub htmlForResultsSection(\@$&);
sub deleteExpectedAndActualResults($);
sub recordActualResultsAndDiff($$);
sub buildPlatformHierarchy();
......@@ -942,74 +942,10 @@ print HTML "<title>Layout Test Results</title>\n";
print HTML "</head>\n";
print HTML "<body>\n";
if ($counts{mismatch}) {
print HTML "<p>Tests where results did not match expected results:</p>\n";
print HTML "<table>\n";
for my $test (@{$tests{mismatch}}) {
my $base = stripExtension($test);
print HTML "<tr>\n";
print HTML "<td><a href=\"" . toURL("$testDirectory/$test") . "\">$test</a></td>\n";
print HTML htmlForExpectedAndActualResults($base);
if ($pixelTests) {
if ($imagesPresent{$base}) {
print HTML "<td><a href=\"$base-$expectedTag.png\">expected image</a></td>\n";
print HTML "<td><a href=\"$base-$diffsTag.html\">image diffs</a>\n";
print HTML "<a href=\"$base-$diffsTag.png\">$imageDifferences{$base}%</a></td>\n";
} else {
print HTML "<td></td><td></td>\n";
}
}
print HTML "</tr>\n";
}
print HTML "</table>\n";
}
if ($counts{crash}) {
print HTML "<p>Tests that caused the DumpRenderTree tool to crash:</p>\n";
print HTML "<table>\n";
for my $test (@{$tests{crash}}) {
my $base = stripExtension($test);
my $expectedDir = $expectedResultDirectory{$base};
print HTML "<tr>\n";
print HTML "<td><a href=\"" . toURL("$testDirectory/$test") . "\">$test</a></td>\n";
print HTML htmlForExpectedAndActualResults($base);
print HTML "<td><a href=\"$base-$errorTag.txt\">stderr</a></td>\n";
print HTML "</tr>\n";
}
print HTML "</table>\n";
}
if ($counts{error}) {
print HTML "<p>Tests that had stderr output:</p>\n";
print HTML "<table>\n";
for my $test (@{$tests{error}}) {
my $base = stripExtension($test);
my $expectedDir = $expectedResultDirectory{$base};
print HTML "<tr>\n";
print HTML "<td><a href=\"" . toURL("$testDirectory/$test") . "\">$test</a></td>\n";
print HTML htmlForExpectedAndActualResults($base);
print HTML "<td><a href=\"$base-$errorTag.txt\">stderr</a></td>\n";
print HTML "</tr>\n";
}
print HTML "</table>\n";
}
if ($counts{new}) {
print HTML "<p>Tests that had no expected results (probably new):</p>\n";
print HTML "<table>\n";
for my $test (@{$tests{new}}) {
my $base = stripExtension($test);
my $expectedDir = $expectedResultDirectory{$base};
print HTML "<tr>\n";
print HTML "<td><a href=\"" . toURL("$testDirectory/$test") . "\">$test</a></td>\n";
print HTML "<td><a href=\"" . toURL("$expectedDir/$base-$expectedTag.txt") . "\">results</a></td>\n";
if ($pixelTests && -f "$expectedDir/$base-$expectedTag.png") {
print HTML "<td><a href=\"" . toURL("$expectedDir/$base-$expectedTag.png") . "\">image</a></td>\n";
}
print HTML "</tr>\n";
}
print HTML "</table>\n";
}
print HTML htmlForResultsSection(@{$tests{mismatch}}, "Tests where results did not match expected results", \&linksForMismatchTest);
print HTML htmlForResultsSection(@{$tests{crash}}, "Tests that caused the DumpRenderTree tool to crash", \&linksForCrashOrErrorTest);
print HTML htmlForResultsSection(@{$tests{error}}, "Tests that had stderr output", \&linksForCrashOrErrorTest);
print HTML htmlForResultsSection(@{$tests{new}}, "Tests that had no expected results (probably new)", \&linksForNewTest);
print HTML "</body>\n";
print HTML "</html>\n";
......@@ -1565,15 +1501,90 @@ sub validateSkippedArg($$;$)
$treatSkipped = $value;
}
sub htmlForExpectedAndActualResults($)
sub htmlForResultsSection(\@$&)
{
my ($tests, $description, $linkGetter) = @_;
my @html = ();
return join("\n", @html) unless @{$tests};
push @html, "<p>$description:</p>";
push @html, "<table>";
foreach my $test (@{$tests}) {
push @html, "<tr>";
push @html, "<td><a href=\"" . toURL("$testDirectory/$test") . "\">$test</a></td>";
foreach my $link (@{&{$linkGetter}($test)}) {
push @html, "<td><a href=\"$link->{href}\">$link->{text}</a></td>";
}
push @html, "</tr>";
}
push @html, "</table>";
return join("\n", @html);
}
sub linksForExpectedAndActualResults($)
{
my ($base) = @_;
return "<td></td><td></td><td></td>\n" unless -s "$testResultsDirectory/$base-$diffsTag.txt";
my @links = ();
return \@links unless -s "$testResultsDirectory/$base-$diffsTag.txt";
push @links, { href => "$base-$expectedTag.txt", text => "expected" };
push @links, { href => "$base-$actualTag.txt", text => "actual" };
push @links, { href => "$base-$diffsTag.txt", text => "diffs" };
return \@links;
}
sub linksForMismatchTest
{
my ($test) = @_;
my @links = ();
my $base = stripExtension($test);
push @links, @{linksForExpectedAndActualResults($base)};
return \@links unless $pixelTests && $imagesPresent{$base};
push @links, { href => "$base-$expectedTag.png", text => "expected image" };
push @links, { href => "$base-$diffsTag.html", text => "image diffs" };
push @links, { href => "$base-$diffsTag.png", text => "$imageDifferences{$base}%" };
return \@links;
}
sub linksForCrashOrErrorTest
{
my ($test) = @_;
my @links = ();
my $base = stripExtension($test);
push @links, @{linksForExpectedAndActualResults($base)};
push @links, { href => "$base-$errorTag.txt", text => "stderr" };
return \@links;
}
sub linksForNewTest
{
my ($test) = @_;
my @links = ();
my $base = stripExtension($test);
my $expectedDir = $expectedResultDirectory{$base};
push @links, { href => toURL("$expectedDir/$base-$expectedTag.txt"), text => "results" };
if ($pixelTests && -f "$expectedDir/$base-$expectedTag.png") {
push @links, { href => toURL("$expectedDir/$base-$expectedTag.png"), text => "image" };
}
return "<td><a href=\"$base-$expectedTag.txt\">expected</a></td>\n"
. "<td><a href=\"$base-$actualTag.txt\">actual</a></td>\n"
. "<td><a href=\"$base-$diffsTag.txt\">diffs</a></td>\n";
return \@links;
}
sub deleteExpectedAndActualResults($)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment