[Mac] Make run-api-tests work with System Integrity Protection
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Oct 2015 17:16:40 +0000 (17:16 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Oct 2015 17:16:40 +0000 (17:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=149711
rdar://problem/22928202

Reviewed by Dan Bernstein.

* Scripts/run-api-tests:
(runTest):
(archCommandLineArgumentsForRestrictedEnvironmentVariables):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190412 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/run-api-tests

index db9f107..a342606 100644 (file)
@@ -1,3 +1,15 @@
+2015-10-01  Alexey Proskuryakov  <ap@apple.com>
+
+        [Mac] Make run-api-tests work with System Integrity Protection
+        https://bugs.webkit.org/show_bug.cgi?id=149711
+        rdar://problem/22928202
+
+        Reviewed by Dan Bernstein.
+
+        * Scripts/run-api-tests:
+        (runTest):
+        (archCommandLineArgumentsForRestrictedEnvironmentVariables):
+
 2015-10-01  Daniel Bates  <dabates@apple.com>
 
         Attempt to fix the Windows build after <https://trac.webkit.org/changeset/190387>
index c6f8f00..1a8bf92 100755 (executable)
@@ -40,6 +40,7 @@ sub listAllTests();
 sub runTest($$);
 sub runTestsBySuite(\@);
 sub prepareEnvironmentForRunningTestTool();
+sub archCommandLineArgumentsForRestrictedEnvironmentVariables();
 sub testToolPaths();
 
 # Defined in VCSUtils.
@@ -196,7 +197,7 @@ sub runTest($$)
         if (isIOSWebKit()) {
             $pid = open3($childIn, $childOut, $childErr, qw(xcrun -sdk iphonesimulator sim --environment=merge), @commonArguments) or die "Failed to run test: $test.";
         } elsif (isAppleMacWebKit() && architecture()) {
-            $pid = open3($childIn, $childOut, $childErr, "arch", "-" . architecture(), @commonArguments) or die "Failed to run test: $test.";
+            $pid = open3($childIn, $childOut, $childErr, "arch", "-" . architecture(), archCommandLineArgumentsForRestrictedEnvironmentVariables(), @commonArguments) or die "Failed to run test: $test.";
         } else {
             $pid = open3($childIn, $childOut, $childErr, @commonArguments) or die "Failed to run test: $test.";
         }
@@ -347,6 +348,17 @@ sub prepareEnvironmentForRunningTestTool()
     setupMacWebKitEnvironment(productDir());
 }
 
+sub archCommandLineArgumentsForRestrictedEnvironmentVariables()
+{
+    my @arguments = ();
+    foreach my $key (keys(%ENV)) {
+        if ($key =~ /^DYLD_/) {
+            push @arguments, "-e", "$key=$ENV{$key}";
+        }
+    }
+    return @arguments;
+}
+
 sub testToolPaths()
 {
     my $path = File::Spec->catfile(productDir(), "TestWebKitAPI");