- Revision
- 247663
- Author
- [email protected]
- Date
- 2019-07-19 17:55:51 -0700 (Fri, 19 Jul 2019)
Log Message
[webkitpy] Allow the testrunner driver to setup the environment completely without needing to start the server process.
https://bugs.webkit.org/show_bug.cgi?id=199945
Reviewed by Michael Catanzaro.
Refactor the code to create the Driver temporal directories inside Driver._setup_environ_for_driver().
This allows external callers to setup the environment for running tests by calling that method without needing to start the server process.
When this callers finish testing, it is enough with calling either Driver.stop() or Driver._delete_temporal_directories().
* Scripts/webkitpy/port/driver.py:
(Driver._setup_environ_for_driver):
(Driver._create_temporal_directories):
(Driver):
(Driver._start):
(Driver._delete_temporal_directories):
(Driver.stop):
* Scripts/webkitpy/w3c/wpt_runner.py: Not needed anymore to start the driver since this doesnt need the server process running.
(main):
* Scripts/webkitpy/webdriver_tests/webdriver_test_runner.py: Ditto.
(WebDriverTestRunner.__init__):
* glib/api_test_runner.py:
(TestRunner._setup_testing_environment): Ditto.
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (247662 => 247663)
--- trunk/Tools/ChangeLog 2019-07-20 00:55:16 UTC (rev 247662)
+++ trunk/Tools/ChangeLog 2019-07-20 00:55:51 UTC (rev 247663)
@@ -1,3 +1,28 @@
+2019-07-19 Carlos Alberto Lopez Perez <[email protected]>
+
+ [webkitpy] Allow the testrunner driver to setup the environment completely without needing to start the server process.
+ https://bugs.webkit.org/show_bug.cgi?id=199945
+
+ Reviewed by Michael Catanzaro.
+
+ Refactor the code to create the Driver temporal directories inside Driver._setup_environ_for_driver().
+ This allows external callers to setup the environment for running tests by calling that method without needing to start the server process.
+ When this callers finish testing, it is enough with calling either Driver.stop() or Driver._delete_temporal_directories().
+
+ * Scripts/webkitpy/port/driver.py:
+ (Driver._setup_environ_for_driver):
+ (Driver._create_temporal_directories):
+ (Driver):
+ (Driver._start):
+ (Driver._delete_temporal_directories):
+ (Driver.stop):
+ * Scripts/webkitpy/w3c/wpt_runner.py: Not needed anymore to start the driver since this doesnt need the server process running.
+ (main):
+ * Scripts/webkitpy/webdriver_tests/webdriver_test_runner.py: Ditto.
+ (WebDriverTestRunner.__init__):
+ * glib/api_test_runner.py:
+ (TestRunner._setup_testing_environment): Ditto.
+
2019-07-19 Aakash Jain <[email protected]>
[ews-build] Display pre-existing Layout test failure names in the build summary
Modified: trunk/Tools/Scripts/webkitpy/port/driver.py (247662 => 247663)
--- trunk/Tools/Scripts/webkitpy/port/driver.py 2019-07-20 00:55:16 UTC (rev 247662)
+++ trunk/Tools/Scripts/webkitpy/port/driver.py 2019-07-20 00:55:51 UTC (rev 247663)
@@ -410,6 +410,8 @@
environment[variable] = path
def _setup_environ_for_driver(self, environment):
+ self._port._clear_global_caches_and_temporary_files()
+ self._create_temporal_directories()
build_root_path = str(self._port._build_path())
self._append_environment_variable_path(environment, 'DYLD_LIBRARY_PATH', build_root_path)
self._append_environment_variable_path(environment, '__XPC_DYLD_LIBRARY_PATH', build_root_path)
@@ -451,17 +453,19 @@
environment = self._setup_environ_for_driver(environment)
return environment
+ def _create_temporal_directories(self):
+ # Each driver process should be using individual directories under _driver_tempdir (which is deleted when stopping),
+ # however some subsystems on some platforms could end up using process default ones.
+ if self._driver_tempdir is None:
+ self._driver_tempdir = self._port._driver_tempdir(self._target_host)
+ self._driver_user_directory_suffix = os.path.basename(str(self._driver_tempdir))
+ user_cache_directory = self._port._path_to_user_cache_directory(self._driver_user_directory_suffix)
+ if user_cache_directory:
+ self._target_host.filesystem.maybe_make_directory(user_cache_directory)
+ self._driver_user_cache_directory = user_cache_directory
+
def _start(self, pixel_tests, per_test_args):
self.stop()
- # Each driver process should be using individual directories under _driver_tempdir (which is deleted when stopping),
- # however some subsystems on some platforms could end up using process default ones.
- self._port._clear_global_caches_and_temporary_files()
- self._driver_tempdir = self._port._driver_tempdir(self._target_host)
- self._driver_user_directory_suffix = os.path.basename(str(self._driver_tempdir))
- user_cache_directory = self._port._path_to_user_cache_directory(self._driver_user_directory_suffix)
- if user_cache_directory:
- self._target_host.filesystem.maybe_make_directory(user_cache_directory)
- self._driver_user_cache_directory = user_cache_directory
environment = self._setup_environ_for_test()
self._crashed_process_name = None
self._crashed_pid = None
@@ -477,6 +481,14 @@
# Remote drivers will override this method to return the pid on the device.
return self._server_process.pid()
+ def _delete_temporal_directories(self):
+ if self._driver_tempdir:
+ self._target_host.filesystem.rmtree(str(self._driver_tempdir))
+ self._driver_tempdir = None
+ if self._driver_user_cache_directory:
+ self._target_host.filesystem.rmtree(self._driver_user_cache_directory)
+ self._driver_user_cache_directory = None
+
def stop(self):
if self._server_process:
self._server_process.stop(self._port.driver_stop_timeout())
@@ -483,14 +495,8 @@
self._server_process = None
if self._profiler:
self._profiler.profile_after_exit()
+ self._delete_temporal_directories()
- if self._driver_tempdir:
- self._target_host.filesystem.rmtree(str(self._driver_tempdir))
- self._driver_tempdir = None
- if self._driver_user_cache_directory:
- self._target_host.filesystem.rmtree(self._driver_user_cache_directory)
- self._driver_user_cache_directory = None
-
def cmd_line(self, pixel_tests, per_test_args):
cmd = self._command_wrapper()
cmd.append(self._port._path_to_driver())
Modified: trunk/Tools/Scripts/webkitpy/w3c/wpt_runner.py (247662 => 247663)
--- trunk/Tools/Scripts/webkitpy/w3c/wpt_runner.py 2019-07-20 00:55:16 UTC (rev 247662)
+++ trunk/Tools/Scripts/webkitpy/w3c/wpt_runner.py 2019-07-20 00:55:51 UTC (rev 247663)
@@ -80,7 +80,6 @@
# Create the Port-specific driver.
port._display_server = options.display_server
display_driver = port.create_driver(worker_number=0, no_timeout=True)._make_driver(pixel_tests=False)
- display_driver.start(False, [])
if not display_driver.check_driver(port):
raise RuntimeError("Failed to check driver %s" % display_driver.__class__.__name__)
os.environ.update(display_driver._setup_environ_for_test())
Modified: trunk/Tools/Scripts/webkitpy/webdriver_tests/webdriver_test_runner.py (247662 => 247663)
--- trunk/Tools/Scripts/webkitpy/webdriver_tests/webdriver_test_runner.py 2019-07-20 00:55:16 UTC (rev 247662)
+++ trunk/Tools/Scripts/webkitpy/webdriver_tests/webdriver_test_runner.py 2019-07-20 00:55:51 UTC (rev 247663)
@@ -60,7 +60,6 @@
if not os.path.isfile(os.path.join(self._tests_dir, test)):
_log.warning('Test %s does not exist' % test)
- self._display_driver.start(False, [])
env = self._display_driver._setup_environ_for_test()
self._runners = [runner_cls(self._port, driver, env, self._expectations) for runner_cls in self.RUNNER_CLASSES]
Modified: trunk/Tools/glib/api_test_runner.py (247662 => 247663)
--- trunk/Tools/glib/api_test_runner.py 2019-07-20 00:55:16 UTC (rev 247662)
+++ trunk/Tools/glib/api_test_runner.py 2019-07-20 00:55:51 UTC (rev 247663)
@@ -105,7 +105,6 @@
return driver
def _setup_testing_environment(self):
- self._driver.start(False, [])
self._test_env = self._driver._setup_environ_for_test()
self._test_env["TEST_WEBKIT_API_WEBKIT2_RESOURCES_PATH"] = common.top_level_path("Tools", "TestWebKitAPI", "Tests", "WebKit")
self._test_env["TEST_WEBKIT_API_WEBKIT2_INJECTED_BUNDLE_PATH"] = common.library_build_path()