Title: [179120] trunk/Tools
Revision
179120
Author
o...@webkit.org
Date
2015-01-26 10:02:16 -0800 (Mon, 26 Jan 2015)

Log Message

Refactor run-_javascript_core-tests
https://bugs.webkit.org/show_bug.cgi?id=140824

Reviewed by Darin Adler.

Separated mozilla, stress test code paths and
determining skipped mozilla tests into subroutines.

* Scripts/run-_javascript_core-tests:
(runMozillaTests):
(runJSCStressTests):
(defaultJsDriverArgsForMozillaTests):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (179119 => 179120)


--- trunk/Tools/ChangeLog	2015-01-26 17:52:35 UTC (rev 179119)
+++ trunk/Tools/ChangeLog	2015-01-26 18:02:16 UTC (rev 179120)
@@ -1,5 +1,20 @@
 2015-01-26  Csaba Osztrogonác  <o...@webkit.org>
 
+        Refactor run-_javascript_core-tests
+        https://bugs.webkit.org/show_bug.cgi?id=140824
+
+        Reviewed by Darin Adler.
+
+        Separated mozilla, stress test code paths and
+        determining skipped mozilla tests into subroutines.
+
+        * Scripts/run-_javascript_core-tests:
+        (runMozillaTests):
+        (runJSCStressTests):
+        (defaultJsDriverArgsForMozillaTests):
+
+2015-01-26  Csaba Osztrogonác  <o...@webkit.org>
+
         [buildbot] Fix grammar of TestWithFailureCount
         https://bugs.webkit.org/show_bug.cgi?id=140884
 

Modified: trunk/Tools/Scripts/run-_javascript_core-tests (179119 => 179120)


--- trunk/Tools/Scripts/run-_javascript_core-tests	2015-01-26 17:52:35 UTC (rev 179119)
+++ trunk/Tools/Scripts/run-_javascript_core-tests	2015-01-26 18:02:16 UTC (rev 179120)
@@ -42,86 +42,47 @@
 setConfiguration();
 my $configuration = configuration();
 
-my @testsToSkipOnWindows = (
-    # Various ecma/Date tests sometimes fail on Windows (but not Mac) https://bugs.webkit.org/show_bug.cgi?id=25160
-    "ecma/Date/15.9.2.1.js",
-    "ecma/Date/15.9.2.2-1.js",
-    "ecma/Date/15.9.2.2-2.js",
-    "ecma/Date/15.9.2.2-3.js",
-    "ecma/Date/15.9.2.2-4.js",
-    "ecma/Date/15.9.2.2-5.js",
-    "ecma/Date/15.9.2.2-6.js",
-    "ecma/Date/15.9.5.31-1.js",
-    "ecma_3/Date/15.9.5.7.js",
-    "ecma/Date/15.9.3.1-1.js",
-    "ecma/Date/15.9.3.1-2.js",
-    "ecma/Date/15.9.3.1-3.js",
-    "ecma/Date/15.9.3.1-4.js",
-    "ecma/Date/15.9.3.1-5.js",
-    "ecma/Date/15.9.3.2-1.js",
-    "ecma/Date/15.9.3.2-2.js",
-    "ecma/Date/15.9.3.2-3.js",
-    "ecma/Date/15.9.3.2-4.js",
-    "ecma/Date/15.9.3.2-5.js",
-    "ecma/Date/15.9.4.2-1.js",
-    "ecma/Date/15.9.5.26-1.js",
-    "ecma/Date/15.9.5.27-1.js",
-    "ecma/Date/15.9.5.28-1.js",
-    "ecma/Date/15.9.5.30-1.js",
-);
-
-my @testsToSkipOnNonWindows = (
-    # ecma_3/Date/15.9.5.7.js fails on Mac (but not Windows) https://bugs.webkit.org/show_bug.cgi?id=25161
-    "ecma_3/Date/15.9.5.7.js",
-
-);
-
-my @testsToSkip = (
-    # function.arguments have been disabled
-    "js1_4/Functions/function-001.js",
-);
-
-@testsToSkip = (@testsToSkip, @testsToSkipOnWindows) if isAppleWinWebKit();
-@testsToSkip = (@testsToSkip, @testsToSkipOnNonWindows) if !isAppleWinWebKit();
-my $jsDriverArgs = "-L " . join(" ", @testsToSkip) if @testsToSkip;
-
 # These variables are intentionally left undefined.
 my $root;
 my $showHelp;
 my $extraTests;
+my $jsDriverArgs;
 
 my $buildJSC = 1;
 
 my $runTestAPI = isAppleMacWebKit() || isAppleWinWebKit() || isWinCairo();
 
-my $runMozilla = 0;
-
 # FIXME: run-jsc-stress-tests should be ported to other platforms.
 # https://bugs.webkit.org/show_bug.cgi?id=120809
 my $runJSCStress = !isAppleWinWebKit();
 
 my $enableFTL = isAppleWebKit();
-
 my $createTarball = 0;
 my $remoteHost = 0;
 
 my $programName = basename($0);
 my $buildJSCDefault = $buildJSC ? "will check" : "will not check";
 my $testapiDefault = $runTestAPI ? "will run" : "will not run";
-my $mozillaDefault = $runMozilla ? "will run" : "will not run";
 my $jscStressDefault = $runJSCStress ? "will run" : " will not run";
 my $usage = <<EOF;
 Usage: $programName [options] [options to pass to build system]
   --help                        Show this help message
-  --jsDriver-args=              A string of arguments to pass to jsDriver.pl
   --root=                       Path to pre-built root containing jsc
-  --extra-tests=                Path to a file containing extra tests
   --[no-]ftl-jit                Turn the FTL JIT on or off
   --[no-]build                  Check (or don't check) to see if the jsc build is up-to-date (default: $buildJSCDefault)
   --[no-]testapi                Run (or don't run) testapi (default: $testapiDefault)
   --[no-]jsc-stress             Run (or don't run) the JSC stress tests (default: $jscStressDefault)
+
+  Mozilla tests only options (--no-jsc-stress):
+  ----------------------------------------------
+  --jsDriver-args=              A string of arguments to pass to jsDriver.pl
+
+  JSC stress tests only options (--jsc-stress):
+  ----------------------------------------------
   --tarball                     Create a tarball of the bundle produced by running the JSC stress tests.
   --remote=                     Run the JSC stress tests on the specified remote host. Implies --tarball.
+  --extra-tests=                Path to a file containing extra tests
+
 EOF
 
 GetOptions(
@@ -145,9 +106,6 @@
     push(@buildArgs, '--ftl-jit');
 }
 
-# Arguments passed to --jsDriver-args (if any) are passed to jsDriver.pl
-my @jsArgs = split(" ", $jsDriverArgs);
-
 if ($showHelp) {
    print STDERR $usage;
    exit 1;
@@ -159,7 +117,7 @@
     chdirWebKit();
 
     push(@buildArgs, argumentsForConfiguration());
-    
+
     print "Running: build-jsc " . join(" ", @buildArgs) . "\n";
     my $buildResult = system "perl", "Tools/Scripts/build-jsc", @buildArgs;
     if ($buildResult) {
@@ -201,25 +159,36 @@
 # Find _javascript_Core directory
 chdirWebKit();
 
-$runMozilla = !$runJSCStress;
+if ($runJSCStress) {
+    runJSCStressTests();
+} else {
+    runMozillaTests();
+}
 
-my %mozillaFailures;
-my %newMozillaFailures;
-
-if ($runMozilla) {
+sub runMozillaTests
+{
+    my %mozillaFailures;
+    my %newMozillaFailures;
     chdir("Source/_javascript_Core");
     chdir "tests/mozilla" or die "Failed to switch directory to 'tests/mozilla'\n";
+
+    # determine the list of skipped tests for Mozilla tests if --jsDriver-args command line argument isn't set
+    $jsDriverArgs ||= defaultJsDriverArgsForMozillaTests();
+
+    # Arguments passed to --jsDriver-args (if any) are passed to jsDriver.pl
+    my @jsArgs = split(" ", $jsDriverArgs);
+
     my @jsMozillaDriverCmd = ("perl", "jsDriver.pl", "-e", "squirrelfish", "-s", jscPath($productDir), "-f", "actual.html", @jsArgs);
     if (isGtk() || isEfl()) {
         my @jhbuildPrefix = sourceDir() . "/Tools/jhbuild/jhbuild-wrapper";
-    
+
         if (isEfl()) {
             push(@jhbuildPrefix, '--efl');
         } elsif (isGtk()) {
             push(@jhbuildPrefix, '--gtk');
         }
         push(@jhbuildPrefix, 'run');
-    
+
         unshift(@jsMozillaDriverCmd, @jhbuildPrefix);
     } elsif (isIOSWebKit() && willUseIOSSimulatorSDKWhenBuilding()) {
         push @jsMozillaDriverCmd, ("--sdk", xcodeSDK());
@@ -227,7 +196,7 @@
     print "Running: " . join(" ", @jsMozillaDriverCmd) . "\n";
     my $result = system(@jsMozillaDriverCmd);
     exit exitStatus($result)  if $result;
-    
+
     open EXPECTED, "expected.html" or die "Failed to open 'expected.html'\n";
     while (<EXPECTED>) {
         last if /failures reported\.$/;
@@ -237,7 +206,7 @@
         $mozillaFailures{$_} = 1;
     }
     close EXPECTED;
-    
+
     open ACTUAL, "actual.html" or die "Failed to open 'actual.html'";
     while (<ACTUAL>) {
         last if /failures reported\.$/;
@@ -251,12 +220,38 @@
         }
     }
     close ACTUAL;
+
+    my $numNewMozillaFailures = keys %newMozillaFailures;
+    if ($numNewMozillaFailures) {
+        print "\n** The following Mozilla test failures have been introduced:\n";
+        foreach my $mozillaFailure (sort keys %newMozillaFailures) {
+            print "\t$mozillaFailure\n";
+        }
+    }
+
+    my $numOldMozillaFailures = keys %mozillaFailures;
+    if ($numOldMozillaFailures) {
+        print "\nYou fixed the following test";
+        print "s" if $numOldMozillaFailures != 1;
+        print ":\n";
+        foreach my $mozillaFailure (sort keys %mozillaFailures) {
+            print "\t$mozillaFailure\n";
+        }
+    }
+
+    print "\nResults for Mozilla tests:\n";
+    printThingsFound($numNewMozillaFailures, "regression", "regressions", "found");
+    printThingsFound($numOldMozillaFailures, "test", "tests", "fixed");
+    print "    OK.\n" if $numNewMozillaFailures == 0;
+    print "\n";
+
+    exit(1) if $numNewMozillaFailures;
 }
 
-chdirWebKit();
-my $jscStressResultsDir = $productDir . "/jsc-stress-results";
+sub runJSCStressTests
+{
+    my $jscStressResultsDir = $productDir . "/jsc-stress-results";
 
-if ($runJSCStress) {
     # Set LANG environment variable so the stress tests will work with newer ruby (<rdar://problem/15010705>)
     $ENV{LANG}="en_US.UTF-8";
     my @jscStressDriverCmd = (
@@ -296,24 +291,26 @@
     print "Running: " . join(" ", @jscStressDriverCmd) . "\n";
     my $result = system(@jscStressDriverCmd);
     exit exitStatus($result) if $result;
-}
 
-my $numNewMozillaFailures = keys %newMozillaFailures;
-if ($numNewMozillaFailures) {
-    print "\n** The following Mozilla test failures have been introduced:\n";
-    foreach my $mozillaFailure (sort keys %newMozillaFailures) {
-        print "\t$mozillaFailure\n";
+    my @jscStressFailList = readAllLines($jscStressResultsDir . "/failed");
+    @jscStressFailList = sort @jscStressFailList;
+    my $numJSCStressFailures = @jscStressFailList;
+
+    if ($numJSCStressFailures) {
+        print "\n** The following JSC stress test failures have been introduced:\n";
+        foreach my $testFailure (@jscStressFailList) {
+            print "\t$testFailure";
+        }
     }
-}
+    print "\n";
 
-my $numOldMozillaFailures = keys %mozillaFailures;
-if ($numOldMozillaFailures) {
-    print "\nYou fixed the following test";
-    print "s" if $numOldMozillaFailures != 1;
-    print ":\n";
-    foreach my $mozillaFailure (sort keys %mozillaFailures) {
-        print "\t$mozillaFailure\n";
-    }
+    print "Results for JSC stress tests:\n";
+    printThingsFound($numJSCStressFailures, "failure", "failures", "found");
+    print "    OK.\n" if $numJSCStressFailures == 0;
+
+    print "\n";
+
+    exit(1) if $numJSCStressFailures;
 }
 
 sub readAllLines
@@ -342,34 +339,49 @@
     print " $verb.\n";
 }
 
-my @jscStressFailList = readAllLines($jscStressResultsDir . "/failed");
-@jscStressFailList = sort @jscStressFailList;
-my $numJSCStressFailures = @jscStressFailList;
+sub defaultJsDriverArgsForMozillaTests
+{
+    my @testsToSkipOnWindows = (
+        # Various ecma/Date tests sometimes fail on Windows (but not Mac) https://bugs.webkit.org/show_bug.cgi?id=25160
+        "ecma/Date/15.9.2.1.js",
+        "ecma/Date/15.9.2.2-1.js",
+        "ecma/Date/15.9.2.2-2.js",
+        "ecma/Date/15.9.2.2-3.js",
+        "ecma/Date/15.9.2.2-4.js",
+        "ecma/Date/15.9.2.2-5.js",
+        "ecma/Date/15.9.2.2-6.js",
+        "ecma/Date/15.9.5.31-1.js",
+        "ecma_3/Date/15.9.5.7.js",
+        "ecma/Date/15.9.3.1-1.js",
+        "ecma/Date/15.9.3.1-2.js",
+        "ecma/Date/15.9.3.1-3.js",
+        "ecma/Date/15.9.3.1-4.js",
+        "ecma/Date/15.9.3.1-5.js",
+        "ecma/Date/15.9.3.2-1.js",
+        "ecma/Date/15.9.3.2-2.js",
+        "ecma/Date/15.9.3.2-3.js",
+        "ecma/Date/15.9.3.2-4.js",
+        "ecma/Date/15.9.3.2-5.js",
+        "ecma/Date/15.9.4.2-1.js",
+        "ecma/Date/15.9.5.26-1.js",
+        "ecma/Date/15.9.5.27-1.js",
+        "ecma/Date/15.9.5.28-1.js",
+        "ecma/Date/15.9.5.30-1.js",
+    );
 
-if ($numJSCStressFailures) {
-    print "\n** The following JSC stress test failures have been introduced:\n";
-    foreach my $testFailure (@jscStressFailList) {
-        print "\t$testFailure";
-    }
-}
+    my @testsToSkipOnNonWindows = (
+        # ecma_3/Date/15.9.5.7.js fails on Mac (but not Windows) https://bugs.webkit.org/show_bug.cgi?id=25161
+        "ecma_3/Date/15.9.5.7.js",
+    );
 
-print "\n";
+    my @testsToSkip = (
+        # function.arguments have been disabled
+        "js1_4/Functions/function-001.js",
+    );
 
-if ($runMozilla) {
-    print "Results for Mozilla tests:\n";
-    printThingsFound($numNewMozillaFailures, "regression", "regressions", "found");
-    printThingsFound($numOldMozillaFailures, "test", "tests", "fixed");
-    print "    OK.\n" if $numNewMozillaFailures == 0;
-    
-    print "\n";
-}
+    @testsToSkip = (@testsToSkip, @testsToSkipOnWindows) if isAppleWinWebKit();
+    @testsToSkip = (@testsToSkip, @testsToSkipOnNonWindows) if !isAppleWinWebKit();
+    my $jsDriverArgs = "-L " . join(" ", @testsToSkip) if @testsToSkip;
 
-if ($runJSCStress) {
-    print "Results for JSC stress tests:\n";
-    printThingsFound($numJSCStressFailures, "failure", "failures", "found");
-    print "    OK.\n" if $numJSCStressFailures == 0;
-    
-    print "\n";
+    return $jsDriverArgs;
 }
-
-exit(1)  if ($runMozilla && $numNewMozillaFailures) || ($runJSCStress && $numJSCStressFailures);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to