Changeset 19497 in webkit
- Timestamp:
- Feb 8, 2007 12:42:21 AM (17 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r19462 r19497 1 2007-02-08 Geoffrey Garen <ggaren@apple.com> 2 3 Reviewed by Maciej Stachowiak, Adam Roben. 4 5 Added 'nthly' support to run-webkit-tests. It's like 'singly', for an 6 arbitrary number n. 7 8 Plus some renames: 9 - DumpRenderTree => "dumpTool" (to match abstraction elsewhere) 10 - checkLeaks => "shouldCheckLeaks" (to match style guidelines) 11 - tool => dumpTool (to match abstraction elsewhere) 12 - httpdOpen => isHttpdOpen (to match style guidelines) 13 14 Plus a few logic fixups: 15 - Don't check isDumpToolOpen when we know we've called openDumpTool(). 16 - Use a single code path to decide when to shut down dumpTool and 17 when to check for leaks, since the operations are coincidental. 18 - Use a single code path for running the leaks tool, since the only 19 thing that varies between configurations is the output file name. 20 - Increment $count after each test finishes, instead of at the end 21 of the loop, to help with comparing to the length of the array 22 and %-ing by n. 23 - Use a more robust test inside the loop to determine if we need to 24 close dumpTool, instead of copying the closing code outside the loop. 25 26 Layout tests pass. 27 28 * Scripts/run-webkit-tests: 29 1 30 2007-02-06 Geoffrey Garen <ggaren@apple.com> 2 31 -
trunk/WebKitTools/Scripts/run-webkit-tests
r19462 r19497 62 62 use POSIX; 63 63 64 sub closeDumpRenderTree(); 64 sub openDumpTool(); 65 sub closeDumpTool(); 65 66 sub closeHTTPD(); 66 67 sub countAndPrintLeaks($$$); 67 68 sub fileNameWithNumber($$); 68 69 sub numericcmp($$); 69 sub openDumpRenderTreeIfNeeded();70 70 sub openHTTPDIfNeeded(); 71 71 sub pathcmp($$); … … 77 77 78 78 # Argument handling 79 my $ checkLeaks = '';79 my $shouldCheckLeaks = ''; 80 80 my $guardMalloc = ''; 81 81 my $httpdPort = 8000; … … 89 89 my $resetResults = 0; 90 90 my $showHelp = 0; 91 my $ singly =0;91 my $testsPerDumpTool = 1000; 92 92 my $testHTTP = 1; 93 93 my $testOnlySVGs = ''; … … 140 140 'ignore-tests|i=s' => \$ignoreTests, 141 141 'launch-safari!' => \$launchSafari, 142 'leaks|l' => \$ checkLeaks,142 'leaks|l' => \$shouldCheckLeaks, 143 143 'pixel-tests|p' => \$pixelTests, 144 144 'port=i' => \$httpdPort, … … 148 148 'new-test-results!' => \$generateNewResults, 149 149 'results-directory|o=s' => \$testResultsDirectory, 150 'singly|1' => \$singly, 150 'singly|1' => sub { $testsPerDumpTool = 1; }, 151 'nthly=i' => \$testsPerDumpTool, 151 152 'slowest' => \$report10Slowest, 152 153 'svg' => \$testOnlySVGs, … … 167 168 $pixelTests = 1 if $repaintTests; 168 169 169 $verbose = 1 if $singly; 170 $verbose = 1 if $testsPerDumpTool == 1; 171 172 if ($shouldCheckLeaks && $testsPerDumpTool > 1000) { 173 die "Running more than 1000 tests at a time with MallocStackLogging enabled may cause a crash.\n"; 174 } 170 175 171 176 # Force --no-http for Qt/Linux, for now. … … 181 186 182 187 my $dumpToolName = "DumpRenderTree"; 183 my $ tool = "$productDir/$dumpToolName";184 die "can't find executable $dumpToolName (looked in $productDir)\n" if !-x $tool;188 my $dumpTool = "$productDir/$dumpToolName"; 189 die "can't find executable $dumpToolName (looked in $productDir)\n" unless -x $dumpTool; 185 190 186 191 my $imageDiffTool = "$productDir/ImageDiff"; … … 299 304 my %durations; 300 305 my $count = 0; 301 my $maxTestsPerLeaksRun = 1000; # more than 3000 and malloc logging will normally run out of memory302 306 my $leaksOutputFileNumber = 1; 303 307 my $totalLeaks = 0; … … 316 320 if ($pixelTests) { 317 321 local %ENV; 318 $ENV{MallocStackLogging} = 1 if $ checkLeaks;322 $ENV{MallocStackLogging} = 1 if $shouldCheckLeaks; 319 323 $imageDiffToolPID = open2(\*DIFFIN, \*DIFFOUT, $imageDiffTool, "") or die "unable to open $imageDiffTool\n"; 320 324 } 321 325 322 326 my $dumpToolPID; 323 my $ toolOpen = 0;327 my $isDumpToolOpen = 0; 324 328 325 329 my $atLineStart = 1; 326 330 my $lastDirectory = ""; 327 331 328 my $ httpdOpen = 0;332 my $isHttpdOpen = 0; 329 333 330 334 print "Testing ", scalar @tests, " test cases.\n"; … … 334 338 next if $test eq 'results.html'; 335 339 336 openDump RenderTreeIfNeeded();340 openDumpTool(); 337 341 338 342 my $base = $test; … … 404 408 } 405 409 406 if ($ checkLeaks && $singly) {410 if ($shouldCheckLeaks && $testsPerDumpTool == 1) { 407 411 print " $test -> "; 408 412 } … … 626 630 } 627 631 628 if ($checkLeaks && $toolOpen) {629 if ($singly) {630 $totalLeaks += countAndPrintLeaks($dumpToolName, $dumpToolPID, "$testResultsDirectory/$base-leaks.txt");631 } elsif ($count && (($count % $maxTestsPerLeaksRun) == 0)) {632 my $leaksFileName = fileNameWithNumber($dumpToolName, $leaksOutputFileNumber);633 my $leaksCount = countAndPrintLeaks($dumpToolName, $dumpToolPID, "$testResultsDirectory/$leaksFileName-leaks.txt");634 $leaksOutputFileNumber++ if ($leaksCount);635 $totalLeaks += $leaksCount;636 closeDumpRenderTree();637 }638 }639 640 if ($singly && $toolOpen) {641 closeDumpRenderTree(); 642 }643 644 $count += 1; 645 $counts{$result} += 1;632 $count++; 633 if ($count % $testsPerDumpTool == 0 || $count == @tests) { 634 if ($shouldCheckLeaks) { 635 my $fileName; 636 if ($testsPerDumpTool == 1) { 637 $fileName = "$testResultsDirectory/$base-leaks.txt"; 638 } else { 639 $fileName = "$testResultsDirectory/" . fileNameWithNumber($dumpToolName, $leaksOutputFileNumber) . "-leaks.txt"; 640 } 641 my $leakCount = countAndPrintLeaks($dumpToolName, $dumpToolPID, $fileName); 642 $totalLeaks += $leakCount; 643 $leaksOutputFileNumber++ if ($leakCount); 644 } 645 646 closeDumpTool(); 647 } 648 649 $counts{$result}++; 646 650 push @{$tests{$result}}, $test; 647 651 $testType{$test} = $isText; … … 649 653 printf "\n%0.2fs total testing time\n", (time - $overallStartTime) . ""; 650 654 655 !$isDumpToolOpen || die "Failed to close $dumpToolName.\n"; 656 651 657 closeHTTPD(); 652 658 653 if ($checkLeaks && !$singly && $toolOpen) {654 my $leaksFileName = fileNameWithNumber($dumpToolName, $leaksOutputFileNumber);655 $totalLeaks += countAndPrintLeaks($dumpToolName, $dumpToolPID, "$testResultsDirectory/$leaksFileName-leaks.txt");656 $leaksOutputFileNumber++;657 }658 659 659 # FIXME: Do we really want to check the image-comparison tool for leaks every time? 660 if ($ checkLeaks && $pixelTests) {660 if ($shouldCheckLeaks && $pixelTests) { 661 661 $totalLeaks += countAndPrintLeaks("ImageDiff", $imageDiffToolPID, "$testResultsDirectory/ImageDiff-leaks.txt"); 662 662 } … … 811 811 sub countAndPrintLeaks($$$) 812 812 { 813 my ($ toolName, $toolPID, $leaksFilePath) = @_;813 my ($dumpToolName, $dumpToolPID, $leaksFilePath) = @_; 814 814 815 815 print "\n" unless $atLineStart; … … 846 846 "--exclude-type '" . (join "' --exclude-type '", @typesToExclude) . "'"; 847 847 848 print " ? checking for leaks in $ toolName\n";849 my $leaksOutput = `$leaksTool $excludeString $ toolPID`;850 my ($count, $bytes) = $leaksOutput =~ /Process $ toolPID: (\d+) leaks? for (\d+) total/;848 print " ? checking for leaks in $dumpToolName\n"; 849 my $leaksOutput = `$leaksTool $excludeString $dumpToolPID`; 850 my ($count, $bytes) = $leaksOutput =~ /Process $dumpToolPID: (\d+) leaks? for (\d+) total/; 851 851 my ($excluded) = $leaksOutput =~ /(\d+) leaks? excluded/; 852 852 … … 940 940 } 941 941 942 sub openDump RenderTreeIfNeeded()942 sub openDumpTool() 943 943 { 944 return if $ toolOpen;944 return if $isDumpToolOpen; 945 945 946 946 # Save some requires variables for the linux environment... … … 968 968 $ENV{DYLD_FRAMEWORK_PATH} = $productDir; 969 969 $ENV{XML_CATALOG_FILES} = ""; # work around missing /etc/catalog <rdar://problem/4292995> 970 $ENV{MallocStackLogging} = 1 if $ checkLeaks;970 $ENV{MallocStackLogging} = 1 if $shouldCheckLeaks; 971 971 $ENV{DYLD_INSERT_LIBRARIES} = "/usr/lib/libgmalloc.dylib" if $guardMalloc; 972 972 my @args = (); 973 973 if ($useValgrind) { 974 push @args, $ tool;974 push @args, $dumpTool; 975 975 } 976 976 push @args, @toolArgs; 977 977 if ($useValgrind) { 978 $ tool = "valgrind";979 } 980 $dumpToolPID = open2(\*IN, \*OUT, $ tool, @args) or die "Failed to start tool: $tool\n";981 $ toolOpen = 1;982 } 983 984 sub closeDump RenderTree()978 $dumpTool = "valgrind"; 979 } 980 $dumpToolPID = open2(\*IN, \*OUT, $dumpTool, @args) or die "Failed to start tool: $dumpTool\n"; 981 $isDumpToolOpen = 1; 982 } 983 984 sub closeDumpTool() 985 985 { 986 return if !$ toolOpen;986 return if !$isDumpToolOpen; 987 987 988 988 close IN; 989 989 close OUT; 990 990 waitpid $dumpToolPID, 0; 991 $ toolOpen = 0;991 $isDumpToolOpen = 0; 992 992 } 993 993 994 994 sub openHTTPDIfNeeded() 995 995 { 996 return if $ httpdOpen;996 return if $isHttpdOpen; 997 997 998 998 mkdir "/tmp/WebKit"; … … 1043 1043 die "Timed out waiting for httpd to start" unless $retryCount; 1044 1044 1045 $ httpdOpen = 1;1045 $isHttpdOpen = 1; 1046 1046 } 1047 1047 1048 1048 sub closeHTTPD() 1049 1049 { 1050 return if !$ httpdOpen;1050 return if !$isHttpdOpen; 1051 1051 1052 1052 close HTTPDIN; … … 1055 1055 kill 15, `cat /tmp/WebKit/httpd.pid` if -f "/tmp/WebKit/httpd.pid"; 1056 1056 1057 $ httpdOpen = 0;1057 $isHttpdOpen = 0; 1058 1058 } 1059 1059
Note: See TracChangeset
for help on using the changeset viewer.