Changeset 218482 in webkit
- Timestamp:
- Jun 19, 2017 3:39:23 AM (7 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r218480 r218482 1 2017-06-19 Carlos Alberto Lopez Perez <clopez@igalia.com> 2 3 Port setup_environ_for_server should not set environment variables related with the driver. 4 https://bugs.webkit.org/show_bug.cgi?id=173483 5 6 Reviewed by Carlos Garcia Campos. 7 8 The port setup_environ_for_server() should not set environment variables 9 that depend on the type of driver (like DISPLAY or GDK_BACKEND). 10 This varibles should be only set on the driver setup_environ_for_test(). 11 12 This causes that (for example) the variable DISPLAY or XAUTHORITY leaks 13 into the test environment even when running the tests with a driver 14 that is not the Xorg or Xvfb one. 15 16 * Scripts/webkitpy/port/base.py: Stop setting XAUTHORITY and DISPLAY here. 17 (Port.to.setup_environ_for_server): 18 * Scripts/webkitpy/port/driver.py: Remove unneded WEBKIT_OUTPUTDIR that is already set on base.py 19 (Driver._setup_environ_for_driver): 20 * Scripts/webkitpy/port/driver_unittest.py: 21 (DriverTest.test_setup_environ_for_test): 22 (DriverTest): 23 (DriverTest.test_setup_environ_base_vars): 24 * Scripts/webkitpy/port/gtk.py: Stop setting GDK_BACKEND here and do that on the driver (Xvfb). 25 (GtkPort.setup_environ_for_server): 26 * Scripts/webkitpy/port/wayland_unittest.py: Added. 27 (WaylandDriverTest): 28 (WaylandDriverTest.make_driver): 29 (WaylandDriverTest.make_environment): 30 (WaylandDriverTest.test_checkdriver): 31 (WaylandDriverTest.test_environment_needed_variables): 32 (WaylandDriverTest.test_environment_forbidden_variables): 33 (WaylandDriverTest.test_environment_optional_variables): 34 * Scripts/webkitpy/port/waylanddriver.py: Allow the driver to run also with WAYLAND_SOCKET. 35 (WaylandDriver.check_driver): 36 (WaylandDriver._setup_environ_for_test): 37 * Scripts/webkitpy/port/xorgdriver.py: 38 (XorgDriver.check_driver): 39 (XorgDriver._setup_environ_for_test): 40 * Scripts/webkitpy/port/xorgdriver_unittest.py: Added. 41 (XorgDriverTest): 42 (XorgDriverTest.make_driver): 43 (XorgDriverTest.make_environment): 44 (XorgDriverTest.test_checkdriver): 45 (XorgDriverTest.test_environment_needed_variables): 46 (XorgDriverTest.test_environment_forbidden_variables): 47 (XorgDriverTest.test_environment_optional_variables): 48 * Scripts/webkitpy/port/xvfbdriver.py: 49 (XvfbDriver._setup_environ_for_test): 50 * Scripts/webkitpy/port/xvfbdriver_unittest.py: 51 (XvfbDriverTest.assertDriverStartSuccessful): 52 53 1 54 2017-05-14 Frederic Wang <fwang@igalia.com> 2 55 -
trunk/Tools/Scripts/webkitpy/port/base.py
r217913 r218482 868 868 # launching subprocesses to ensure consistent test results. 869 869 clean_env = {} 870 # Note: don't set here driver specific variables (related to X11, Wayland, etc.) 871 # Use the driver _setup_environ_for_test() method for that. 870 872 variables_to_copy = [ 871 873 # For Linux: 872 874 'ALSA_CARD', 873 875 'DBUS_SESSION_BUS_ADDRESS', 874 'HOME',875 876 'LANG', 876 877 'LD_LIBRARY_PATH', 877 'XAUTHORITY',878 878 'XDG_DATA_DIRS', 879 879 'XDG_RUNTIME_DIR', … … 882 882 'DYLD_FRAMEWORK_PATH', 883 883 'DYLD_LIBRARY_PATH', 884 'HOME',885 884 '__XPC_DYLD_FRAMEWORK_PATH', 886 885 '__XPC_DYLD_LIBRARY_PATH', … … 893 892 # Windows: 894 893 'COMSPEC', 895 'PATH',896 894 'SYSTEMDRIVE', 897 895 'SYSTEMROOT', … … 899 897 900 898 # Most ports (?): 899 'HOME', 900 'PATH', 901 901 'WEBKIT_TESTFONTS', 902 902 'WEBKIT_OUTPUTDIR', … … 905 905 for variable in variables_to_copy: 906 906 self._copy_value_from_environ_if_set(clean_env, variable) 907 908 # For Linux:909 clean_env['DISPLAY'] = self._value_or_default_from_environ('DISPLAY', ':1')910 907 911 908 for string_variable in self.get_option('additional_env_var', []): -
trunk/Tools/Scripts/webkitpy/port/driver.py
r218055 r218482 354 354 environment['ASAN_OPTIONS'] = "allocator_may_return_null=1" 355 355 environment['__XPC_ASAN_OPTIONS'] = environment['ASAN_OPTIONS'] 356 if 'WEBKIT_OUTPUTDIR' in os.environ:357 environment['WEBKIT_OUTPUTDIR'] = os.environ['WEBKIT_OUTPUTDIR']358 356 if self._profiler: 359 357 environment = self._profiler.adjusted_environment(environment) -
trunk/Tools/Scripts/webkitpy/port/driver_unittest.py
r218055 r218482 347 347 self.assertIn('WEBKIT_OUTPUTDIR', environment_driver_test) 348 348 self.assertEqual(environment_user['WEBKIT_OUTPUTDIR'], environment_driver_test['WEBKIT_OUTPUTDIR']) 349 350 def test_setup_environ_base_vars(self): 351 # This are essential environment variables that should be copied 352 # as part of base:setup_environ_for_server for all drivers 353 environ_keep_yes = {'HOME': '/home/igalia', 354 'PATH': '/bin:/usr/sbin:/usr/bin', 355 'WEBKIT_TESTFONTS': '/opt/webkit/WebKitBuild/WKTestFonts', 356 'WEBKIT_OUTPUTDIR': '/opt/webkit/WebKitBuild/Release', 357 'LANG': 'en_US.utf8'} 358 # This are environment variables that should be copied 359 # on the driver (wayland, x11). But not in the base driver. 360 environ_keep_no = {'DISPLAY': ':0.0', 361 'XAUTHORITY': '/home/igalia/.Xauthority', 362 'WAYLAND_DISPLAY': 'wayland-0', 363 'WAYLAND_SOCKET': 'wayland-socket-0', 364 'GDK_BACKEND': 'x11'} 365 environment_user = dict(environ_keep_yes.items() + environ_keep_no.items()) 366 with patch('os.environ', environment_user): 367 port = self.make_port() 368 driver = Driver(port, None, pixel_tests=False) 369 environment_driver_test = driver._setup_environ_for_test() 370 for var in environ_keep_no.keys(): 371 self.assertNotIn(var, environment_driver_test) 372 for var in environ_keep_yes.keys(): 373 self.assertIn(var, environment_driver_test) 374 self.assertEqual(environment_driver_test[var], environ_keep_yes[var]) -
trunk/Tools/Scripts/webkitpy/port/gtk.py
r218270 r218482 124 124 self._copy_value_from_environ_if_set(environment, 'WEBKIT_OUTPUTDIR') 125 125 126 if self._driver_class() is XvfbDriver:127 # Make sure to use the correct GDK backend - we might have a Wayland session128 environment['GDK_BACKEND'] = 'x11'129 130 126 # Configure the software libgl renderer if jhbuild ready and we test inside a virtualized window system 131 127 if self._driver_class() in [XvfbDriver, WestonDriver] and self._should_use_jhbuild(): -
trunk/Tools/Scripts/webkitpy/port/waylanddriver.py
r210523 r218482 40 40 @staticmethod 41 41 def check_driver(port): 42 if "WAYLAND_DISPLAY" not in os.environ:43 _log.error("WAYLAND_DISPLAY not found in the environment. Cannot run tests.")44 42 if not any(wayland_env_var in os.environ for wayland_env_var in ['WAYLAND_DISPLAY', 'WAYLAND_SOCKET']): 43 _log.error('WAYLAND_DISPLAY or WAYLAND_SOCKET not found in the environment. Cannot run tests.') 44 return False 45 45 return True 46 46 47 47 def _setup_environ_for_test(self): 48 48 driver_environment = self._port.setup_environ_for_server(self._server_name) 49 driver_environment['WAYLAND_DISPLAY'] = os.environ.get('WAYLAND_DISPLAY') 49 self._port._copy_value_from_environ_if_set(driver_environment, 'WAYLAND_DISPLAY') 50 self._port._copy_value_from_environ_if_set(driver_environment, 'WAYLAND_SOCKET') 50 51 driver_environment['GDK_BACKEND'] = 'wayland' 51 if driver_environment.get('DISPLAY'):52 del driver_environment['DISPLAY']53 52 driver_environment['LOCAL_RESOURCE_ROOT'] = self._port.layout_tests_dir() 54 53 driver_environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir) -
trunk/Tools/Scripts/webkitpy/port/xorgdriver.py
r205014 r218482 40 40 @staticmethod 41 41 def check_driver(port): 42 if "DISPLAY"not in os.environ:43 _log.error( "DISPLAY not found in the environment. Cannot run tests.")42 if 'DISPLAY' not in os.environ: 43 _log.error('DISPLAY not found in the environment. Cannot run tests.') 44 44 return False 45 45 return True 46 46 47 47 def _setup_environ_for_test(self): 48 # setup_environ_for_server() already takes care of copying the49 # XAUTHORITY environment variable50 48 server_environment = self._port.setup_environ_for_server(self._server_name) 49 self._port._copy_value_from_environ_if_set(server_environment, 'DISPLAY') 50 self._port._copy_value_from_environ_if_set(server_environment, 'XAUTHORITY') 51 server_environment['GDK_BACKEND'] = 'x11' 51 52 server_environment['LOCAL_RESOURCE_ROOT'] = self._port.layout_tests_dir() 52 53 server_environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir) -
trunk/Tools/Scripts/webkitpy/port/xvfbdriver.py
r205014 r218482 99 99 # We must do this here because the DISPLAY number depends on _worker_number 100 100 environment['DISPLAY'] = ":%d" % display_id 101 environment['GDK_BACKEND'] = 'x11' 101 102 self._driver_tempdir = self._port.host.filesystem.mkdtemp(prefix='%s-' % self._server_name) 102 103 environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir) -
trunk/Tools/Scripts/webkitpy/port/xvfbdriver_unittest.py
r192569 r218482 68 68 OutputCapture().assert_outputs(self, driver.start, [pixel_tests, []], expected_logs=expected_logs) 69 69 self.assertTrue(driver._server_process.started) 70 self.assertEqual(driver._server_process.env["DISPLAY"], expected_display) 70 self.assertEqual(driver._server_process.env['DISPLAY'], expected_display) 71 self.assertEqual(driver._server_process.env['GDK_BACKEND'], 'x11') 71 72 72 73 def test_start(self):
Note: See TracChangeset
for help on using the changeset viewer.