run-bindings-tests is not Win32-compatible
authorross.kirsling@sony.com <ross.kirsling@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Aug 2018 05:42:42 +0000 (05:42 +0000)
committerross.kirsling@sony.com <ross.kirsling@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Aug 2018 05:42:42 +0000 (05:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188424

Reviewed by Fujii Hironori.

Source/WebCore:

* bindings/scripts/preprocessor.pm:
(applyPreprocessor):
Ensure that we fall back to cl.exe if CC env var is not set on Windows.

Tools:

* Scripts/webkitpy/bindings/main.py:
(BindingsTests.main):
Stop leaking file descriptors.
(See https://www.logilab.org/blogentry/17873 for details, though the solution here is even simpler.)

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

Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/preprocessor.pm
Tools/ChangeLog
Tools/Scripts/webkitpy/bindings/main.py

index ff19a88..1ea5160 100644 (file)
@@ -1,3 +1,14 @@
+2018-08-08  Ross Kirsling  <ross.kirsling@sony.com>
+
+        run-bindings-tests is not Win32-compatible
+        https://bugs.webkit.org/show_bug.cgi?id=188424
+
+        Reviewed by Fujii Hironori.
+
+        * bindings/scripts/preprocessor.pm:
+        (applyPreprocessor):
+        Ensure that we fall back to cl.exe if CC env var is not set on Windows.
+
 2018-08-08  Ryosuke Niwa  <rniwa@webkit.org>
 
         REGRESSION (r228260): Events handled by input method invoke default event handler
index ee65da4..547e956 100644 (file)
@@ -45,17 +45,11 @@ sub applyPreprocessor
 
     my @args = ();
     if (!$preprocessor) {
-        require Config;
-        if ($ENV{CC}) {
-            $preprocessor = $ENV{CC};
-        } elsif (-x "/usr/bin/clang") {
-            $preprocessor = "/usr/bin/clang";
-        } else {
-            $preprocessor = "/usr/bin/gcc";
-        }
         if ($Config::Config{"osname"} eq "MSWin32") {
+            $preprocessor = $ENV{CC} || "cl";
             push(@args, qw(/EP));
         } else {
+            $preprocessor = $ENV{CC} || (-x "/usr/bin/clang" ? "/usr/bin/clang" : "/usr/bin/gcc");
             push(@args, qw(-E -P -x c++));
         }
     }
index 22c3cc5..2d76247 100644 (file)
@@ -1,3 +1,15 @@
+2018-08-08  Ross Kirsling  <ross.kirsling@sony.com>
+
+        run-bindings-tests is not Win32-compatible
+        https://bugs.webkit.org/show_bug.cgi?id=188424
+
+        Reviewed by Fujii Hironori.
+
+        * Scripts/webkitpy/bindings/main.py:
+        (BindingsTests.main):
+        Stop leaking file descriptors.
+        (See https://www.logilab.org/blogentry/17873 for details, though the solution here is even simpler.)
+
 2018-08-08  Alex Christensen  <achristensen@webkit.org>
 
         Fix possible null dereference in WebBackForwardList::restoreFromState
index 3940687..f8236db 100644 (file)
@@ -176,32 +176,21 @@ class BindingsTests:
         all_tests_passed = True
 
         input_directory = os.path.join('WebCore', 'bindings', 'scripts', 'test')
-        supplemental_dependency_file = tempfile.mkstemp()[1]
-        window_constructors_file = tempfile.mkstemp()[1]
-        workerglobalscope_constructors_file = tempfile.mkstemp()[1]
-        dedicatedworkerglobalscope_constructors_file = tempfile.mkstemp()[1]
-        serviceworkerglobalscope_constructors_file = tempfile.mkstemp()[1]
-        if self.generate_supplemental_dependency(input_directory, supplemental_dependency_file, window_constructors_file, workerglobalscope_constructors_file, dedicatedworkerglobalscope_constructors_file, serviceworkerglobalscope_constructors_file):
+        supplemental_dependency_file = tempfile.NamedTemporaryFile()
+        window_constructors_file = tempfile.NamedTemporaryFile()
+        workerglobalscope_constructors_file = tempfile.NamedTemporaryFile()
+        dedicatedworkerglobalscope_constructors_file = tempfile.NamedTemporaryFile()
+        serviceworkerglobalscope_constructors_file = tempfile.NamedTemporaryFile()
+        if self.generate_supplemental_dependency(input_directory, supplemental_dependency_file.name, window_constructors_file.name, workerglobalscope_constructors_file.name, dedicatedworkerglobalscope_constructors_file.name, serviceworkerglobalscope_constructors_file.name):
             print('Failed to generate a supplemental dependency file.')
-            os.remove(supplemental_dependency_file)
-            os.remove(window_constructors_file)
-            os.remove(workerglobalscope_constructors_file)
-            os.remove(dedicatedworkerglobalscope_constructors_file)
-            os.remove(serviceworkerglobalscope_constructors_file)
             return -1
 
         for generator in self.generators:
             input_directory = os.path.join('WebCore', 'bindings', 'scripts', 'test')
             reference_directory = os.path.join('WebCore', 'bindings', 'scripts', 'test', generator)
-            if not self.run_tests(generator, input_directory, reference_directory, supplemental_dependency_file):
+            if not self.run_tests(generator, input_directory, reference_directory, supplemental_dependency_file.name):
                 all_tests_passed = False
 
-        os.remove(supplemental_dependency_file)
-        os.remove(window_constructors_file)
-        os.remove(workerglobalscope_constructors_file)
-        os.remove(dedicatedworkerglobalscope_constructors_file)
-        os.remove(serviceworkerglobalscope_constructors_file)
-
         if self.json_file_name:
             json_data = {
                 'failures': self.failures,