[webkit-changes] cvs commit: WebKitTools/Scripts run-webkit-tests

Darin darin at opensource.apple.com
Thu Dec 15 09:42:20 PST 2005


darin       05/12/15 09:42:19

  Modified:    .        ChangeLog
               Scripts  run-webkit-tests
  Log:
          * Scripts/run-webkit-tests: Don't run tests in directories named "svg" if SVG
          support is not compiled in. Report the 10 slowest tests if "--slowest" is
          passed on the command line.
  
  Revision  Changes    Path
  1.128     +6 -0      WebKitTools/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKitTools/ChangeLog,v
  retrieving revision 1.127
  retrieving revision 1.128
  diff -u -r1.127 -r1.128
  --- ChangeLog	6 Dec 2005 21:54:55 -0000	1.127
  +++ ChangeLog	15 Dec 2005 17:42:19 -0000	1.128
  @@ -1,3 +1,9 @@
  +2005-12-15  Darin Adler  <darin at apple.com>
  +
  +        * Scripts/run-webkit-tests: Don't run tests in directories named "svg" if SVG
  +        support is not compiled in. Report the 10 slowest tests if "--slowest" is
  +        passed on the command line.
  +
   2005-12-06  John Sullivan  <sullivan at apple.com>
   
           Reviewed by Darin Adler.
  
  
  
  1.37      +38 -5     WebKitTools/Scripts/run-webkit-tests
  
  Index: run-webkit-tests
  ===================================================================
  RCS file: /cvs/root/WebKitTools/Scripts/run-webkit-tests,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- run-webkit-tests	6 Dec 2005 07:20:43 -0000	1.36
  +++ run-webkit-tests	15 Dec 2005 17:42:19 -0000	1.37
  @@ -36,6 +36,7 @@
   use Cwd;
   use lib $FindBin::Bin;
   use webkitdirs;
  +use Time::HiRes qw(time);
   
   # Run all the tests passed in on the command line.
   # If no tests are passed, find all the .html, .xml, .xhtml (and svg) files in the test directory.
  @@ -65,6 +66,7 @@
   my $verbose = 0;
   my $quiet = '';
   my $singly = 0;
  +my $report10Slowest = 0;
   
   GetOptions('svg' => \$testSVGs, 
       'pixel-tests|p' => \$pixelTests,
  @@ -74,7 +76,8 @@
       'max-height|h=s' => \$maxHeight, 
       'verbose|v' => \$verbose,
       'quiet|q' => \$quiet,
  -    'singly|1' => \$singly);
  +    'singly|1' => \$singly,
  +    'slowest' => \$report10Slowest);
   
   my $dumpToolName = "DumpRenderTree";
   my $result = system "WebKitTools/Scripts/build-dumprendertree", @ARGV;
  @@ -106,12 +109,17 @@
   
   my @tests = ();
   
  -my $findArguments = "\\( -name resources \\! -prune \\) -or -name '*.html' -or -name '*.xml' -or -name '*.xhtml'";
  +my $prunePart = "\\( -name resources \\! -prune \\)";
  +my $extensionPart = "-name '*.html' -or -name '*.xml' -or -name '*.xhtml'";
   if ($testSVGs) {
  -    $findArguments = "\\( -name resources \\! -prune \\) -or -name '*.svg' -or -name '*.xml'";
  +    $extensionPart = "-name '*.svg' -or -name '*.xml'";
   } elsif ($haveSVGSupport) {
  -	$findArguments .= " -or -name '*.svg'";
  +    $extensionPart .= " -or -name '*.svg'";
  +} else {
  +    $prunePart .= " -or \\( -name svg \\! -prune \\)";
   }
  +my $findArguments = "$prunePart -or $extensionPart";
  +
   my $foundTestName = 0;
   for my $test (@ARGV) {
       next if $test =~ /^-/;
  @@ -140,6 +148,7 @@
   my %counts;
   my %tests;
   my %imagesPresent;
  +my %durations;
   my $count = 0;
   
   my @toolArgs = ();
  @@ -199,6 +208,8 @@
   
       my $result;
   
  +    my $startTime = time;
  +
       print OUT "$testDirectory/$test\n";
   
       my $actual = "";
  @@ -207,6 +218,8 @@
           $actual .= $_;
       }
   
  +    $durations{$test} = time - $startTime;
  +
       my $expected;
       if (open EXPECTED, "<", "$testDirectory/$base-expected.txt") {
           $expected = "";
  @@ -424,6 +437,15 @@
       fail => "failed (tool did not execute successfully)",
   );
   
  +if ($report10Slowest) {
  +    print "\n\nThe 10 slowest tests:\n\n";
  +    my $count = 0;
  +    for my $test (sort slowestcmp keys %durations) {
  +        printf "%0.2f secs: %s\n", $durations{$test}, $test;
  +        last if ++$count == 10;
  +    }
  +}
  +
   print "\n";
   
   if ($counts{match} && $counts{match} == $count) {
  @@ -517,7 +539,7 @@
       print HTML "</html>\n";
       close HTML;
       
  -    system "WebKitTools/Scripts/run-safari", "-NSOpen",$testResults;
  +    system "WebKitTools/Scripts/run-safari", "-NSOpen", $testResults;
   }
   
   sub printLeaks
  @@ -610,3 +632,14 @@
       # One of the two is now empty; compare lengths for result in this case.
       return @a <=> @b;
   }
  +
  +# Sort slowest tests first.
  +sub slowestcmp($$)
  +{
  +    my ($testa, $testb) = @_;
  +
  +    my $dura = $durations{$testa};
  +    my $durb = $durations{$testb};
  +    return $durb <=> $dura if $dura != $durb;
  +    return pathcmp($testa, $testb);
  +}
  
  
  



More information about the webkit-changes mailing list