Title: [90408] trunk/Tools
Revision
90408
Author
[email protected]
Date
2011-07-05 15:20:43 -0700 (Tue, 05 Jul 2011)

Log Message

Clean up run-api-tests output on Windows

We were mixing run-api-tests output with gtest output, and the result was a mess.

Fixes <http://webkit.org/b/63954> run-api-tests output is very confusing on Windows

Reviewed by Dan Bates.

* Scripts/run-api-tests:
(runTest):
(populateTests):
Made Windows use the formerly-Mac-only codepaths which correctly suppress gtest output
except in verbose mode. Most changes are due to indentation. Use of the arch utility is now
the only Mac-specific thing in these functions. Some other platform-specific code was moved
from here...

(prepareEnvironmentForRunningTestTool):
(testToolPath):
...to here.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (90407 => 90408)


--- trunk/Tools/ChangeLog	2011-07-05 22:13:41 UTC (rev 90407)
+++ trunk/Tools/ChangeLog	2011-07-05 22:20:43 UTC (rev 90408)
@@ -1,3 +1,25 @@
+2011-07-05  Adam Roben  <[email protected]>
+
+        Clean up run-api-tests output on Windows
+
+        We were mixing run-api-tests output with gtest output, and the result was a mess.
+
+        Fixes <http://webkit.org/b/63954> run-api-tests output is very confusing on Windows
+
+        Reviewed by Dan Bates.
+
+        * Scripts/run-api-tests:
+        (runTest):
+        (populateTests):
+        Made Windows use the formerly-Mac-only codepaths which correctly suppress gtest output
+        except in verbose mode. Most changes are due to indentation. Use of the arch utility is now
+        the only Mac-specific thing in these functions. Some other platform-specific code was moved
+        from here...
+
+        (prepareEnvironmentForRunningTestTool):
+        (testToolPath):
+        ...to here.
+
 2011-07-04  Gavin Barraclough  <[email protected]>
 
         Reviewed by Sam Weinig.

Modified: trunk/Tools/Scripts/run-api-tests (90407 => 90408)


--- trunk/Tools/Scripts/run-api-tests	2011-07-05 22:13:41 UTC (rev 90407)
+++ trunk/Tools/Scripts/run-api-tests	2011-07-05 22:20:43 UTC (rev 90408)
@@ -44,6 +44,8 @@
 sub runAllTests();
 sub runAllTestsInSuite($);
 sub runTest($$);
+sub prepareEnvironmentForRunningTestTool();
+sub testToolPath();
 
 # Timeout for individual test, in sec
 my $timeout = 10;
@@ -139,69 +141,46 @@
 
     my $result = 0;
     my $timedOut = 0;
-    if (isAppleMacWebKit()) {
-        my $productDir = productDir();
-        $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
-        $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
-        my $apiTesterPath = "$productDir/TestWebKitAPI";
 
-        local *DEVNULL;
-        my ($childIn, $childOut, $childErr);
-        if ($verbose) {
-            $childOut = ">&STDOUT";
-            $childErr = ">&STDERR";
-        } else {
-            open(DEVNULL, ">", File::Spec->devnull()) or die "Failed to open /dev/null";
-            $childOut = ">&DEVNULL";
-            $childErr = ">&DEVNULL";
-        }
+    die "run-api-tests is not supported on this platform.\n" unless isAppleMacWebKit() || isAppleWinWebKit();
 
-        my $pid;
-        if (architecture()) {
-            $pid = open3($childIn, $childOut, $childErr, "arch", "-" . architecture(), $apiTesterPath, $gtestArg, @ARGV) or die "Failed to run test: $test.";
-        } else {
-            $pid = open3($childIn, $childOut, $childErr, $apiTesterPath, $gtestArg, @ARGV) or die "Failed to run test: $test.";
-        }
+    prepareEnvironmentForRunningTestTool();
 
-        close($childIn);
-        close($childOut);
-        close($childErr);
-        close(DEVNULL) unless ($verbose);
-        eval {
-            local $SIG{ALRM} = sub { die "alarm\n" };
-            alarm $timeout;
-            waitpid($pid, 0);
-            alarm 0;
-            $result = $?;
-        };
-        if ($@) {
-            die unless $@ eq "alarm\n";
-            kill SIGTERM, $pid or kill SIGKILL, $pid;
-            $timedOut = 1;
-        };
+    local *DEVNULL;
+    my ($childIn, $childOut, $childErr);
+    if ($verbose) {
+        $childOut = ">&STDERR";
+        $childErr = ">&STDERR";
+    } else {
+        open(DEVNULL, ">", File::Spec->devnull()) or die "Failed to open /dev/null";
+        $childOut = ">&DEVNULL";
+        $childErr = ">&DEVNULL";
+    }
 
-     } elsif (isAppleWinWebKit()) {
-        my $apiTesterNameSuffix;
-        if (configurationForVisualStudio() ne "Debug_All") {
-            $apiTesterNameSuffix = "";
-        } else {
-            $apiTesterNameSuffix = "_debug";
-        }
-        my $apiTesterPath = File::Spec->catfile(productDir(), "TestWebKitAPI$apiTesterNameSuffix.exe");
-        eval {
-            local $SIG{ALRM} = sub { die "alarm\n" };
-            alarm $timeout;
-            $result = system { $apiTesterPath } $apiTesterPath, $gtestArg, @ARGV;
-            alarm 0;
-        };
-        if ($@) {
-            die unless $@ eq "alarm\n";
-            $timedOut = 1;
-        };
+    my $pid;
+    if (isAppleMacWebKit() && architecture()) {
+        $pid = open3($childIn, $childOut, $childErr, "arch", "-" . architecture(), testToolPath(), $gtestArg, @ARGV) or die "Failed to run test: $test.";
     } else {
-        die "run-api-tests is not supported on this platform.\n"
+        $pid = open3($childIn, $childOut, $childErr, testToolPath(), $gtestArg, @ARGV) or die "Failed to run test: $test.";
     }
 
+    close($childIn);
+    close($childOut);
+    close($childErr);
+    close(DEVNULL) unless ($verbose);
+    eval {
+        local $SIG{ALRM} = sub { die "alarm\n" };
+        alarm $timeout;
+        waitpid($pid, 0);
+        alarm 0;
+        $result = $?;
+    };
+    if ($@) {
+        die unless $@ eq "alarm\n";
+        kill SIGTERM, $pid or kill SIGKILL, $pid;
+        $timedOut = 1;
+    }
+
     if ($timedOut) {
         print BOLD YELLOW, "Timeout", RESET, "\n";
     } elsif (!$result) {
@@ -217,54 +196,38 @@
     my @tests;
     my $timedOut;
 
-    if (isAppleMacWebKit()) {
-        my $productDir = productDir();
-        $ENV{DYLD_FRAMEWORK_PATH} = $productDir;
-        $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
-        my $apiTesterPath = "$productDir/TestWebKitAPI";
+    die "run-api-tests is not supported on this platform.\n" unless isAppleMacWebKit() || isAppleWinWebKit();
 
-        local *DEVNULL;
-        my ($childIn, $childOut, $childErr);
-        if ($verbose) {
-            $childErr = ">&STDERR";
-        } else {
-            open(DEVNULL, ">", File::Spec->devnull()) or die "Failed to open /dev/null";
-            $childErr = ">&DEVNULL";
-        }
+    prepareEnvironmentForRunningTestTool();
 
-        my $pid;
-        if (architecture()) {
-            $pid = open3($childIn, $childOut, $childErr, "arch", "-" . architecture(), $apiTesterPath, "--gtest_list_tests") or die "Failed to build list of tests!";
-        } else {
-            $pid = open3($childIn, $childOut, $childErr, $apiTesterPath, "--gtest_list_tests") or die "Failed to build list of tests!";
-        }
+    local *DEVNULL;
+    my ($childIn, $childOut, $childErr);
+    if ($verbose) {
+        $childErr = ">&STDERR";
+    } else {
+        open(DEVNULL, ">", File::Spec->devnull()) or die "Failed to open /dev/null";
+        $childErr = ">&DEVNULL";
+    }
 
-        close($childIn);
-        @tests = <$childOut>;
-        close($childOut);
-        close($childErr);
-        close(DEVNULL) unless ($verbose);
+    my $pid;
+    if (isAppleMacWebKit() && architecture()) {
+        $pid = open3($childIn, $childOut, $childErr, "arch", "-" . architecture(), testToolPath(), "--gtest_list_tests") or die "Failed to build list of tests!";
+    } else {
+        $pid = open3($childIn, $childOut, $childErr, testToolPath(), "--gtest_list_tests") or die "Failed to build list of tests!";
+    }
 
-        waitpid($pid, 0);
-        my $result = $?;
+    close($childIn);
+    @tests = <$childOut>;
+    close($childOut);
+    close($childErr);
+    close(DEVNULL) unless ($verbose);
 
-        if ($result) {
-            print STDERR "Failed to build list of tests!\n";
-            exit exitStatus($result);
-        }
-    } elsif (isAppleWinWebKit()) {
-        my $apiTesterNameSuffix;
-        if (configurationForVisualStudio() ne "Debug_All") {
-            $apiTesterNameSuffix = "";
-        } else {
-            $apiTesterNameSuffix = "_debug";
-        }
-        my $apiTesterPath = File::Spec->catfile(productDir(), "TestWebKitAPI$apiTesterNameSuffix.exe");
-        open(TESTS, "-|", $apiTesterPath, "--dump-tests") or die $!;
-        @tests = <TESTS>;
-        close(TESTS) or die $!;
-    } else {
-        die "run-api-tests is not supported on this platform.\n"
+    waitpid($pid, 0);
+    my $result = $?;
+
+    if ($result) {
+        print STDERR "Failed to build list of tests!\n";
+        exit exitStatus($result);
     }
 
     my %keyedTests = ();
@@ -323,3 +286,25 @@
 
     chdir $originalCwd;
 }
+
+sub prepareEnvironmentForRunningTestTool()
+{
+    return unless isAppleMacWebKit();
+
+    $ENV{DYLD_FRAMEWORK_PATH} = productDir();
+    $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES";
+}
+
+sub testToolPath()
+{
+    my $path = File::Spec->catfile(productDir(), "TestWebKitAPI");
+    return $path unless isAppleWinWebKit();
+
+    my $suffix;
+    if (configurationForVisualStudio() eq "Debug_All") {
+        $suffix = "_debug";
+    } else {
+        $suffix = "";
+    }
+    return "$path$suffix.exe";
+}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to