Title: [221655] trunk/Tools
Revision
221655
Author
[email protected]
Date
2017-09-05 18:00:48 -0700 (Tue, 05 Sep 2017)

Log Message

Fix Benchmark Runner selenium autoinstall imports
https://bugs.webkit.org/show_bug.cgi?id=175727

Patch by Matthew Stewart <[email protected]> on 2017-09-05
Reviewed by Stephanie Lewis.

This fixes run-benchmark taking a long time to start with WebDriver.

Inside webdriver's __init__.py file, it imports many other modules.
So if we try to directly import autoinstalled.selenium.webdriver, it
will re-run the autoinstall __init__.py for each new imported module
that contains ".selenium"
TODO: fix this inside the autoinstall code, to only do one install per
import.

* Scripts/webkitpy/benchmark_runner/browser_driver/linux_chrome_driver.py:
(LinuxChromeDriver.launch_driver):
* Scripts/webkitpy/benchmark_runner/browser_driver/linux_firefox_driver.py:
(LinuxFirefoxDriver.launch_driver):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py:
(OSXChromeDriver.launch_driver):
(OSXChromeCanaryDriver.launch_driver):
(create_chrome_options):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py:
(OSXFirefoxDriver.launch_driver):
(OSXFirefoxNightlyDriver.launch_driver):
* Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:
(OSXSafariDriver.launch_driver):
* Scripts/webkitpy/benchmark_runner/webdriver_benchmark_runner.py:
(WebDriverBenchmarkRunner._run_one_test):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (221654 => 221655)


--- trunk/Tools/ChangeLog	2017-09-06 00:58:33 UTC (rev 221654)
+++ trunk/Tools/ChangeLog	2017-09-06 01:00:48 UTC (rev 221655)
@@ -1,3 +1,35 @@
+2017-09-05  Matthew Stewart  <[email protected]>
+
+        Fix Benchmark Runner selenium autoinstall imports
+        https://bugs.webkit.org/show_bug.cgi?id=175727
+
+        Reviewed by Stephanie Lewis.
+
+        This fixes run-benchmark taking a long time to start with WebDriver.
+
+        Inside webdriver's __init__.py file, it imports many other modules.
+        So if we try to directly import autoinstalled.selenium.webdriver, it
+        will re-run the autoinstall __init__.py for each new imported module
+        that contains ".selenium"
+        TODO: fix this inside the autoinstall code, to only do one install per
+        import.
+
+        * Scripts/webkitpy/benchmark_runner/browser_driver/linux_chrome_driver.py:
+        (LinuxChromeDriver.launch_driver):
+        * Scripts/webkitpy/benchmark_runner/browser_driver/linux_firefox_driver.py:
+        (LinuxFirefoxDriver.launch_driver):
+        * Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py:
+        (OSXChromeDriver.launch_driver):
+        (OSXChromeCanaryDriver.launch_driver):
+        (create_chrome_options):
+        * Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py:
+        (OSXFirefoxDriver.launch_driver):
+        (OSXFirefoxNightlyDriver.launch_driver):
+        * Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py:
+        (OSXSafariDriver.launch_driver):
+        * Scripts/webkitpy/benchmark_runner/webdriver_benchmark_runner.py:
+        (WebDriverBenchmarkRunner._run_one_test):
+
 2017-09-05  Aakash Jain  <[email protected]>
 
         EWS should report when a step succeeds

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_chrome_driver.py (221654 => 221655)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_chrome_driver.py	2017-09-06 00:58:33 UTC (rev 221654)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_chrome_driver.py	2017-09-06 01:00:48 UTC (rev 221655)
@@ -39,7 +39,9 @@
         super(LinuxChromeDriver, self).launch_url(url, options, browser_build_path)
 
     def launch_driver(self, url, options, browser_build_path):
-        from webkitpy.thirdparty.autoinstalled.selenium.webdriver.chrome.options import Options
+        import webkitpy.thirdparty.autoinstalled.selenium
+        from selenium import webdriver
+        from selenium.webdriver.chrome.options import Options
         options = Options()
         options.add_argument("--disable-web-security")
         options.add_argument("--user-data-dir")
@@ -49,7 +51,6 @@
             binary_path = os.path.join(browser_build_path, 'chromium-browser')
             options.binary_location = binary_path
         driver_executable = self.webdriver_binary_path
-        from webkitpy.thirdparty.autoinstalled.selenium import webdriver
         driver = webdriver.Chrome(chrome_options=options, executable_path=driver_executable)
         super(LinuxChromeDriver, self).launch_webdriver(url, driver)
         return driver

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_firefox_driver.py (221654 => 221655)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_firefox_driver.py	2017-09-06 00:58:33 UTC (rev 221654)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/linux_firefox_driver.py	2017-09-06 01:00:48 UTC (rev 221655)
@@ -41,13 +41,14 @@
         super(LinuxFirefoxDriver, self).launch_url(url, options, browser_build_path)
 
     def launch_driver(self, url, options, browser_build_path):
-        from webkitpy.thirdparty.autoinstalled.selenium.webdriver.firefox.options import Options
+        import webkitpy.thirdparty.autoinstalled.selenium
+        from selenium import webdriver
+        from selenium.webdriver.firefox.options import Options
         options = Options()
         if browser_build_path:
             binary_path = os.path.join(browser_build_path, 'firefox-bin')
             options.binary_location = binary_path
         driver_executable = self.webdriver_binary_path
-        from webkitpy.thirdparty.autoinstalled.selenium import webdriver
         driver = webdriver.Firefox(firefox_options=options, executable_path=driver_executable)
         super(LinuxFirefoxDriver, self).launch_webdriver(url, driver)
         return driver

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py (221654 => 221655)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py	2017-09-06 00:58:33 UTC (rev 221654)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_chrome_driver.py	2017-09-06 01:00:48 UTC (rev 221655)
@@ -18,6 +18,8 @@
         self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url="" args=args_with_url)
 
     def launch_driver(self, url, options, browser_build_path):
+        import webkitpy.thirdparty.autoinstalled.selenium
+        from selenium import webdriver
         chrome_options = create_chrome_options()
         if browser_build_path:
             app_path = os.path.join(browser_build_path, self.app_name)
@@ -24,7 +26,6 @@
             binary_path = os.path.join(app_path, "Contents/MacOS", self.process_name)
             chrome_options.binary_location = binary_path
         driver_executable = self.webdriver_binary_path
-        from webkitpy.thirdparty.autoinstalled.selenium import webdriver
         driver = webdriver.Chrome(chrome_options=chrome_options, executable_path=driver_executable)
         self._launch_webdriver(url="" driver=driver)
         return driver
@@ -40,6 +41,8 @@
         self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url="" args=args_with_url)
 
     def launch_driver(self, url, options, browser_build_path):
+        import webkitpy.thirdparty.autoinstalled.selenium
+        from selenium import webdriver
         chrome_options = create_chrome_options()
         if not browser_build_path:
             browser_build_path = '/Applications/'
@@ -47,7 +50,6 @@
         binary_path = os.path.join(app_path, "Contents/MacOS", self.process_name)
         chrome_options.binary_location = binary_path
         driver_executable = self.webdriver_binary_path
-        from webkitpy.thirdparty.autoinstalled.selenium import webdriver
         driver = webdriver.Chrome(chrome_options=chrome_options, executable_path=driver_executable)
         self._launch_webdriver(url="" driver=driver)
         return driver
@@ -58,7 +60,7 @@
     return args
 
 def create_chrome_options():
-    from webkitpy.thirdparty.autoinstalled.selenium.webdriver.chrome.options import Options
+    from selenium.webdriver.chrome.options import Options
     chrome_options = Options()
     chrome_options.add_argument("--disable-web-security")
     chrome_options.add_argument("--user-data-dir")

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py (221654 => 221655)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py	2017-09-06 00:58:33 UTC (rev 221654)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_firefox_driver.py	2017-09-06 01:00:48 UTC (rev 221655)
@@ -19,7 +19,9 @@
         self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url="" args=args_with_url)
 
     def launch_driver(self, url, options, browser_build_path):
-        from webkitpy.thirdparty.autoinstalled.selenium.webdriver.firefox.options import Options
+        import webkitpy.thirdparty.autoinstalled.selenium
+        from selenium import webdriver
+        from selenium.webdriver.firefox.options import Options
         firefox_options = Options()
         if browser_build_path:
             app_path = os.path.join(browser_build_path, self.app_name)
@@ -26,7 +28,6 @@
             binary_path = os.path.join(app_path, "Contents/MacOS", self.process_name)
             firefox_options.binary_location = binary_path
         driver_executable = self.webdriver_binary_path
-        from webkitpy.thirdparty.autoinstalled.selenium import webdriver
         driver = webdriver.Firefox(firefox_options=firefox_options, executable_path=driver_executable)
         self._launch_webdriver(url="" driver=driver)
         return driver
@@ -42,7 +43,9 @@
         self._launch_process(build_dir=browser_build_path, app_name=self.app_name, url="" args=args_with_url)
 
     def launch_driver(self, url, options, browser_build_path):
-        from webkitpy.thirdparty.autoinstalled.selenium.webdriver.firefox.options import Options
+        import webkitpy.thirdparty.autoinstalled.selenium
+        from selenium import webdriver
+        from selenium.webdriver.firefox.options import Options
         firefox_options = Options()
         if not browser_build_path:
             browser_build_path = '/Applications/'
@@ -50,7 +53,6 @@
         binary_path = os.path.join(app_path, "Contents/MacOS", self.process_name)
         firefox_options.binary_location = binary_path
         driver_executable = self.webdriver_binary_path
-        from webkitpy.thirdparty.autoinstalled.selenium import webdriver
         driver = webdriver.Firefox(firefox_options=firefox_options, executable_path=driver_executable)
         self._launch_webdriver(url="" driver=driver)
         return driver

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py (221654 => 221655)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py	2017-09-06 00:58:33 UTC (rev 221654)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/osx_safari_driver.py	2017-09-06 01:00:48 UTC (rev 221655)
@@ -45,7 +45,8 @@
         subprocess.Popen(['open', '-a', args[0], url])
 
     def launch_driver(self, url, options, browser_build_path):
-        from webkitpy.thirdparty.autoinstalled.selenium import webdriver
+        import webkitpy.thirdparty.autoinstalled.selenium
+        from selenium import webdriver
         driver = webdriver.Safari(quiet=False)
         self._launch_webdriver(url="" driver=driver)
         return driver

Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/webdriver_benchmark_runner.py (221654 => 221655)


--- trunk/Tools/Scripts/webkitpy/benchmark_runner/webdriver_benchmark_runner.py	2017-09-06 00:58:33 UTC (rev 221654)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/webdriver_benchmark_runner.py	2017-09-06 01:00:48 UTC (rev 221655)
@@ -17,7 +17,8 @@
         return result
 
     def _run_one_test(self, web_root, test_file):
-        from webkitpy.thirdparty.autoinstalled.selenium.webdriver.support.ui import WebDriverWait
+        import webkitpy.thirdparty.autoinstalled.selenium
+        from selenium.webdriver.support.ui import WebDriverWait
         result = None
         try:
             url = ''.format(root=web_root, plan_name=self._plan_name, test_file=test_file)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to