3 # Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
4 # Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
5 # Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com)
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
11 # 1. Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # 2. Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in the
15 # documentation and/or other materials provided with the distribution.
16 # 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
17 # its contributors may be used to endorse or promote products derived
18 # from this software without specific prior written permission.
20 # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
21 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
24 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 # Script to run the Web Kit Open Source Project layout tests.
33 # Run all the tests passed in on the command line.
34 # If no tests are passed, find all the .html, .shtml, .xml, .xhtml, .pl, .php (and svg) files in the test directory.
37 # Compare against the existing file xxx-expected.txt.
38 # If there is a mismatch, generate xxx-actual.txt and xxx-diffs.txt.
41 # the number of tests that got the expected results
42 # the number of tests that ran, but did not get the expected results
43 # the number of tests that failed to run
44 # the number of tests that were run but had no expected results to compare against
55 use File::Spec::Functions;
60 use Time::HiRes qw(time);
62 use lib $FindBin::Bin;
68 sub dumpToolDidCrash();
70 sub countAndPrintLeaks($$$);
71 sub fileNameWithNumber($$);
73 sub openHTTPDIfNeeded();
75 sub processIgnoreTests($);
78 sub stripExtension($);
79 sub isTextOnlyTest($);
80 sub expectedDirectoryForTest($;$);
81 sub printFailureMessageForTest($$);
85 sub validateSkippedArg($$;$);
86 sub htmlForExpectedAndActualResults($);
87 sub deleteExpectedAndActualResults($);
88 sub recordActualResultsAndDiff($$);
89 sub buildPlatformHierarchy();
92 my $addPlatformExceptions = 0;
93 my $configuration = configuration();
96 my $httpdSSLPort = 8443;
102 my $repaintSweepHorizontally = '';
103 my $repaintTests = '';
104 my $report10Slowest = 0;
105 my $resetResults = 0;
106 my $shouldCheckLeaks = 0;
108 my $testsPerDumpTool = 1000;
110 my $testOnlySVGs = '';
111 my $testResultsDirectory = "/tmp/layout-test-results";
113 my $treatSkipped = "default";
116 my $strictTesting = 0;
117 my $generateNewResults = 1;
118 my $stripEditingCallbacks = isCygwin();
121 my $expectedTag = "expected";
122 my $actualTag = "actual";
123 my $diffsTag = "diffs";
124 my $errorTag = "stderr";
127 $platform = "mac-tiger";
128 } elsif (isLeopard()) {
129 $platform = "mac-leopard";
136 } elsif (isCygwin()) {
140 if (!defined($platform)) {
141 print "WARNING: Your platform is not recognized. Any platform-specific results will be generated in platform/undefined.\n";
142 $platform = "undefined";
145 my $programName = basename($0);
146 my $launchSafariDefault = $launchSafari ? "launch" : "do not launch";
147 my $httpDefault = $testHTTP ? "run" : "do not run";
149 # FIXME: "--strict" should be renamed to qt-mac-comparison, or something along those lines.
151 Usage: $programName [options] [testdir|testpath ...]
152 --add-platform-exceptions Put new results for non-platform-specific failing tests into the platform-specific results directory
153 -c|--configuration config Set DumpRenderTree build configuration
154 -g|--guard-malloc Enable malloc guard
155 --help Show this help message
156 -h|--horizontal-sweep Change repaint to sweep horizontally instead of vertically (implies --repaint-tests)
157 --[no-]http Run (or do not run) http tests (default: $httpDefault)
158 -i|--ignore-tests Comma-separated list of directories or tests to ignore
159 --[no-]launch-safari Launch (or do not launch) Safari to display test results (default: $launchSafariDefault)
160 -l|--leaks Enable leaks checking
161 --[no-]new-test-results Generate results for new tests
162 -p|--pixel-tests Enable pixel tests
163 --platform Override the detected platform to use for tests and results (default: $platform)
164 --port Web server port to use with http tests
165 -q|--quiet Less verbose output
166 -r|--repaint-tests Run repaint tests (implies --pixel-tests)
167 --reset-results Reset ALL results (including pixel tests if --pixel-tests is set)
168 -o|--results-directory Output results directory (default: $testResultsDirectory)
169 --root Path to root tools build
170 -1|--singly Isolate each test case run (implies --verbose)
171 --skipped=[default|ignore|only] Specifies how to treat the Skipped file
172 default: Tests/directories listed in the Skipped file are not tested
173 ignore: The Skipped file is ignored
174 only: Only those tests/directories listed in the Skipped file will be run
175 --slowest Report the 10 slowest tests
176 --strict Do a comparison with the output on Mac (Qt only)
177 --[no-]strip-editing-callbacks Remove editing callbacks from expected results
178 --svg Run only SVG tests (implies --pixel-tests)
179 -t|--threaded Run a concurrent JavaScript thead with each test
180 --valgrind Run DumpRenderTree inside valgrind (Qt/Linux only)
181 -v|--verbose More verbose output (overrides --quiet)
184 my $getOptionsResult = GetOptions(
185 'c|configuration=s' => \$configuration,
186 'debug|devel' => sub { $configuration = "Debug" },
187 'guard-malloc|g' => \$guardMalloc,
188 'help' => \$showHelp,
189 'horizontal-sweep|h' => \$repaintSweepHorizontally,
190 'http!' => \$testHTTP,
191 'ignore-tests|i=s' => \$ignoreTests,
192 'launch-safari!' => \$launchSafari,
193 'leaks|l' => \$shouldCheckLeaks,
194 'pixel-tests|p' => \$pixelTests,
195 'platform=s' => \$platform,
196 'port=i' => \$httpdPort,
197 'quiet|q' => \$quiet,
198 'release|deploy' => sub { $configuration = "Release" },
199 'repaint-tests|r' => \$repaintTests,
200 'reset-results' => \$resetResults,
201 'new-test-results!' => \$generateNewResults,
202 'results-directory|o=s' => \$testResultsDirectory,
203 'singly|1' => sub { $testsPerDumpTool = 1; },
204 'nthly=i' => \$testsPerDumpTool,
205 'skipped=s' => \&validateSkippedArg,
206 'slowest' => \$report10Slowest,
207 'svg' => \$testOnlySVGs,
208 'threaded|t' => \$threaded,
209 'verbose|v' => \$verbose,
210 'valgrind' => \$useValgrind,
211 'strict' => \$strictTesting,
212 'strip-editing-callbacks!' => \$stripEditingCallbacks,
214 'add-platform-exceptions' => \$addPlatformExceptions,
217 if (!$getOptionsResult || $showHelp) {
222 my $ignoreSkipped = $treatSkipped eq "ignore";
223 my $skippedOnly = $treatSkipped eq "only";
225 !$skippedOnly || @ARGV == 0 or die "--skipped=only cannot be used when tests are specified on the command line.";
227 setConfiguration($configuration);
229 my $configurationOption = "--" . lc($configuration);
231 $repaintTests = 1 if $repaintSweepHorizontally;
233 $pixelTests = 1 if $testOnlySVGs;
234 $pixelTests = 1 if $repaintTests;
236 $verbose = 1 if $testsPerDumpTool == 1;
238 if ($shouldCheckLeaks && $testsPerDumpTool > 1000) {
239 print STDERR "\nWARNING: Running more than 1000 tests at a time with MallocStackLogging enabled may cause a crash.\n\n";
242 # Force --no-http for Qt/Linux, for now.
243 $testHTTP = 0 if isQt();
245 setConfigurationProductDir(Cwd::abs_path($root)) if (defined($root));
246 my $productDir = productDir();
247 $productDir .= "/bin" if (isQt());
254 $buildResult = buildVisualStudioProject("WebKitTools/DumpRenderTree/DumpRenderTree.sln");
256 # Push the parameters to build-dumprendertree as an array
258 push(@args, $configuration);
263 push(@args, "--gtk");
266 $buildResult = system "WebKitTools/Scripts/build-dumprendertree", @args;
270 print STDERR "Compiling DumpRenderTree failed!\n";
271 exit WEXITSTATUS($buildResult);
275 my $dumpToolName = "DumpRenderTree";
276 $dumpToolName .= "_debug" if isCygwin() && $configuration ne "Release";
277 my $dumpTool = "$productDir/$dumpToolName";
278 die "can't find executable $dumpToolName (looked in $productDir)\n" unless -x $dumpTool;
280 my $imageDiffTool = "$productDir/ImageDiff";
281 die "can't find executable $imageDiffTool (looked in $productDir)\n" if $pixelTests && !-x $imageDiffTool;
283 checkFrameworks() unless isCygwin();
285 my $layoutTestsName = "LayoutTests";
286 my $testDirectory = File::Spec->rel2abs($layoutTestsName);
287 my $expectedDirectory = $testDirectory;
288 my $platformBaseDirectory = catdir($testDirectory, "platform");
289 my $platformTestDirectory = catdir($platformBaseDirectory, $platform);
290 my @platformHierarchy = buildPlatformHierarchy();
292 $expectedDirectory = $ENV{"WebKitExpectedTestResultsDirectory"} if $ENV{"WebKitExpectedTestResultsDirectory"};
295 $testDirectory .= "/svg";
296 $expectedDirectory .= "/svg";
299 my $testResults = catfile($testResultsDirectory, "results.html");
301 print "Running tests from $testDirectory\n";
306 system "ln", "-s", $testDirectory, "/tmp/LayoutTests" unless -x "/tmp/LayoutTests";
308 my %ignoredFiles = ();
309 my %ignoredDirectories = map { $_ => 1 } qw(platform);
310 my %ignoredLocalDirectories = map { $_ => 1 } qw(.svn _svn resources);
311 my %supportedFileExtensions = map { $_ => 1 } qw(html shtml xml xhtml pl php);
313 %supportedFileExtensions = map { $_ => 1 } qw(svg xml);
314 } elsif (checkWebCoreSVGSupport($testOnlySVGs)) {
315 $supportedFileExtensions{'svg'} = 1;
316 } elsif (isCygwin()) {
317 # FIXME: We should fix webkitdirs.pm:hasSVGSupport() to do the correct
318 # check for Windows instead of forcing this here.
319 $supportedFileExtensions{'svg'} = 1;
321 $ignoredLocalDirectories{'svg'} = 1;
324 $ignoredDirectories{'http'} = 1;
328 processIgnoreTests($ignoreTests);
331 if (!$ignoreSkipped) {
332 foreach my $level (@platformHierarchy) {
333 if (open SKIPPED, "<", "$level/Skipped") {
334 if ($verbose && !$skippedOnly) {
335 my ($dir, $name) = splitpath($level);
336 print "Skipped tests in $name:\n";
342 $skipped =~ s/^[ \n\r]+//;
343 $skipped =~ s/[ \n\r]+$//;
344 if ($skipped && $skipped !~ /^#/) {
346 push(@ARGV, $skipped);
351 processIgnoreTests($skipped);
361 my $directoryFilter = sub {
362 return () if exists $ignoredLocalDirectories{basename($File::Find::dir)};
363 return () if exists $ignoredDirectories{File::Spec->abs2rel($File::Find::dir, $testDirectory)};
367 my $fileFilter = sub {
369 if ($filename =~ /\.([^.]+)$/) {
370 if (exists $supportedFileExtensions{$1}) {
371 my $path = File::Spec->abs2rel(catfile($File::Find::dir, $filename), $testDirectory);
372 push @tests, $path if !exists $ignoredFiles{$path};
377 for my $test (@ARGV) {
378 $test =~ s/^($layoutTestsName|$testDirectory)\///;
379 my $fullPath = catfile($testDirectory, $test);
380 if (file_name_is_absolute($test)) {
381 print "can't run test $test outside $testDirectory\n";
382 } elsif (-f $fullPath) {
383 my ($filename, $pathname, $fileExtension) = fileparse($test, qr{\.[^.]+$});
384 if (!exists $supportedFileExtensions{substr($fileExtension, 1)}) {
385 print "test $test does not have a supported extension\n";
386 } elsif ($testHTTP || $pathname !~ /^http\//) {
389 } elsif (-d $fullPath) {
390 find({ preprocess => $directoryFilter, wanted => $fileFilter }, $fullPath);
392 for my $level (@platformHierarchy) {
393 my $platformPath = catfile($level, $test);
394 find({ preprocess => $directoryFilter, wanted => $fileFilter }, $platformPath) if (-d $platformPath);
397 print "test $test not found\n";
401 find({ preprocess => $directoryFilter, wanted => $fileFilter }, $testDirectory);
403 for my $level (@platformHierarchy) {
404 find({ preprocess => $directoryFilter, wanted => $fileFilter }, $level);
408 die "no tests to run\n" if !@tests;
410 @tests = sort pathcmp @tests;
415 my %imageDifferences;
418 my $leaksOutputFileNumber = 1;
422 push @toolArgs, "--dump-all-pixels" if $pixelTests && $resetResults;
423 push @toolArgs, "--pixel-tests" if $pixelTests;
424 push @toolArgs, "--repaint" if $repaintTests;
425 push @toolArgs, "--horizontal-sweep" if $repaintSweepHorizontally;
426 push @toolArgs, "--threaded" if $threaded;
427 push @toolArgs, "--paint" if $shouldCheckLeaks; # Otherwise, DRT won't exercise painting leaks.
432 my $imageDiffToolPID;
435 $ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
436 $imageDiffToolPID = open2(\*DIFFIN, \*DIFFOUT, $imageDiffTool, "") or die "unable to open $imageDiffTool\n";
440 my $isDumpToolOpen = 0;
441 my $dumpToolCrashed = 0;
444 my $lastDirectory = "";
448 sub catch_pipe { $dumpToolCrashed = 1; }
449 $SIG{"PIPE"} = "catch_pipe";
451 print "Testing ", scalar @tests, " test cases.\n";
452 my $overallStartTime = time;
454 my %expectedResultDirectory;
456 for my $test (@tests) {
457 next if $test eq 'results.html';
461 my $base = stripExtension($test);
464 print "running $test -> ";
469 if ($dir ne $lastDirectory) {
470 print "\n" unless $atLineStart;
472 $lastDirectory = $dir;
480 my $startTime = time if $report10Slowest;
482 if ($test !~ /^http\//) {
483 my $testPath = "$testDirectory/$test";
485 $testPath = toWindowsPath($testPath);
487 $testPath = canonpath($testPath);
489 print OUT "$testPath\n";
492 if ($test !~ /^http\/tests\/local\// && $test !~ /^http\/tests\/ssl\//) {
493 my $path = canonpath($test);
494 $path =~ s/^http\/tests\///;
495 print OUT "http://127.0.0.1:$httpdPort/$path\n";
496 } elsif ($test =~ /^http\/tests\/ssl\//) {
497 my $path = canonpath($test);
498 $path =~ s/^http\/tests\///;
499 print OUT "https://127.0.0.1:$httpdSSLPort/$path\n";
501 my $testPath = "$testDirectory/$test";
503 $testPath = toWindowsPath($testPath);
505 $testPath = canonpath($testPath);
507 print OUT "$testPath\n";
516 $actual =~ s/\r//g if isCygwin();
518 my $isText = isTextOnlyTest($actual);
520 $durations{$test} = time - $startTime if $report10Slowest;
523 my $expectedDir = expectedDirectoryForTest($base, $isText);
524 $expectedResultDirectory{$base} = $expectedDir;
526 if (!$resetResults && open EXPECTED, "<", "$expectedDir/$base-$expectedTag.txt") {
529 next if $stripEditingCallbacks && $_ =~ /^EDITING DELEGATE:/;
535 if (!isOSX() && $strictTesting && !$isText) {
536 if (!$resetResults && open EXPECTED, "<", "$testDirectory/platform/mac/$base-$expectedTag.txt") {
545 if ($shouldCheckLeaks && $testsPerDumpTool == 1) {
551 my $diffPercentage = "";
552 my $diffResult = "passed";
556 my $expectedHash = "";
557 my $actualPNGSize = 0;
561 if (/ActualHash: ([a-f0-9]{32})/) {
563 } elsif (/BaselineHash: ([a-f0-9]{32})/) {
565 } elsif (/Content-length: (\d+)\s*/) {
567 read(IN, $actualPNG, $actualPNGSize);
571 if ($expectedHash ne $actualHash && -f "$expectedDir/$base-$expectedTag.png") {
572 my $expectedPNGSize = -s "$expectedDir/$base-$expectedTag.png";
573 my $expectedPNG = "";
574 open EXPECTEDPNG, "$expectedDir/$base-$expectedTag.png";
575 read(EXPECTEDPNG, $expectedPNG, $expectedPNGSize);
577 print DIFFOUT "Content-length: $actualPNGSize\n";
578 print DIFFOUT $actualPNG;
580 print DIFFOUT "Content-length: $expectedPNGSize\n";
581 print DIFFOUT $expectedPNG;
584 last if /^error/ || /^diff:/;
585 if (/Content-length: (\d+)\s*/) {
586 read(DIFFIN, $diffPNG, $1);
590 if (/^diff: (.+)% (passed|failed)/) {
591 $diffPercentage = $1;
592 $imageDifferences{$base} = $diffPercentage;
597 if ($actualPNGSize && ($resetResults || !-f "$expectedDir/$base-$expectedTag.png")) {
598 mkpath catfile($expectedDir, dirname($base)) if $testDirectory ne $expectedDir;
599 open EXPECTED, ">", "$expectedDir/$base-expected.png" or die "could not create $expectedDir/$base-expected.png\n";
600 print EXPECTED $actualPNG;
604 # update the expected hash if the image diff said that there was no difference
605 if ($actualHash ne "" && ($resetResults || !-f "$expectedDir/$base-$expectedTag.checksum")) {
606 open EXPECTED, ">", "$expectedDir/$base-$expectedTag.checksum" or die "could not create $expectedDir/$base-$expectedTag.checksum\n";
607 print EXPECTED $actualHash;
612 if (!isOSX() && $strictTesting && !$isText) {
613 if (defined $expectedMac) {
614 my $simplified_actual;
615 $simplified_actual = $actual;
616 $simplified_actual =~ s/at \(-?[0-9]+,-?[0-9]+\) *//g;
617 $simplified_actual =~ s/size -?[0-9]+x-?[0-9]+ *//g;
618 $simplified_actual =~ s/text run width -?[0-9]+: //g;
619 $simplified_actual =~ s/text run width -?[0-9]+ [a-zA-Z ]+: //g;
620 $simplified_actual =~ s/RenderButton {BUTTON} .*/RenderButton {BUTTON}/g;
621 $simplified_actual =~ s/RenderImage {INPUT} .*/RenderImage {INPUT}/g;
622 $simplified_actual =~ s/RenderBlock {INPUT} .*/RenderBlock {INPUT}/g;
623 $simplified_actual =~ s/RenderTextControl {INPUT} .*/RenderTextControl {INPUT}/g;
624 $simplified_actual =~ s/\([0-9]+px/px/g;
625 $simplified_actual =~ s/ *" *\n +" */ /g;
626 $simplified_actual =~ s/" +$/"/g;
628 $simplified_actual =~ s/- /-/g;
629 $simplified_actual =~ s/\n( *)"\s+/\n$1"/g;
630 $simplified_actual =~ s/\s+"\n/"\n/g;
632 $expectedMac =~ s/at \(-?[0-9]+,-?[0-9]+\) *//g;
633 $expectedMac =~ s/size -?[0-9]+x-?[0-9]+ *//g;
634 $expectedMac =~ s/text run width -?[0-9]+: //g;
635 $expectedMac =~ s/text run width -?[0-9]+ [a-zA-Z ]+: //g;
636 $expectedMac =~ s/RenderButton {BUTTON} .*/RenderButton {BUTTON}/g;
637 $expectedMac =~ s/RenderImage {INPUT} .*/RenderImage {INPUT}/g;
638 $expectedMac =~ s/RenderBlock {INPUT} .*/RenderBlock {INPUT}/g;
639 $expectedMac =~ s/RenderTextControl {INPUT} .*/RenderTextControl {INPUT}/g;
640 $expectedMac =~ s/\([0-9]+px/px/g;
641 $expectedMac =~ s/ *" *\n +" */ /g;
642 $expectedMac =~ s/" +$/"/g;
644 $expectedMac =~ s/- /-/g;
645 $expectedMac =~ s/\n( *)"\s+/\n$1"/g;
646 $expectedMac =~ s/\s+"\n/"\n/g;
648 if ($simplified_actual ne $expectedMac) {
649 open ACTUAL, ">", "/tmp/actual.txt" or die;
650 print ACTUAL $simplified_actual;
652 open ACTUAL, ">", "/tmp/expected.txt" or die;
653 print ACTUAL $expectedMac;
655 system "diff -u \"/tmp/expected.txt\" \"/tmp/actual.txt\" > \"/tmp/simplified.diff\"";
657 $diffResult = "failed";
660 system "cat /tmp/simplified.diff";
667 if (dumpToolDidCrash()) {
670 printFailureMessageForTest($test, "crashed");
672 my $dir = "$testResultsDirectory/$base";
673 $dir =~ s|/([^/]+)$|| or die "Failed to find test name from base\n";
676 deleteExpectedAndActualResults($base);
678 open CRASH, ">", "$testResultsDirectory/$base-$errorTag.txt" or die;
682 recordActualResultsAndDiff($base, $actual);
685 } elsif (!defined $expected) {
687 print "new " . ($resetResults ? "result" : "test") ."\n";
692 if ($generateNewResults || $resetResults) {
693 mkpath catfile($expectedDir, dirname($base)) if $testDirectory ne $expectedDir;
694 open EXPECTED, ">", "$expectedDir/$base-$expectedTag.txt" or die "could not create $expectedDir/$base-$expectedTag.txt\n";
695 print EXPECTED $actual;
698 deleteExpectedAndActualResults($base);
699 unless ($resetResults) {
700 # Always print the file name for new tests, as they will probably need some manual inspection.
701 # in verbose mode we already printed the test case, so no need to do it again.
703 print "\n" unless $atLineStart;
706 my $resultsDir = catdir($expectedDir, dirname($base));
707 print "new (results generated in $resultsDir)\n";
710 } elsif ($actual eq $expected && $diffResult eq "passed") {
716 deleteExpectedAndActualResults($base);
718 $result = "mismatch";
720 my $message = $actual eq $expected ? "pixel test failed" : "failed";
722 if ($actual ne $expected && $addPlatformExceptions) {
723 my $testBase = catfile($testDirectory, $base);
724 my $expectedBase = catfile($expectedDir, $base);
725 my $testIsMaximallyPlatformSpecific = $testBase =~ m|^\Q$platformTestDirectory\E/|;
726 my $expectedResultIsMaximallyPlatformSpecific = $expectedBase =~ m|^\Q$platformTestDirectory\E/|;
727 if (!$testIsMaximallyPlatformSpecific && !$expectedResultIsMaximallyPlatformSpecific) {
728 mkpath catfile($platformTestDirectory, dirname($base));
729 my $expectedFile = catfile($platformTestDirectory, "$base-$expectedTag.txt");
730 open EXPECTED, ">", $expectedFile or die "could not create $expectedFile\n";
731 print EXPECTED $actual;
733 $message .= " (results generated in $platformTestDirectory)";
737 printFailureMessageForTest($test, $message);
739 my $dir = "$testResultsDirectory/$base";
740 $dir =~ s|/([^/]+)$|| or die "Failed to find test name from base\n";
744 deleteExpectedAndActualResults($base);
745 recordActualResultsAndDiff($base, $actual);
747 if ($pixelTests && $diffPNG && $diffPNG ne "") {
748 $imagesPresent{$base} = 1;
750 open ACTUAL, ">", "$testResultsDirectory/$base-$actualTag.png" or die;
751 print ACTUAL $actualPNG;
754 open DIFF, ">", "$testResultsDirectory/$base-$diffsTag.png" or die;
758 copy("$expectedDir/$base-$expectedTag.png", "$testResultsDirectory/$base-$expectedTag.png");
760 open DIFFHTML, ">$testResultsDirectory/$base-$diffsTag.html" or die;
761 print DIFFHTML "<html>\n";
762 print DIFFHTML "<head>\n";
763 print DIFFHTML "<title>$base Image Compare</title>\n";
764 print DIFFHTML "<script language=\"Javascript\" type=\"text/javascript\">\n";
765 print DIFFHTML "var currentImage = 0;\n";
766 print DIFFHTML "var imageNames = new Array(\"Actual\", \"Expected\");\n";
767 print DIFFHTML "var imagePaths = new Array(\"$testName-$actualTag.png\", \"$testName-$expectedTag.png\");\n";
768 if (-f "$testDirectory/$base-w3c.png") {
769 copy("$testDirectory/$base-w3c.png", "$testResultsDirectory/$base-w3c.png");
770 print DIFFHTML "imageNames.push(\"W3C\");\n";
771 print DIFFHTML "imagePaths.push(\"$testName-w3c.png\");\n";
773 print DIFFHTML "function animateImage() {\n";
774 print DIFFHTML " var image = document.getElementById(\"animatedImage\");\n";
775 print DIFFHTML " var imageText = document.getElementById(\"imageText\");\n";
776 print DIFFHTML " image.src = imagePaths[currentImage];\n";
777 print DIFFHTML " imageText.innerHTML = imageNames[currentImage] + \" Image\";\n";
778 print DIFFHTML " currentImage = (currentImage + 1) % imageNames.length;\n";
779 print DIFFHTML " setTimeout('animateImage()',2000);\n";
780 print DIFFHTML "}\n";
781 print DIFFHTML "</script>\n";
782 print DIFFHTML "</head>\n";
783 print DIFFHTML "<body onLoad=\"animateImage();\">\n";
784 print DIFFHTML "<table>\n";
785 if ($diffPercentage) {
786 print DIFFHTML "<tr>\n";
787 print DIFFHTML "<td>Difference between images: <a href=\"$testName-$diffsTag.png\">$diffPercentage%</a></td>\n";
788 print DIFFHTML "</tr>\n";
790 print DIFFHTML "<tr>\n";
791 print DIFFHTML "<td><a href=\"" . toURL("$testDirectory/$test") . "\">test file</a></td>\n";
792 print DIFFHTML "</tr>\n";
793 print DIFFHTML "<tr>\n";
794 print DIFFHTML "<td id=\"imageText\" style=\"text-weight: bold;\">Actual Image</td>\n";
795 print DIFFHTML "</tr>\n";
796 print DIFFHTML "<tr>\n";
797 print DIFFHTML "<td><img src=\"$testName-$actualTag.png\" id=\"animatedImage\"></td>\n";
798 print DIFFHTML "</tr>\n";
799 print DIFFHTML "</table>\n";
800 print DIFFHTML "</body>\n";
801 print DIFFHTML "</html>\n";
805 if (($count + 1) % $testsPerDumpTool == 0 || $count == $#tests) {
806 if ($shouldCheckLeaks) {
808 if ($testsPerDumpTool == 1) {
809 $fileName = "$testResultsDirectory/$base-leaks.txt";
811 $fileName = "$testResultsDirectory/" . fileNameWithNumber($dumpToolName, $leaksOutputFileNumber) . "-leaks.txt";
813 my $leakCount = countAndPrintLeaks($dumpToolName, $dumpToolPID, $fileName);
814 $totalLeaks += $leakCount;
815 $leaksOutputFileNumber++ if ($leakCount);
823 push @{$tests{$result}}, $test;
824 $testType{$test} = $isText;
826 printf "\n%0.2fs total testing time\n", (time - $overallStartTime) . "";
828 !$isDumpToolOpen || die "Failed to close $dumpToolName.\n";
832 # Because multiple instances of this script are running concurrently we cannot
833 # safely delete this symlink.
834 # system "rm /tmp/LayoutTests";
836 # FIXME: Do we really want to check the image-comparison tool for leaks every time?
837 if ($shouldCheckLeaks && $pixelTests) {
838 $totalLeaks += countAndPrintLeaks("ImageDiff", $imageDiffToolPID, "$testResultsDirectory/ImageDiff-leaks.txt");
842 print "\nWARNING: $totalLeaks total leaks found!\n";
843 print "See above for individual leaks results.\n" if ($leaksOutputFileNumber > 2);
850 if ($report10Slowest) {
851 print "\n\nThe 10 slowest tests:\n\n";
853 for my $test (sort slowestcmp keys %durations) {
854 printf "%0.2f secs: %s\n", $durations{$test}, $test;
855 last if ++$count == 10;
861 if ($skippedOnly && $counts{"match"}) {
862 print "The following tests are in the Skipped file (" . File::Spec->abs2rel("$platformTestDirectory/Skipped", $testDirectory) . "), but succeeded:\n";
863 foreach my $test (@{$tests{"match"}}) {
868 if ($resetResults || ($counts{match} && $counts{match} == $count)) {
869 print "all $count test cases succeeded\n";
876 match => "succeeded",
877 mismatch => "had incorrect layout",
882 for my $type ("match", "mismatch", "new", "crash") {
883 my $c = $counts{$type};
885 my $t = $text{$type};
889 $message = sprintf "1 test case (%d%%) %s\n", 1 * 100 / $count, $t;
891 $message = sprintf "%d test cases (%d%%) %s\n", $c, $c * 100 / $count, $t;
893 $message =~ s-\(0%\)-(<1%)-;
898 mkpath $testResultsDirectory;
900 open HTML, ">", $testResults or die;
901 print HTML "<html>\n";
902 print HTML "<head>\n";
903 print HTML "<title>Layout Test Results</title>\n";
904 print HTML "</head>\n";
905 print HTML "<body>\n";
907 if ($counts{mismatch}) {
908 print HTML "<p>Tests where results did not match expected results:</p>\n";
909 print HTML "<table>\n";
910 for my $test (@{$tests{mismatch}}) {
911 my $base = stripExtension($test);
913 print HTML "<td><a href=\"" . toURL("$testDirectory/$test") . "\">$test</a></td>\n";
914 print HTML htmlForExpectedAndActualResults($base);
916 if ($imagesPresent{$base}) {
917 print HTML "<td><a href=\"" . toURL("$base-$expectedTag.png") . "\">expected image</a></td>\n";
918 print HTML "<td><a href=\"" . toURL("$base-$diffsTag.html") . "\">image diffs</a>\n";
919 print HTML "<a href=\"" . toURL("$base-$diffsTag.png") . "\">$imageDifferences{$base}%</a></td>\n";
921 print HTML "<td></td><td></td>\n";
924 print HTML "</tr>\n";
926 print HTML "</table>\n";
929 if ($counts{crash}) {
930 print HTML "<p>Tests that caused the DumpRenderTree tool to crash:</p>\n";
931 print HTML "<table>\n";
932 for my $test (@{$tests{crash}}) {
933 my $base = stripExtension($test);
934 my $expectedDir = $expectedResultDirectory{$base};
936 print HTML "<td><a href=\"" . toURL("$testDirectory/$test") . "\">$base</a></td>\n";
937 print HTML htmlForExpectedAndActualResults($base);
938 print HTML "<td><a href=\"$base-$errorTag.txt\">stderr</a></td>\n";
939 print HTML "</tr>\n";
941 print HTML "</table>\n";
945 print HTML "<p>Tests that had no expected results (probably new):</p>\n";
946 print HTML "<table>\n";
947 for my $test (@{$tests{new}}) {
948 my $base = stripExtension($test);
949 my $expectedDir = $expectedResultDirectory{$base};
951 print HTML "<td><a href=\"" . toURL("$testDirectory/$test") . "\">$base</a></td>\n";
952 print HTML "<td><a href=\"" . toURL("$expectedDir/$base-$expectedTag.txt") . "\">results</a></td>\n";
953 if ($pixelTests && -f "$expectedDir/$base-$expectedTag.png") {
954 print HTML "<td><a href=\"" . toURL("$expectedDir/$base-$expectedTag.png") . "\">image</a></td>\n";
956 print HTML "</tr>\n";
958 print HTML "</table>\n";
961 print HTML "</body>\n";
962 print HTML "</html>\n";
966 system "konqueror", $testResults if $launchSafari;
967 } elsif (isCygwin()) {
968 system "cygstart", $testResults if $launchSafari;
970 system "WebKitTools/Scripts/run-safari", $configurationOption, "-NSOpen", $testResults if $launchSafari;
973 closeCygpaths() if isCygwin();
977 sub countAndPrintLeaks($$$)
979 my ($dumpToolName, $dumpToolPID, $leaksFilePath) = @_;
981 print "\n" unless $atLineStart;
984 # We are excluding the following reported leaks so they don't get in our way when looking for WebKit leaks:
985 # This allows us ignore known leaks and only be alerted when new leaks occur. Some leaks are in the old
986 # versions of the system frameworks that are being used by the leaks bots. Even though a leak has been
987 # fixed, it will be listed here until the bot has been updated with the newer frameworks.
989 my @typesToExclude = (
992 my @callStacksToExclude = (
993 "Flash_EnforceLocalSecurity" # leaks in Flash plug-in code, rdar://problem/4449747
997 # Leak list for the version of Tiger used on the build bot.
998 push @callStacksToExclude, (
999 "CFRunLoopRunSpecific \\| malloc_zone_malloc", "CFRunLoopRunSpecific \\| CFAllocatorAllocate ", # leak in CFRunLoopRunSpecific, rdar://problem/4670839
1000 "CGImageSourceGetPropertiesAtIndex", # leak in ImageIO, rdar://problem/4628809
1001 "FOGetCoveredUnicodeChars", # leak in ATS, rdar://problem/3943604
1002 "GetLineDirectionPreference", "InitUnicodeUtilities", # leaks tool falsely reporting leak in CFNotificationCenterAddObserver, rdar://problem/4964790
1003 "ICCFPrefWrapper::GetPrefDictionary", # leaks in Internet Config. code, rdar://problem/4449794
1004 "NSHTTPURLProtocol setResponseHeader:", # leak in multipart/mixed-replace handling in Foundation, no Radar, but fixed in Leopard
1005 "NSURLCache cachedResponseForRequest", # leak in CFURL cache, rdar://problem/4768430
1006 "PCFragPrepareClosureFromFile", # leak in Code Fragment Manager, rdar://problem/3426998
1007 "WebCore::Selection::toRange", # bug in 'leaks', rdar://problem/4967949
1008 "WebCore::SubresourceLoader::create", # bug in 'leaks', rdar://problem/4985806
1009 "_CFPreferencesDomainDeepCopyDictionary", # leak in CFPreferences, rdar://problem/4220786
1010 "_objc_msgForward", # leak in NSSpellChecker, rdar://problem/4965278
1011 "gldGetString", # leak in OpenGL, rdar://problem/5013699
1012 "LayoutTestController::queueReload", #rdar://problem/5546478 REGRESSION: 2 leaks on Tiger under LayoutTestController::queueReload
1013 "_setDefaultUserInfoFromURL", #rdar://problem/5546453 REGRESSION: 3 leaks on Tiger under _setDefaultUserInfoFromURL
1014 "SSLHandshake" #rdar://problem/5546440 REGRESSION: 1 leak on Tiger under SSL
1016 push @typesToExclude, (
1017 "THRD", # bug in 'leaks', Radar 3387783
1018 "DRHT" # ditto (endian little hate i)
1023 # Leak list for the version of Leopard used on the build bot.
1024 push @callStacksToExclude, (
1025 "CFHTTPMessageAppendBytes", # rdar://problem/5435912
1026 "sendDidReceiveDataCallback", # rdar://problem/5441619
1027 "_CFHTTPReadStreamReadMark", # rdar://problem/5441468
1028 "httpProtocolStart", # rdar://problem/5468837
1029 "_CFURLConnectionSendCallbacks", # rdar://problem/5441600
1033 my $leaksTool = sourceDir() . "/WebKitTools/Scripts/run-leaks";
1034 my $excludeString = "--exclude-callstack '" . (join "' --exclude-callstack '", @callStacksToExclude) . "'";
1035 $excludeString .= " --exclude-type '" . (join "' --exclude-type '", @typesToExclude) . "'" if @typesToExclude;
1037 print " ? checking for leaks in $dumpToolName\n";
1038 my $leaksOutput = `$leaksTool $excludeString $dumpToolPID`;
1039 my ($count, $bytes) = $leaksOutput =~ /Process $dumpToolPID: (\d+) leaks? for (\d+) total/;
1040 my ($excluded) = $leaksOutput =~ /(\d+) leaks? excluded/;
1042 my $adjustedCount = $count;
1043 $adjustedCount -= $excluded if $excluded;
1045 if (!$adjustedCount) {
1046 print " - no leaks found\n";
1047 unlink $leaksFilePath;
1050 my $dir = $leaksFilePath;
1051 $dir =~ s|/[^/]+$|| or die;
1055 print " + $adjustedCount leaks ($bytes bytes including $excluded excluded leaks) were found, details in $leaksFilePath\n";
1057 print " + $count leaks ($bytes bytes) were found, details in $leaksFilePath\n";
1060 open LEAKS, ">", $leaksFilePath or die;
1061 print LEAKS $leaksOutput;
1065 return $adjustedCount;
1068 # Break up a path into the directory (with slash) and base name.
1073 my $pathSeparator = "/";
1074 my $dirname = dirname($path) . $pathSeparator;
1075 $dirname = "" if $dirname eq "." . $pathSeparator;
1077 return ($dirname, basename($path));
1080 # Sort first by directory, then by file, so all paths in one directory are grouped
1081 # rather than being interspersed with items from subdirectories.
1082 # Use numericcmp to sort directory and filenames to make order logical.
1085 my ($patha, $pathb) = @_;
1087 my ($dira, $namea) = splitpath($patha);
1088 my ($dirb, $nameb) = splitpath($pathb);
1090 return numericcmp($dira, $dirb) if $dira ne $dirb;
1091 return numericcmp($namea, $nameb);
1094 # Sort numeric parts of strings as numbers, other parts as strings.
1095 # Makes 1.33 come after 1.3, which is cool.
1100 my @a = split /(\d+)/, $aa;
1101 my @b = split /(\d+)/, $bb;
1103 # Compare one chunk at a time.
1104 # Each chunk is either all numeric digits, or all not numeric digits.
1109 # Use numeric comparison if chunks are non-equal numbers.
1110 return $a <=> $b if $a =~ /^\d/ && $b =~ /^\d/ && $a != $b;
1112 # Use string comparison if chunks are any other kind of non-equal string.
1113 return $a cmp $b if $a ne $b;
1116 # One of the two is now empty; compare lengths for result in this case.
1120 # Sort slowest tests first.
1123 my ($testa, $testb) = @_;
1125 my $dura = $durations{$testa};
1126 my $durb = $durations{$testb};
1127 return $durb <=> $dura if $dura != $durb;
1128 return pathcmp($testa, $testb);
1133 return if $isDumpToolOpen;
1135 # Save some requires variables for the linux environment...
1136 my $homeDir = $ENV{'HOME'};
1137 my $libraryPath = $ENV{'LD_LIBRARY_PATH'};
1138 my $dbusAddress = $ENV{'DBUS_SESSION_BUS_ADDRESS'};
1139 my $display = $ENV{'DISPLAY'};
1140 my $testfonts = $ENV{'WEBKIT_TESTFONTS'};
1142 my $homeDrive = $ENV{'HOMEDRIVE'};
1143 my $homePath = $ENV{'HOMEPATH'};
1147 if (defined $display) {
1148 $ENV{DISPLAY} = $display;
1150 $ENV{DISPLAY} = ":1";
1152 $ENV{'WEBKIT_TESTFONTS'} = $testfonts;
1153 $ENV{HOME} = $homeDir;
1154 if (defined $libraryPath) {
1155 $ENV{LD_LIBRARY_PATH} = $libraryPath;
1157 if (defined $dbusAddress) {
1158 $ENV{DBUS_SESSION_BUS_ADDRESS} = $dbusAddress;
1161 $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
1162 $ENV{XML_CATALOG_FILES} = ""; # work around missing /etc/catalog <rdar://problem/4292995>
1163 $ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
1164 $ENV{DYLD_INSERT_LIBRARIES} = "/usr/lib/libgmalloc.dylib" if $guardMalloc;
1167 $ENV{HOMEDRIVE} = $homeDrive;
1168 $ENV{HOMEPATH} = $homePath;
1169 setPathForRunningWebKitApp(\%ENV) if isCygwin();
1174 push @args, $dumpTool;
1176 push @args, @toolArgs;
1178 $dumpTool = "valgrind";
1180 $dumpToolPID = open3(\*OUT, \*IN, \*ERROR, $dumpTool, @args) or die "Failed to start tool: $dumpTool\n";
1181 $isDumpToolOpen = 1;
1182 $dumpToolCrashed = 0;
1187 return if !$isDumpToolOpen;
1192 waitpid $dumpToolPID, 0;
1193 $isDumpToolOpen = 0;
1196 sub dumpToolDidCrash()
1198 return 1 if $dumpToolCrashed;
1199 return 0 unless $isDumpToolOpen;
1201 my $pid = waitpid(-1, WNOHANG);
1202 return $pid == $dumpToolPID;
1205 sub openHTTPDIfNeeded()
1207 return if $isHttpdOpen;
1209 mkdir "/tmp/WebKit";
1211 if (-f "/tmp/WebKit/httpd.pid") {
1212 my $oldPid = `cat /tmp/WebKit/httpd.pid`;
1214 if (0 != kill 0, $oldPid) {
1215 print "\nhttpd is already running: pid $oldPid, killing...\n";
1218 my $retryCount = 20;
1219 while ((0 != kill 0, $oldPid) && $retryCount) {
1224 die "Timed out waiting for httpd to quit" unless $retryCount;
1228 my $httpdPath = "/usr/sbin/httpd";
1231 my $windowsConfDirectory = "$testDirectory/http/conf/";
1232 unless (-x "/usr/lib/apache/libphp4.dll") {
1233 copy("$windowsConfDirectory/libphp4.dll", "/usr/lib/apache/libphp4.dll");
1234 chmod(0755, "/usr/lib/apache/libphp4.dll");
1236 $httpdConfig = "$windowsConfDirectory/cygwin-httpd.conf";
1238 $httpdConfig = "$testDirectory/http/conf/httpd.conf";
1239 $httpdConfig = "$testDirectory/http/conf/apache2-httpd.conf" if `$httpdPath -v` =~ m|Apache/2|;
1241 my $documentRoot = "$testDirectory/http/tests";
1242 my $typesConfig = "$testDirectory/http/conf/mime.types";
1243 my $listen = "127.0.0.1:$httpdPort";
1244 my $absTestResultsDirectory = File::Spec->rel2abs(glob $testResultsDirectory);
1245 my $sslCertificate = "$testDirectory/http/conf/webkit-httpd.pem";
1247 mkpath $absTestResultsDirectory;
1250 "-f", "$httpdConfig",
1251 "-C", "DocumentRoot \"$documentRoot\"",
1252 "-C", "Listen $listen",
1253 "-c", "TypesConfig \"$typesConfig\"",
1254 "-c", "CustomLog \"$absTestResultsDirectory/access_log.txt\" common",
1255 "-c", "ErrorLog \"$absTestResultsDirectory/error_log.txt\"",
1256 # Apache wouldn't run CGIs with permissions==700 otherwise
1257 "-c", "User \"#$<\""
1260 # FIXME: Enable this on Windows once <rdar://problem/5345985> is fixed
1261 push(@args, "-c", "SSLCertificateFile \"$sslCertificate\"") unless isCygwin();
1263 open2(\*HTTPDIN, \*HTTPDOUT, $httpdPath, @args);
1265 my $retryCount = 20;
1266 while (system("/usr/bin/curl -q --silent --stderr - --output /dev/null $listen") && $retryCount) {
1271 die "Timed out waiting for httpd to start" unless $retryCount;
1278 return if !$isHttpdOpen;
1283 kill 15, `cat /tmp/WebKit/httpd.pid` if -f "/tmp/WebKit/httpd.pid";
1288 sub fileNameWithNumber($$)
1290 my ($base, $number) = @_;
1291 return "$base$number" if ($number > 1);
1295 sub processIgnoreTests($) {
1296 my @ignoreList = split(/\s*,\s*/, shift);
1297 my $addIgnoredDirectories = sub {
1298 return () if exists $ignoredLocalDirectories{basename($File::Find::dir)};
1299 $ignoredDirectories{File::Spec->abs2rel($File::Find::dir, $testDirectory)} = 1;
1302 foreach my $item (@ignoreList) {
1303 my $path = catfile($testDirectory, $item);
1305 $ignoredDirectories{$item} = 1;
1306 find({ preprocess => $addIgnoredDirectories, wanted => sub {} }, $path);
1309 $ignoredFiles{$item} = 1;
1312 print "ignoring '$item' on ignore-tests list\n";
1317 sub stripExtension($)
1321 $test =~ s/\.[a-zA-Z]+$//;
1325 sub isTextOnlyTest($)
1329 if ($actual =~ /^layer at/ms) {
1337 sub expectedDirectoryForTest($;$)
1339 my ($base, $isText) = @_;
1341 my @directories = @platformHierarchy;
1342 push @directories, map { catdir($platformBaseDirectory, $_) } qw(mac-leopard mac) if isCygwin();
1343 push @directories, $expectedDirectory;
1345 # If we already have expected results, just return their location.
1346 foreach my $directory (@directories) {
1347 return $directory if (-f "$directory/$base-$expectedTag.txt");
1350 # For platform-specific tests, the results should go right next to the test itself.
1351 # Note: The return value of this subroutine will be concatenated with $base
1352 # to determine the location of the new results, so returning $expectedDirectory
1353 # will put the results right next to the test.
1354 # FIXME: We want to allow platform/mac tests with platform/mac-leopard results,
1355 # so this needs to be enhanced.
1356 return $expectedDirectory if $base =~ /^platform/;
1358 # For cross-platform tests, text-only results should go in the cross-platform directory,
1359 # while render tree dumps should go in the least-specific platform directory.
1360 return $isText ? $expectedDirectory : $platformHierarchy[$#platformHierarchy];
1363 sub printFailureMessageForTest($$)
1365 my ($test, $description) = @_;
1368 print "\n" unless $atLineStart;
1371 print "$description\n";
1377 sub openCygpathIfNeeded($)
1381 return unless isCygwin();
1382 return $cygpaths{$options} if $cygpaths{$options} && $cygpaths{$options}->{"open"};
1384 local (*CYGPATHIN, *CYGPATHOUT);
1385 my $pid = open2(\*CYGPATHIN, \*CYGPATHOUT, "cygpath -f - $options");
1389 "out" => *CYGPATHOUT,
1393 $cygpaths{$options} = $cygpath;
1400 return unless isCygwin();
1402 foreach my $cygpath (values(%cygpaths)) {
1403 close $cygpath->{"in"};
1404 close $cygpath->{"out"};
1405 waitpid($cygpath->{"pid"}, 0);
1406 $cygpath->{"open"} = 0;
1411 sub convertPathUsingCygpath($$)
1413 my ($path, $options) = @_;
1415 my $cygpath = openCygpathIfNeeded($options);
1416 local *inFH = $cygpath->{"in"};
1417 local *outFH = $cygpath->{"out"};
1418 print outFH $path . "\n";
1419 chomp(my $convertedPath = <inFH>);
1420 return $convertedPath;
1423 sub toWindowsPath($)
1426 return unless isCygwin();
1428 return convertPathUsingCygpath($path, "-w");
1434 return $path unless isCygwin();
1436 return "file:///" . convertPathUsingCygpath($path, "-m");
1439 sub validateSkippedArg($$;$)
1441 my ($option, $value, $value2) = @_;
1442 my %validSkippedValues = map { $_ => 1 } qw(default ignore only);
1443 $value = lc($value);
1444 die "Invalid argument '" . $value . "' for option $option" unless $validSkippedValues{$value};
1445 $treatSkipped = $value;
1448 sub htmlForExpectedAndActualResults($)
1452 return "<td></td><td></td><td></td>\n" unless -s "$testResultsDirectory/$base-$diffsTag.txt";
1454 return "<td><a href=\"$base-$expectedTag.txt\">expected</a></td>\n"
1455 . "<td><a href=\"$base-$actualTag.txt\">actual</a></td>\n"
1456 . "<td><a href=\"$base-$diffsTag.txt\">diffs</a></td>\n";
1459 sub deleteExpectedAndActualResults($)
1463 unlink "$testResultsDirectory/$base-$actualTag.txt";
1464 unlink "$testResultsDirectory/$base-$diffsTag.txt";
1465 unlink "$testResultsDirectory/$base-$errorTag.txt";
1468 sub recordActualResultsAndDiff($$)
1470 my ($base, $actual) = @_;
1472 return unless length($actual);
1474 open ACTUAL, ">", "$testResultsDirectory/$base-$actualTag.txt" or die "Couldn't open actual results file for $base";
1475 print ACTUAL $actual;
1478 my $expectedDir = $expectedResultDirectory{$base};
1479 copy("$expectedDir/$base-$expectedTag.txt", "$testResultsDirectory/$base-$expectedTag.txt");
1481 system "diff -u \"$testResultsDirectory/$base-$expectedTag.txt\" \"$testResultsDirectory/$base-$actualTag.txt\" > \"$testResultsDirectory/$base-$diffsTag.txt\"";
1484 sub buildPlatformHierarchy()
1486 mkpath($platformTestDirectory) if ($platform eq "undefined" && !-d "$platformTestDirectory");
1488 my @platforms = split('-', $platform);
1490 for (my $i=0; $i < @platforms; $i++) {
1491 my $scoped = catdir($platformBaseDirectory, join('-', @platforms[0..($#platforms - $i)]));
1492 push(@hierarchy, $scoped) if (-d $scoped);