Changeset 19497 in webkit


Ignore:
Timestamp:
Feb 8, 2007 12:42:21 AM (17 years ago)
Author:
ggaren
Message:

Reviewed by Maciej Stachowiak, Adam Roben.


Added 'nthly' support to run-webkit-tests. It's like 'singly', for an
arbitrary number n.


Plus some renames:

  • DumpRenderTree => "dumpTool" (to match abstraction elsewhere)
  • checkLeaks => "shouldCheckLeaks" (to match style guidelines)
  • tool => dumpTool (to match abstraction elsewhere)
  • httpdOpen => isHttpdOpen (to match style guidelines)


Plus a few logic fixups:

  • Don't check isDumpToolOpen when we know we've called openDumpTool().
  • Use a single code path to decide when to shut down dumpTool and when to check for leaks, since the operations are coincidental.
  • Use a single code path for running the leaks tool, since the only thing that varies between configurations is the output file name.
  • Increment $count after each test finishes, instead of at the end of the loop, to help with comparing to the length of the array and %-ing by n.
  • Use a more robust test inside the loop to determine if we need to close dumpTool, instead of copying the closing code outside the loop.


Layout tests pass.

  • Scripts/run-webkit-tests:
Location:
trunk/WebKitTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r19462 r19497  
     12007-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
    1302007-02-06  Geoffrey Garen  <ggaren@apple.com>
    231
  • trunk/WebKitTools/Scripts/run-webkit-tests

    r19462 r19497  
    6262use POSIX;
    6363
    64 sub closeDumpRenderTree();
     64sub openDumpTool();
     65sub closeDumpTool();
    6566sub closeHTTPD();
    6667sub countAndPrintLeaks($$$);
    6768sub fileNameWithNumber($$);
    6869sub numericcmp($$);
    69 sub openDumpRenderTreeIfNeeded();
    7070sub openHTTPDIfNeeded();
    7171sub pathcmp($$);
     
    7777
    7878# Argument handling
    79 my $checkLeaks = '';
     79my $shouldCheckLeaks = '';
    8080my $guardMalloc = '';
    8181my $httpdPort = 8000;
     
    8989my $resetResults = 0;
    9090my $showHelp = 0;
    91 my $singly = 0;
     91my $testsPerDumpTool = 1000;
    9292my $testHTTP = 1;
    9393my $testOnlySVGs = '';
     
    140140    'ignore-tests|i=s' => \$ignoreTests,
    141141    'launch-safari!' => \$launchSafari,
    142     'leaks|l' => \$checkLeaks,
     142    'leaks|l' => \$shouldCheckLeaks,
    143143    'pixel-tests|p' => \$pixelTests,
    144144    'port=i' => \$httpdPort,
     
    148148    'new-test-results!' => \$generateNewResults,
    149149    'results-directory|o=s' => \$testResultsDirectory,
    150     'singly|1' => \$singly,
     150    'singly|1' => sub { $testsPerDumpTool = 1; },
     151    'nthly=i' => \$testsPerDumpTool,
    151152    'slowest' => \$report10Slowest,
    152153    'svg' => \$testOnlySVGs,
     
    167168$pixelTests = 1 if $repaintTests;
    168169
    169 $verbose = 1 if $singly;
     170$verbose = 1 if $testsPerDumpTool == 1;
     171
     172if ($shouldCheckLeaks && $testsPerDumpTool > 1000) {
     173    die "Running more than 1000 tests at a time with MallocStackLogging enabled may cause a crash.\n";
     174}
    170175
    171176# Force --no-http for Qt/Linux, for now.
     
    181186
    182187my $dumpToolName = "DumpRenderTree";
    183 my $tool = "$productDir/$dumpToolName";
    184 die "can't find executable $dumpToolName (looked in $productDir)\n" if !-x $tool;
     188my $dumpTool = "$productDir/$dumpToolName";
     189die "can't find executable $dumpToolName (looked in $productDir)\n" unless -x $dumpTool;
    185190
    186191my $imageDiffTool = "$productDir/ImageDiff";
     
    299304my %durations;
    300305my $count = 0;
    301 my $maxTestsPerLeaksRun = 1000; # more than 3000 and malloc logging will normally run out of memory
    302306my $leaksOutputFileNumber = 1;
    303307my $totalLeaks = 0;
     
    316320if ($pixelTests) {
    317321    local %ENV;
    318     $ENV{MallocStackLogging} = 1 if $checkLeaks;
     322    $ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
    319323    $imageDiffToolPID = open2(\*DIFFIN, \*DIFFOUT, $imageDiffTool, "") or die "unable to open $imageDiffTool\n";
    320324}
    321325
    322326my $dumpToolPID;
    323 my $toolOpen = 0;
     327my $isDumpToolOpen = 0;
    324328
    325329my $atLineStart = 1;
    326330my $lastDirectory = "";
    327331
    328 my $httpdOpen = 0;
     332my $isHttpdOpen = 0;
    329333
    330334print "Testing ", scalar @tests, " test cases.\n";
     
    334338    next if $test eq 'results.html';
    335339
    336     openDumpRenderTreeIfNeeded();
     340    openDumpTool();
    337341
    338342    my $base = $test;
     
    404408    }
    405409
    406     if ($checkLeaks && $singly) {
     410    if ($shouldCheckLeaks && $testsPerDumpTool == 1) {
    407411        print "        $test -> ";
    408412    }
     
    626630    }
    627631
    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}++;
    646650    push @{$tests{$result}}, $test;
    647651    $testType{$test} = $isText;
     
    649653printf "\n%0.2fs total testing time\n", (time - $overallStartTime) . "";
    650654
     655!$isDumpToolOpen || die "Failed to close $dumpToolName.\n";
     656
    651657closeHTTPD();
    652658
    653 if ($checkLeaks && !$singly && $toolOpen) {
    654     my $leaksFileName = fileNameWithNumber($dumpToolName, $leaksOutputFileNumber);
    655     $totalLeaks += countAndPrintLeaks($dumpToolName, $dumpToolPID, "$testResultsDirectory/$leaksFileName-leaks.txt");
    656     $leaksOutputFileNumber++;
    657 }
    658 
    659659# FIXME: Do we really want to check the image-comparison tool for leaks every time?
    660 if ($checkLeaks && $pixelTests) {
     660if ($shouldCheckLeaks && $pixelTests) {
    661661    $totalLeaks += countAndPrintLeaks("ImageDiff", $imageDiffToolPID, "$testResultsDirectory/ImageDiff-leaks.txt");
    662662}
     
    811811sub countAndPrintLeaks($$$)
    812812{
    813     my ($toolName, $toolPID, $leaksFilePath) = @_;
     813    my ($dumpToolName, $dumpToolPID, $leaksFilePath) = @_;
    814814
    815815    print "\n" unless $atLineStart;
     
    846846                        "--exclude-type '" . (join "' --exclude-type '", @typesToExclude) . "'";
    847847
    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/;
    851851    my ($excluded) = $leaksOutput =~ /(\d+) leaks? excluded/;
    852852
     
    940940}
    941941
    942 sub openDumpRenderTreeIfNeeded()
     942sub openDumpTool()
    943943{
    944     return if $toolOpen;
     944    return if $isDumpToolOpen;
    945945
    946946    # Save some requires variables for the linux environment...
     
    968968    $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
    969969    $ENV{XML_CATALOG_FILES} = ""; # work around missing /etc/catalog <rdar://problem/4292995>
    970     $ENV{MallocStackLogging} = 1 if $checkLeaks;
     970    $ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
    971971    $ENV{DYLD_INSERT_LIBRARIES} = "/usr/lib/libgmalloc.dylib" if $guardMalloc;
    972972    my @args = ();
    973973    if ($useValgrind) {
    974       push @args, $tool;
     974      push @args, $dumpTool;
    975975    }
    976976    push @args, @toolArgs;
    977977    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 closeDumpRenderTree()
     978      $dumpTool = "valgrind";
     979    }
     980    $dumpToolPID = open2(\*IN, \*OUT, $dumpTool, @args) or die "Failed to start tool: $dumpTool\n";
     981    $isDumpToolOpen = 1;
     982}
     983
     984sub closeDumpTool()
    985985{
    986     return if !$toolOpen;
     986    return if !$isDumpToolOpen;
    987987
    988988    close IN;
    989989    close OUT;
    990990    waitpid $dumpToolPID, 0;
    991     $toolOpen = 0;
     991    $isDumpToolOpen = 0;
    992992}
    993993
    994994sub openHTTPDIfNeeded()
    995995{
    996     return if $httpdOpen;
     996    return if $isHttpdOpen;
    997997
    998998    mkdir "/tmp/WebKit";
     
    10431043    die "Timed out waiting for httpd to start" unless $retryCount;
    10441044   
    1045     $httpdOpen = 1;
     1045    $isHttpdOpen = 1;
    10461046}
    10471047
    10481048sub closeHTTPD()
    10491049{
    1050     return if !$httpdOpen;
     1050    return if !$isHttpdOpen;
    10511051
    10521052    close HTTPDIN;
     
    10551055    kill 15, `cat /tmp/WebKit/httpd.pid` if -f "/tmp/WebKit/httpd.pid";
    10561056
    1057     $httpdOpen = 0;
     1057    $isHttpdOpen = 0;
    10581058}
    10591059
Note: See TracChangeset for help on using the changeset viewer.