class EflPort(Port): port_name = 'efl' def __init__(self, *args, **kwargs): super(EflPort, self).__init__(*args, **kwargs) self._jhbuild_wrapper = [ self.path_from_webkit_base('Tools', 'jhbuild', 'jhbuild-wrapper'), '--efl', 'run' ] self.set_option_default('wrapper', ' '.join(self._jhbuild_wrapper)) self.webprocess_cmd_prefix = self.get_option('webprocess_cmd_prefix') self._pulseaudio_sanitizer = PulseAudioSanitizer() def _port_flag_for_scripts(self): return "--efl" def setup_test_run(self): super(EflPort, self).setup_test_run() self._pulseaudio_sanitizer.unload_pulseaudio_module() def setup_environ_for_server(self, server_name=None): env = super(EflPort, self).setup_environ_for_server(server_name) # If DISPLAY environment variable is unset in the system # e.g. on build bot, remove DISPLAY variable from the dictionary if not 'DISPLAY' in os.environ: del env['DISPLAY'] env['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path( 'lib', 'libTestRunnerInjectedBundle.so') env['TEST_RUNNER_PLUGIN_PATH'] = self._build_path('lib', 'plugins') # Silence GIO warnings about using the "memory" GSettings backend. env['GSETTINGS_BACKEND'] = 'memory' if self.webprocess_cmd_prefix: env['WEB_PROCESS_CMD_PREFIX'] = self.webprocess_cmd_prefix return env def default_timeout_ms(self): # Tests run considerably slower under gdb # or valgrind. if self.get_option('webprocess_cmd_prefix'): return 350 * 1000 return super(EflPort, self).default_timeout_ms() def clean_up_test_run(self): super(EflPort, self).clean_up_test_run() self._pulseaudio_sanitizer.restore_pulseaudio_module() def _generate_all_test_configurations(self): return [ TestConfiguration(version=self._version, architecture='x86', build_type=build_type) for build_type in self.ALL_BUILD_TYPES ] def _driver_class(self): if os.environ.get("DISABLE_XVFB_DRIVER"): return Port._driver_class(self) return XvfbDriver def _path_to_driver(self): return self._build_path('bin', self.driver_name()) def _path_to_image_diff(self): return self._build_path('bin', 'ImageDiff') def _image_diff_command(self, *args, **kwargs): return self._jhbuild_wrapper + super( EflPort, self)._image_diff_command(*args, **kwargs) def _path_to_webcore_library(self): static_path = self._build_path('lib', 'libwebcore_efl.a') dyn_path = self._build_path('lib', 'libwebcore_efl.so') return static_path if self._filesystem.exists( static_path) else dyn_path def _search_paths(self): search_paths = [] search_paths.append(self.port_name) search_paths.append('wk2') return search_paths def default_baseline_search_path(self): return map(self._webkit_baseline_path, self._search_paths()) def _port_specific_expectations_files(self): # FIXME: We should be able to use the default algorithm here. return list( reversed([ self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in self._search_paths() ])) def show_results_html_file(self, results_filename): # FIXME: We should find a way to share this implmentation with Gtk, # or teach run-launcher how to call run-safari and move this down to WebKitPort. run_launcher_args = ["file://%s" % results_filename] # FIXME: old-run-webkit-tests also added ["-graphicssystem", "raster", "-style", "windows"] # FIXME: old-run-webkit-tests converted results_filename path for cygwin. self._run_script("run-launcher", run_launcher_args) def check_sys_deps(self, needs_http): return super(EflPort, self).check_sys_deps( needs_http) and self._driver_class().check_driver(self) def build_webkit_command(self, build_style=None): command = super(EflPort, self).build_webkit_command(build_style) command.extend(["--efl", "--update-efl"]) command.append(super(EflPort, self).make_args()) return command def _get_crash_log(self, name, pid, stdout, stderr, newer_than): return GDBCrashLogGenerator(name, pid, newer_than, self._filesystem, self._path_to_driver).generate_crash_log( stdout, stderr) def test_expectations_file_position(self): # EFL port baseline search path is efl -> wk2 -> generic (as efl-wk2 and efl baselines are merged), so port test expectations file is at third to last position. return 2
class GtkPort(Port): port_name = "gtk" def __init__(self, *args, **kwargs): super(GtkPort, self).__init__(*args, **kwargs) self._pulseaudio_sanitizer = PulseAudioSanitizer() self._display_server = self.get_option("display_server") if self.get_option("leaks"): self._leakdetector = LeakDetectorValgrind(self._executive, self._filesystem, self.results_directory()) if not self.get_option("wrapper"): raise ValueError('use --wrapper=\"valgrind\" for memory leak detection on GTK') if self._should_use_jhbuild(): self._jhbuild_wrapper = [self.path_from_webkit_base('Tools', 'jhbuild', 'jhbuild-wrapper'), '--gtk', 'run'] if self.get_option('wrapper'): self.set_option('wrapper', ' '.join(self._jhbuild_wrapper) + ' ' + self.get_option('wrapper')) else: self.set_option_default('wrapper', ' '.join(self._jhbuild_wrapper)) def _built_executables_path(self, *path): return self._build_path(*(('bin',) + path)) def _built_libraries_path(self, *path): return self._build_path(*(('lib',) + path)) def _port_flag_for_scripts(self): return "--gtk" @memoized def _driver_class(self): if self._display_server == "weston": return WestonDriver if self._display_server == "wayland": return WaylandDriver if self._display_server == "xorg": return XorgDriver return XvfbDriver def default_timeout_ms(self): default_timeout = 15000 # Starting an application under Valgrind takes a lot longer than normal # so increase the timeout (empirically 10x is enough to avoid timeouts). multiplier = 10 if self.get_option("leaks") else 1 # Debug builds are slower (no compiler optimizations are used). if self.get_option('configuration') == 'Debug': multiplier *= 2 return multiplier * default_timeout def driver_stop_timeout(self): if self.get_option("leaks"): # Wait the default timeout time before killing the process in driver.stop(). return self.default_timeout_ms() return super(GtkPort, self).driver_stop_timeout() def setup_test_run(self, device_type=None): super(GtkPort, self).setup_test_run(device_type) self._pulseaudio_sanitizer.unload_pulseaudio_module() if self.get_option("leaks"): self._leakdetector.clean_leaks_files_from_results_directory() def clean_up_test_run(self): super(GtkPort, self).clean_up_test_run() self._pulseaudio_sanitizer.restore_pulseaudio_module() def setup_environ_for_server(self, server_name=None): environment = super(GtkPort, self).setup_environ_for_server(server_name) environment['G_DEBUG'] = 'fatal-criticals' environment['GSETTINGS_BACKEND'] = 'memory' environment['LIBOVERLAY_SCROLLBAR'] = '0' environment['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path('lib', 'libTestRunnerInjectedBundle.so') environment['TEST_RUNNER_TEST_PLUGIN_PATH'] = self._build_path('lib', 'plugins') self._copy_value_from_environ_if_set(environment, 'WEBKIT_OUTPUTDIR') self._copy_value_from_environ_if_set(environment, 'WEBKIT_JHBUILD') self._copy_value_from_environ_if_set(environment, 'WEBKIT_TOP_LEVEL') self._copy_value_from_environ_if_set(environment, 'WEBKIT_DEBUG') self._copy_value_from_environ_if_set(environment, 'WEBKIT_GST_USE_PLAYBIN3') for gst_variable in ('DEBUG', 'DEBUG_DUMP_DOT_DIR', 'DEBUG_FILE', 'DEBUG_NO_COLOR', 'PLUGIN_SCANNER', 'PLUGIN_PATH', 'PLUGIN_SYSTEM_PATH', 'REGISTRY', 'PLUGIN_PATH_1_0'): self._copy_value_from_environ_if_set(environment, 'GST_%s' % gst_variable) # Configure the software libgl renderer if jhbuild ready and we test inside a virtualized window system if self._driver_class() in [XvfbDriver, WestonDriver] and (self._should_use_jhbuild() or self._is_flatpak()): if self._should_use_jhbuild(): llvmpipe_libgl_path = self.host.executive.run_command(self._jhbuild_wrapper + ['printenv', 'LLVMPIPE_LIBGL_PATH'], ignore_errors=True).strip() dri_libgl_path = os.path.join(llvmpipe_libgl_path, "dri") else: # in flatpak llvmpipe_libgl_path = "/usr/lib/x86_64-linux-gnu/" dri_libgl_path = os.path.join(llvmpipe_libgl_path, "GL", "lib", "dri") if os.path.exists(os.path.join(llvmpipe_libgl_path, "libGL.so")) and os.path.exists(os.path.join(dri_libgl_path, "swrast_dri.so")): # Make sure va-api support gets disabled because it's incompatible with Mesa's softGL driver. environment['LIBVA_DRIVER_NAME'] = "null" # Force the Gallium llvmpipe software rasterizer environment['LIBGL_ALWAYS_SOFTWARE'] = "1" environment['LIBGL_DRIVERS_PATH'] = dri_libgl_path else: _log.warning("Can't find Gallium llvmpipe driver. Try to run update-webkitgtk-libs or update-webkit-flatpak") if self.get_option("leaks"): # Turn off GLib memory optimisations https://wiki.gnome.org/Valgrind. environment['G_SLICE'] = 'always-malloc' environment['G_DEBUG'] += ',gc-friendly' # Turn off bmalloc when running under Valgrind, see https://bugs.webkit.org/show_bug.cgi?id=177745 environment['Malloc'] = '1' xmlfilename = "".join(("drt-%p-", uuid.uuid1().hex, "-leaks.xml")) xmlfile = os.path.join(self.results_directory(), xmlfilename) suppressionsfile = self.path_from_webkit_base('Tools', 'Scripts', 'valgrind', 'suppressions.txt') environment['VALGRIND_OPTS'] = \ "--tool=memcheck " \ "--num-callers=40 " \ "--demangle=no " \ "--trace-children=no " \ "--smc-check=all-non-file " \ "--leak-check=yes " \ "--leak-resolution=high " \ "--show-possibly-lost=no " \ "--show-reachable=no " \ "--leak-check=full " \ "--undef-value-errors=no " \ "--gen-suppressions=all " \ "--xml=yes " \ "--xml-file=%s " \ "--suppressions=%s" % (xmlfile, suppressionsfile) return environment def _generate_all_test_configurations(self): configurations = [] for build_type in self.ALL_BUILD_TYPES: configurations.append(TestConfiguration(version=self.version_name(), architecture='x86', build_type=build_type)) return configurations def _path_to_driver(self): return self._built_executables_path(self.driver_name()) def _path_to_image_diff(self): return self._built_executables_path('ImageDiff') def _path_to_default_image_diff(self): return self._path_to_image_diff() def _path_to_webcore_library(self): gtk_library_names = [ "libwebkitgtk-1.0.so", "libwebkitgtk-3.0.so", "libwebkit2gtk-1.0.so", ] for library in gtk_library_names: full_library = self._built_libraries_path(library) if self._filesystem.isfile(full_library): return full_library return None def _search_paths(self): search_paths = [] if self._driver_class() in [WaylandDriver, WestonDriver]: search_paths.append(self.port_name + "-wayland") search_paths.append(self.port_name) search_paths.append('glib') search_paths.append('wk2') search_paths.extend(self.get_option("additional_platform_directory", [])) return search_paths def default_baseline_search_path(self, **kwargs): return list(map(self._webkit_baseline_path, self._search_paths())) def _port_specific_expectations_files(self, **kwargs): return [self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in reversed(self._search_paths())] def print_leaks_summary(self): if not self.get_option('leaks'): return # FIXME: This is a hack, but we don't have a better way to get this information from the workers yet # because we're in the manager process. leaks_files = self._leakdetector.leaks_files_in_results_directory() if not leaks_files: return self._leakdetector.parse_and_print_leaks_detail(leaks_files) def show_results_html_file(self, results_filename): self.run_minibrowser([path.abspath_to_uri(self.host.platform, results_filename)]) def check_sys_deps(self): return super(GtkPort, self).check_sys_deps() and self._driver_class().check_driver(self) def _get_crash_log(self, name, pid, stdout, stderr, newer_than, target_host=None): return GDBCrashLogGenerator(self._executive, name, pid, newer_than, self._filesystem, self._path_to_driver, self.port_name, self.get_option('configuration')).generate_crash_log(stdout, stderr) def test_expectations_file_position(self): # GTK port baseline search path is gtk -> glib -> wk2 -> generic (as gtk-wk2 and gtk baselines are merged), so port test expectations file is at third to last position. return 3 def build_webkit_command(self, build_style=None): command = super(GtkPort, self).build_webkit_command(build_style) command.extend(["--gtk", "--update-gtk"]) command.append(super(GtkPort, self).make_args()) return command def run_webkit_tests_command(self): command = super(GtkPort, self).run_webkit_tests_command() command.append("--gtk") return command def configuration_for_upload(self, host=None): configuration = super(GtkPort, self).configuration_for_upload(host=host) configuration['platform'] = 'GTK' configuration['version_name'] = self._display_server.capitalize() if self._display_server else 'Xvfb' return configuration def run_minibrowser(self, args): miniBrowser = self._build_path('bin', 'MiniBrowser') if not self._filesystem.isfile(miniBrowser): print("%s not found... Did you run build-webkit?" % miniBrowser) return 1 command = [miniBrowser] if self._should_use_jhbuild(): command = self._jhbuild_wrapper + command return self._executive.run_command(command + args, cwd=self.webkit_base(), stdout=None, return_stderr=False, decode_output=False)
class EflPort(Port): port_name = 'efl' def __init__(self, *args, **kwargs): super(EflPort, self).__init__(*args, **kwargs) self._jhbuild_wrapper_path = [self.path_from_webkit_base('Tools', 'jhbuild', 'jhbuild-wrapper'), '--efl', 'run'] self.set_option_default('wrapper', ' '.join(self._jhbuild_wrapper_path)) self.webprocess_cmd_prefix = self.get_option('webprocess_cmd_prefix') self._pulseaudio_sanitizer = PulseAudioSanitizer() def _port_flag_for_scripts(self): return "--efl" def setup_test_run(self): super(EflPort, self).setup_test_run() self._pulseaudio_sanitizer.unload_pulseaudio_module() def setup_environ_for_server(self, server_name=None): env = super(EflPort, self).setup_environ_for_server(server_name) # If DISPLAY environment variable is unset in the system # e.g. on build bot, remove DISPLAY variable from the dictionary if not 'DISPLAY' in os.environ: del env['DISPLAY'] env['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path('lib', 'libTestRunnerInjectedBundle.so') env['TEST_RUNNER_PLUGIN_PATH'] = self._build_path('lib') # Silence GIO warnings about using the "memory" GSettings backend. env['GSETTINGS_BACKEND'] = 'memory' if self.webprocess_cmd_prefix: env['WEB_PROCESS_CMD_PREFIX'] = self.webprocess_cmd_prefix return env def default_timeout_ms(self): # Tests run considerably slower under gdb # or valgrind. if self.get_option('webprocess_cmd_prefix'): return 350 * 1000 return super(EflPort, self).default_timeout_ms() def clean_up_test_run(self): super(EflPort, self).clean_up_test_run() self._pulseaudio_sanitizer.restore_pulseaudio_module() def _generate_all_test_configurations(self): return [TestConfiguration(version=self._version, architecture='x86', build_type=build_type) for build_type in self.ALL_BUILD_TYPES] def _driver_class(self): if os.environ.get("DISABLE_XVFB_DRIVER"): return Port._driver_class(self) return XvfbDriver def _path_to_driver(self): return self._build_path('bin', self.driver_name()) def _path_to_image_diff(self): return self._build_path('bin', 'ImageDiff') def _image_diff_command(self, *args, **kwargs): return self._jhbuild_wrapper_path + super(EflPort, self)._image_diff_command(*args, **kwargs) def _path_to_webcore_library(self): static_path = self._build_path('lib', 'libwebcore_efl.a') dyn_path = self._build_path('lib', 'libwebcore_efl.so') return static_path if self._filesystem.exists(static_path) else dyn_path def _search_paths(self): search_paths = [] search_paths.append(self.port_name) search_paths.append('wk2') return search_paths def default_baseline_search_path(self): return map(self._webkit_baseline_path, self._search_paths()) def _port_specific_expectations_files(self): # FIXME: We should be able to use the default algorithm here. return list(reversed([self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in self._search_paths()])) def show_results_html_file(self, results_filename): # FIXME: We should find a way to share this implmentation with Gtk, # or teach run-launcher how to call run-safari and move this down to WebKitPort. run_launcher_args = ["file://%s" % results_filename] # FIXME: old-run-webkit-tests also added ["-graphicssystem", "raster", "-style", "windows"] # FIXME: old-run-webkit-tests converted results_filename path for cygwin. self._run_script("run-launcher", run_launcher_args) def check_sys_deps(self, needs_http): return super(EflPort, self).check_sys_deps(needs_http) and self._driver_class().check_driver(self) def build_webkit_command(self, build_style=None): command = super(EflPort, self).build_webkit_command(build_style) command.extend(["--efl", "--update-efl"]) if self.get_option('webkit_test_runner'): command.append("--no-webkit1") else: command.append("--no-webkit2") command.append(super(EflPort, self).make_args()) return command def _get_crash_log(self, name, pid, stdout, stderr, newer_than): return GDBCrashLogGenerator(name, pid, newer_than, self._filesystem, self._path_to_driver).generate_crash_log(stdout, stderr) def test_expectations_file_position(self): # EFL port baseline search path is efl -> wk2 -> generic (as efl-wk2 and efl baselines are merged), so port test expectations file is at third to last position. return 2
class GtkPort(Port): port_name = "gtk" def __init__(self, *args, **kwargs): super(GtkPort, self).__init__(*args, **kwargs) self._pulseaudio_sanitizer = PulseAudioSanitizer() if self.get_option("leaks"): self._leakdetector = LeakDetectorValgrind(self._executive, self._filesystem, self.results_directory()) if not self.get_option("wrapper"): raise ValueError('use --wrapper=\"valgrind\" for memory leak detection on GTK') if self._should_use_jhbuild(): self._jhbuild_wrapper = [self.path_from_webkit_base('Tools', 'jhbuild', 'jhbuild-wrapper'), '--gtk', 'run'] if self.get_option('wrapper'): self.set_option('wrapper', ' '.join(self._jhbuild_wrapper) + ' ' + self.get_option('wrapper')) else: self.set_option_default('wrapper', ' '.join(self._jhbuild_wrapper)) def _built_executables_path(self, *path): return self._build_path(*(('bin',) + path)) def _built_libraries_path(self, *path): return self._build_path(*(('lib',) + path)) def _port_flag_for_scripts(self): return "--gtk" @memoized def _driver_class(self): if os.environ.get("WAYLAND_DISPLAY"): return WestonDriver if os.environ.get("USE_NATIVE_XDISPLAY"): return XorgDriver return XvfbDriver def supports_per_test_timeout(self): return True def default_timeout_ms(self): # Starting an application under Valgrind takes a lot longer than normal # so increase the timeout (empirically 10x is enough to avoid timeouts). multiplier = 10 if self.get_option("leaks") else 1 if self.get_option('configuration') == 'Debug': return multiplier * 12 * 1000 return multiplier * 6 * 1000 def driver_stop_timeout(self): if self.get_option("leaks"): # Wait the default timeout time before killing the process in driver.stop(). return self.default_timeout_ms() return super(GtkPort, self).driver_stop_timeout() def setup_test_run(self): super(GtkPort, self).setup_test_run() self._pulseaudio_sanitizer.unload_pulseaudio_module() if self.get_option("leaks"): self._leakdetector.clean_leaks_files_from_results_directory() def clean_up_test_run(self): super(GtkPort, self).clean_up_test_run() self._pulseaudio_sanitizer.restore_pulseaudio_module() def setup_environ_for_server(self, server_name=None): environment = super(GtkPort, self).setup_environ_for_server(server_name) environment['GSETTINGS_BACKEND'] = 'memory' environment['LIBOVERLAY_SCROLLBAR'] = '0' environment['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path('lib', 'libTestRunnerInjectedBundle.so') environment['TEST_RUNNER_TEST_PLUGIN_PATH'] = self._build_path('lib', 'plugins') environment['OWR_USE_TEST_SOURCES'] = '1' self._copy_value_from_environ_if_set(environment, 'WEBKIT_OUTPUTDIR') if self._driver_class() == XvfbDriver and self._should_use_jhbuild(): llvmpipe_libgl_path = self.host.executive.run_command(self._jhbuild_wrapper + ['printenv', 'LLVMPIPE_LIBGL_PATH'], error_handler=self.host.executive.ignore_error).strip() if os.path.exists(os.path.join(llvmpipe_libgl_path, "libGL.so")): # Force the Gallium llvmpipe software rasterizer environment['LD_LIBRARY_PATH'] = llvmpipe_libgl_path if os.environ.get('LD_LIBRARY_PATH'): environment['LD_LIBRARY_PATH'] += ':%s' % os.environ.get('LD_LIBRARY_PATH') else: _log.warning("Can't find Gallium llvmpipe driver. Try to run update-webkitgtk-libs") if self.get_option("leaks"): # Turn off GLib memory optimisations https://wiki.gnome.org/Valgrind. environment['G_SLICE'] = 'always-malloc' environment['G_DEBUG'] = 'gc-friendly' xmlfilename = "".join(("drt-%p-", uuid.uuid1().hex, "-leaks.xml")) xmlfile = os.path.join(self.results_directory(), xmlfilename) suppressionsfile = self.path_from_webkit_base('Tools', 'Scripts', 'valgrind', 'suppressions.txt') environment['VALGRIND_OPTS'] = \ "--tool=memcheck " \ "--num-callers=40 " \ "--demangle=no " \ "--trace-children=no " \ "--smc-check=all-non-file " \ "--leak-check=yes " \ "--leak-resolution=high " \ "--show-possibly-lost=no " \ "--show-reachable=no " \ "--leak-check=full " \ "--undef-value-errors=no " \ "--gen-suppressions=all " \ "--xml=yes " \ "--xml-file=%s " \ "--suppressions=%s" % (xmlfile, suppressionsfile) return environment def _generate_all_test_configurations(self): configurations = [] for build_type in self.ALL_BUILD_TYPES: configurations.append(TestConfiguration(version=self._version, architecture='x86', build_type=build_type)) return configurations def _path_to_driver(self): return self._built_executables_path(self.driver_name()) def _path_to_image_diff(self): return self._built_executables_path('ImageDiff') def _path_to_webcore_library(self): gtk_library_names = [ "libwebkitgtk-1.0.so", "libwebkitgtk-3.0.so", "libwebkit2gtk-1.0.so", ] for library in gtk_library_names: full_library = self._built_libraries_path(library) if self._filesystem.isfile(full_library): return full_library return None def _search_paths(self): search_paths = [] search_paths.append(self.port_name) search_paths.append('wk2') search_paths.extend(self.get_option("additional_platform_directory", [])) return search_paths def default_baseline_search_path(self): return map(self._webkit_baseline_path, self._search_paths()) def _port_specific_expectations_files(self): return [self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in reversed(self._search_paths())] def print_leaks_summary(self): if not self.get_option('leaks'): return # FIXME: This is a hack, but we don't have a better way to get this information from the workers yet # because we're in the manager process. leaks_files = self._leakdetector.leaks_files_in_results_directory() if not leaks_files: return self._leakdetector.parse_and_print_leaks_detail(leaks_files) def show_results_html_file(self, results_filename): self._run_script("run-minibrowser", [path.abspath_to_uri(self.host.platform, results_filename)]) def check_sys_deps(self, needs_http): return super(GtkPort, self).check_sys_deps(needs_http) and self._driver_class().check_driver(self) def _get_crash_log(self, name, pid, stdout, stderr, newer_than): name = "WebKitWebProcess" if name == "WebProcess" else name return GDBCrashLogGenerator(name, pid, newer_than, self._filesystem, self._path_to_driver).generate_crash_log(stdout, stderr) def test_expectations_file_position(self): # GTK port baseline search path is gtk -> wk2 -> generic (as gtk-wk2 and gtk baselines are merged), so port test expectations file is at third to last position. return 2 def build_webkit_command(self, build_style=None): command = super(GtkPort, self).build_webkit_command(build_style) command.extend(["--gtk", "--update-gtk"]) command.append(super(GtkPort, self).make_args()) return command def run_webkit_tests_command(self): command = super(GtkPort, self).run_webkit_tests_command() command.append("--gtk") return command
class GtkPort(Port): port_name = "gtk" def __init__(self, *args, **kwargs): super(GtkPort, self).__init__(*args, **kwargs) self._pulseaudio_sanitizer = PulseAudioSanitizer() def warn_if_bug_missing_in_test_expectations(self): return not self.get_option('webkit_test_runner') def _port_flag_for_scripts(self): return "--gtk" def _driver_class(self): return XvfbDriver def default_timeout_ms(self): if self.get_option('configuration') == 'Debug': return 12 * 1000 return 6 * 1000 def setup_test_run(self): super(GtkPort, self).setup_test_run() self._pulseaudio_sanitizer.unload_pulseaudio_module() def clean_up_test_run(self): super(GtkPort, self).clean_up_test_run() self._pulseaudio_sanitizer.restore_pulseaudio_module() def setup_environ_for_server(self, server_name=None): environment = super(GtkPort, self).setup_environ_for_server(server_name) environment['GTK_MODULES'] = 'gail' environment['GSETTINGS_BACKEND'] = 'memory' environment['LIBOVERLAY_SCROLLBAR'] = '0' environment['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path( 'Libraries', 'libTestRunnerInjectedBundle.la') environment['TEST_RUNNER_TEST_PLUGIN_PATH'] = self._build_path( 'TestNetscapePlugin', '.libs') environment['WEBKIT_INSPECTOR_PATH'] = self._build_path( 'Programs', 'resources', 'inspector') environment['AUDIO_RESOURCES_PATH'] = self.path_from_webkit_base( 'Source', 'WebCore', 'platform', 'audio', 'resources') self._copy_value_from_environ_if_set(environment, 'WEBKIT_OUTPUTDIR') return environment def _generate_all_test_configurations(self): configurations = [] for build_type in self.ALL_BUILD_TYPES: configurations.append( TestConfiguration(version=self._version, architecture='x86', build_type=build_type)) return configurations def _path_to_driver(self): return self._build_path('Programs', self.driver_name()) def _path_to_image_diff(self): return self._build_path('Programs', 'ImageDiff') def _path_to_webcore_library(self): gtk_library_names = [ "libwebkitgtk-1.0.so", "libwebkitgtk-3.0.so", "libwebkit2gtk-1.0.so", ] for library in gtk_library_names: full_library = self._build_path(".libs", library) if self._filesystem.isfile(full_library): return full_library return None def _search_paths(self): search_paths = [] if self.get_option('webkit_test_runner'): search_paths.extend([self.port_name + '-wk2', 'wk2']) else: search_paths.append(self.port_name + '-wk1') search_paths.append(self.port_name) search_paths.extend( self.get_option("additional_platform_directory", [])) return search_paths def default_baseline_search_path(self): return map(self._webkit_baseline_path, self._search_paths()) def _port_specific_expectations_files(self): return [ self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in reversed(self._search_paths()) ] # FIXME: We should find a way to share this implmentation with Gtk, # or teach run-launcher how to call run-safari and move this down to Port. def show_results_html_file(self, results_filename): run_launcher_args = ["file://%s" % results_filename] if self.get_option('webkit_test_runner'): run_launcher_args.append('-2') # FIXME: old-run-webkit-tests also added ["-graphicssystem", "raster", "-style", "windows"] # FIXME: old-run-webkit-tests converted results_filename path for cygwin. self._run_script("run-launcher", run_launcher_args) def check_sys_deps(self, needs_http): return super( GtkPort, self).check_sys_deps(needs_http) and XvfbDriver.check_xvfb(self) def _get_gdb_output(self, coredump_path): cmd = [ 'gdb', '-ex', 'thread apply all bt 1024', '--batch', str(self._path_to_driver()), coredump_path ] proc = subprocess.Popen(cmd, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = proc.communicate() errors = [ l.strip().decode('utf8', 'ignore') for l in stderr.splitlines() ] return (stdout.decode('utf8', 'ignore'), errors) def _get_crash_log(self, name, pid, stdout, stderr, newer_than): pid_representation = str(pid or '<unknown>') log_directory = os.environ.get("WEBKIT_CORE_DUMPS_DIRECTORY") errors = [] crash_log = '' expected_crash_dump_filename = "core-pid_%s-_-process_%s" % ( pid_representation, name) def match_filename(filesystem, directory, filename): if pid: return filename == expected_crash_dump_filename return filename.find(name) > -1 if log_directory: dumps = self._filesystem.files_under(log_directory, file_filter=match_filename) if dumps: # Get the most recent coredump matching the pid and/or process name. coredump_path = list(reversed(sorted(dumps)))[0] if not newer_than or self._filesystem.mtime( coredump_path) > newer_than: crash_log, errors = self._get_gdb_output(coredump_path) stderr_lines = errors + (stderr or '<empty>').decode( 'utf8', 'ignore').splitlines() errors_str = '\n'.join(('STDERR: ' + l) for l in stderr_lines) if not crash_log: if not log_directory: log_directory = "/path/to/coredumps" core_pattern = os.path.join(log_directory, "core-pid_%p-_-process_%e") crash_log = """\ Coredump %(expected_crash_dump_filename)s not found. To enable crash logs: - run this command as super-user: echo "%(core_pattern)s" > /proc/sys/kernel/core_pattern - enable core dumps: ulimit -c unlimited - set the WEBKIT_CORE_DUMPS_DIRECTORY environment variable: export WEBKIT_CORE_DUMPS_DIRECTORY=%(log_directory)s """ % locals() return (stderr, """\ Crash log for %(name)s (pid %(pid_representation)s): %(crash_log)s %(errors_str)s""" % locals())
class EflPort(Port): port_name = "efl" def __init__(self, *args, **kwargs): super(EflPort, self).__init__(*args, **kwargs) self._jhbuild_wrapper_path = [self.path_from_webkit_base("Tools", "jhbuild", "jhbuild-wrapper"), "--efl", "run"] self.set_option_default("wrapper", " ".join(self._jhbuild_wrapper_path)) self.webprocess_cmd_prefix = self.get_option("webprocess_cmd_prefix") self._pulseaudio_sanitizer = PulseAudioSanitizer() def _port_flag_for_scripts(self): return "--efl" def setup_test_run(self): super(EflPort, self).setup_test_run() self._pulseaudio_sanitizer.unload_pulseaudio_module() def setup_environ_for_server(self, server_name=None): env = super(EflPort, self).setup_environ_for_server(server_name) # If DISPLAY environment variable is unset in the system # e.g. on build bot, remove DISPLAY variable from the dictionary if not "DISPLAY" in os.environ: del env["DISPLAY"] env["TEST_RUNNER_INJECTED_BUNDLE_FILENAME"] = self._build_path("lib", "libTestRunnerInjectedBundle.so") env["TEST_RUNNER_PLUGIN_PATH"] = self._build_path("lib") # Silence GIO warnings about using the "memory" GSettings backend. env["GSETTINGS_BACKEND"] = "memory" if self.webprocess_cmd_prefix: env["WEB_PROCESS_CMD_PREFIX"] = self.webprocess_cmd_prefix return env def default_timeout_ms(self): # Tests run considerably slower under gdb # or valgrind. if self.get_option("webprocess_cmd_prefix"): return 350 * 1000 return super(EflPort, self).default_timeout_ms() def clean_up_test_run(self): super(EflPort, self).clean_up_test_run() self._pulseaudio_sanitizer.restore_pulseaudio_module() def _generate_all_test_configurations(self): return [ TestConfiguration(version=self._version, architecture="x86", build_type=build_type) for build_type in self.ALL_BUILD_TYPES ] def _driver_class(self): return XvfbDriver def _path_to_driver(self): return self._build_path("bin", self.driver_name()) def _path_to_image_diff(self): return self._build_path("bin", "ImageDiff") def _image_diff_command(self, *args, **kwargs): return self._jhbuild_wrapper_path + super(EflPort, self)._image_diff_command(*args, **kwargs) def _path_to_webcore_library(self): static_path = self._build_path("lib", "libwebcore_efl.a") dyn_path = self._build_path("lib", "libwebcore_efl.so") return static_path if self._filesystem.exists(static_path) else dyn_path def _search_paths(self): search_paths = [] if self.get_option("webkit_test_runner"): search_paths.append(self.port_name + "-wk2") search_paths.append("wk2") else: search_paths.append(self.port_name + "-wk1") search_paths.append(self.port_name) return search_paths def default_baseline_search_path(self): return map(self._webkit_baseline_path, self._search_paths()) def _port_specific_expectations_files(self): # FIXME: We should be able to use the default algorithm here. return list( reversed( [self._filesystem.join(self._webkit_baseline_path(p), "TestExpectations") for p in self._search_paths()] ) ) def show_results_html_file(self, results_filename): # FIXME: We should find a way to share this implmentation with Gtk, # or teach run-launcher how to call run-safari and move this down to WebKitPort. run_launcher_args = ["file://%s" % results_filename] if self.get_option("webkit_test_runner"): run_launcher_args.append("-2") # FIXME: old-run-webkit-tests also added ["-graphicssystem", "raster", "-style", "windows"] # FIXME: old-run-webkit-tests converted results_filename path for cygwin. self._run_script("run-launcher", run_launcher_args) def check_sys_deps(self, needs_http): return super(EflPort, self).check_sys_deps(needs_http) and XvfbDriver.check_xvfb(self)
class GtkPort(Port): port_name = "gtk" def __init__(self, *args, **kwargs): super(GtkPort, self).__init__(*args, **kwargs) self._pulseaudio_sanitizer = PulseAudioSanitizer() if self.get_option("leaks"): self._leakdetector = LeakDetectorValgrind(self._executive, self._filesystem, self.results_directory()) if not self.get_option("wrapper"): raise ValueError( 'use --wrapper=\"valgrind\" for memory leak detection on GTK' ) def _built_executables_path(self, *path): return self._build_path(*(('bin', ) + path)) def _built_libraries_path(self, *path): return self._build_path(*(('lib', ) + path)) def warn_if_bug_missing_in_test_expectations(self): return not self.get_option('webkit_test_runner') def _port_flag_for_scripts(self): return "--gtk" @memoized def _driver_class(self): if os.environ.get("WAYLAND_DISPLAY"): return WestonDriver return XvfbDriver def default_timeout_ms(self): # Starting an application under Valgrind takes a lot longer than normal # so increase the timeout (empirically 10x is enough to avoid timeouts). multiplier = 10 if self.get_option("leaks") else 1 if self.get_option('configuration') == 'Debug': return multiplier * 12 * 1000 return multiplier * 6 * 1000 def driver_stop_timeout(self): if self.get_option("leaks"): # Wait the default timeout time before killing the process in driver.stop(). return self.default_timeout_ms() return super(GtkPort, self).driver_stop_timeout() def setup_test_run(self): super(GtkPort, self).setup_test_run() self._pulseaudio_sanitizer.unload_pulseaudio_module() if self.get_option("leaks"): self._leakdetector.clean_leaks_files_from_results_directory() def clean_up_test_run(self): super(GtkPort, self).clean_up_test_run() self._pulseaudio_sanitizer.restore_pulseaudio_module() def setup_environ_for_server(self, server_name=None): environment = super(GtkPort, self).setup_environ_for_server(server_name) environment['GSETTINGS_BACKEND'] = 'memory' environment['LIBOVERLAY_SCROLLBAR'] = '0' environment['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path( 'lib', 'libTestRunnerInjectedBundle.so') environment['TEST_RUNNER_TEST_PLUGIN_PATH'] = self._build_path('lib') environment['AUDIO_RESOURCES_PATH'] = self.path_from_webkit_base( 'Source', 'WebCore', 'platform', 'audio', 'resources') self._copy_value_from_environ_if_set(environment, 'WEBKIT_OUTPUTDIR') if self.get_option("leaks"): # Turn off GLib memory optimisations https://wiki.gnome.org/Valgrind. environment['G_SLICE'] = 'always-malloc' environment['G_DEBUG'] = 'gc-friendly' xmlfilename = "".join(("drt-%p-", uuid.uuid1().hex, "-leaks.xml")) xmlfile = os.path.join(self.results_directory(), xmlfilename) suppressionsfile = self.path_from_webkit_base( 'Tools', 'Scripts', 'valgrind', 'suppressions.txt') environment['VALGRIND_OPTS'] = \ "--tool=memcheck " \ "--num-callers=40 " \ "--demangle=no " \ "--trace-children=no " \ "--smc-check=all-non-file " \ "--leak-check=yes " \ "--leak-resolution=high " \ "--show-possibly-lost=no " \ "--show-reachable=no " \ "--leak-check=full " \ "--undef-value-errors=no " \ "--gen-suppressions=all " \ "--xml=yes " \ "--xml-file=%s " \ "--suppressions=%s" % (xmlfile, suppressionsfile) return environment def _generate_all_test_configurations(self): configurations = [] for build_type in self.ALL_BUILD_TYPES: configurations.append( TestConfiguration(version=self._version, architecture='x86', build_type=build_type)) return configurations def _path_to_driver(self): return self._built_executables_path(self.driver_name()) def _path_to_image_diff(self): return self._built_executables_path('ImageDiff') def _path_to_webcore_library(self): gtk_library_names = [ "libwebkitgtk-1.0.so", "libwebkitgtk-3.0.so", "libwebkit2gtk-1.0.so", ] for library in gtk_library_names: full_library = self._built_libraries_path(library) if self._filesystem.isfile(full_library): return full_library return None def _search_paths(self): search_paths = [] if self.get_option('webkit_test_runner'): search_paths.extend([self.port_name + '-wk2', 'wk2']) else: search_paths.append(self.port_name + '-wk1') search_paths.append(self.port_name) search_paths.extend( self.get_option("additional_platform_directory", [])) return search_paths def default_baseline_search_path(self): return map(self._webkit_baseline_path, self._search_paths()) def _port_specific_expectations_files(self): return [ self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in reversed(self._search_paths()) ] def print_leaks_summary(self): if not self.get_option('leaks'): return # FIXME: This is a hack, but we don't have a better way to get this information from the workers yet # because we're in the manager process. leaks_files = self._leakdetector.leaks_files_in_results_directory() if not leaks_files: return self._leakdetector.parse_and_print_leaks_detail(leaks_files) # FIXME: We should find a way to share this implmentation with Gtk, # or teach run-launcher how to call run-safari and move this down to Port. def show_results_html_file(self, results_filename): run_launcher_args = ["file://%s" % results_filename] # FIXME: old-run-webkit-tests also added ["-graphicssystem", "raster", "-style", "windows"] # FIXME: old-run-webkit-tests converted results_filename path for cygwin. self._run_script("run-launcher", run_launcher_args) def check_sys_deps(self, needs_http): return super(GtkPort, self).check_sys_deps( needs_http) and self._driver_class().check_driver(self) def _get_crash_log(self, name, pid, stdout, stderr, newer_than): return GDBCrashLogGenerator(name, pid, newer_than, self._filesystem, self._path_to_driver).generate_crash_log( stdout, stderr) def build_webkit_command(self, build_style=None): command = super(GtkPort, self).build_webkit_command(build_style) command.extend(["--gtk", "--update-gtk"]) if self.get_option('webkit_test_runner'): command.append("--no-webkit1") else: command.append("--no-webkit2") command.append(super(GtkPort, self).make_args()) return command def run_webkit_tests_command(self): command = super(GtkPort, self).run_webkit_tests_command() command.append("--gtk") if self.get_option('webkit_test_runner'): command.append("-2") return command
class NixPort(Port): port_name = 'nix' def _wk2_port_name(self): return 'nix' @classmethod def determine_full_port_name(cls, host, options, port_name): """Determine the port name based on host and options values.""" # Currently the only "port" instance supported by Nix is "nix". Reimplementing # this method avoids changing port name to nix-wk2, which is the default # behavior in base.py. return port_name def __init__(self, *args, **kwargs): super(NixPort, self).__init__(*args, **kwargs) self._jhbuild_wrapper_path = self.path_from_webkit_base('Tools', 'nix', 'run-with-jhbuild') self.set_option_default('wrapper', self._jhbuild_wrapper_path) self.set_option_default('webkit_test_runner', True) self.webprocess_cmd_prefix = self.get_option('webprocess_cmd_prefix') self._pulseaudio_sanitizer = PulseAudioSanitizer() def _port_flag_for_scripts(self): return "--nix" def setup_test_run(self): self._pulseaudio_sanitizer.unload_pulseaudio_module() def setup_environ_for_server(self, server_name=None): env = super(NixPort, self).setup_environ_for_server(server_name) # If DISPLAY environment variable is unset in the system # e.g. on build bot, remove DISPLAY variable from the dictionary if not 'DISPLAY' in os.environ: del env['DISPLAY'] env['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path('lib', 'libTestRunnerInjectedBundle.so') env['TEST_RUNNER_PLUGIN_PATH'] = self._build_path('lib') if self.webprocess_cmd_prefix: env['WEB_PROCESS_CMD_PREFIX'] = self.webprocess_cmd_prefix #env['XDG_CACHE_HOME'] = str(self._filesystem.mkdtemp(prefix='%s-Efl-CacheDir-' % self.driver_name())) #env['XDG_DATA_HOME'] = str(self._filesystem.mkdtemp(prefix='%s-Efl-DataDir-' % self.driver_name())) return env def default_timeout_ms(self): # Tests run considerably slower under gdb # or valgrind. if self.get_option('webprocess_cmd_prefix'): return 350 * 1000 return super(NixPort, self).default_timeout_ms() def clean_up_test_run(self): super(NixPort, self).clean_up_test_run() self._pulseaudio_sanitizer.restore_pulseaudio_module() def _generate_all_test_configurations(self): return [TestConfiguration(version=self._version, architecture='x86', build_type=build_type) for build_type in self.ALL_BUILD_TYPES] def _path_to_driver(self): return self._build_path('bin', self.driver_name()) def _path_to_image_diff(self): return self._build_path('bin', 'ImageDiff') def _image_diff_command(self, *args, **kwargs): return [self._jhbuild_wrapper_path] + super(NixPort, self)._image_diff_command(*args, **kwargs) def _path_to_webcore_library(self): static_path = self._build_path('lib', 'libwebcore_nix.a') dyn_path = self._build_path('lib', 'libwebcore_nix.so') return static_path if self._filesystem.exists(static_path) else dyn_path def _search_paths(self): search_paths = [] search_paths.append(self.port_name) return search_paths def show_results_html_file(self, results_filename): # FIXME: We should find a way to share this implmentation with Gtk, # or teach run-launcher how to call run-safari and move this down to WebKitPort. run_launcher_args = ["file://%s" % results_filename] # FIXME: old-run-webkit-tests also added ["-graphicssystem", "raster", "-style", "windows"] # FIXME: old-run-webkit-tests converted results_filename path for cygwin. self._run_script("run-launcher", run_launcher_args) def _port_specific_expectations_files(self): paths = self._search_paths() if self.get_option('webkit_test_runner'): paths.append('wk2') return list(([self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in paths]))
class EflPort(Port): port_name = 'efl' def __init__(self, *args, **kwargs): super(EflPort, self).__init__(*args, **kwargs) self._jhbuild_wrapper = [self.path_from_webkit_base('Tools', 'jhbuild', 'jhbuild-wrapper'), '--efl', 'run'] self.set_option_default('wrapper', ' '.join(self._jhbuild_wrapper)) self.webprocess_cmd_prefix = self.get_option('webprocess_cmd_prefix') self._pulseaudio_sanitizer = PulseAudioSanitizer() def _port_flag_for_scripts(self): return "--efl" def setup_test_run(self, device_class=None): super(EflPort, self).setup_test_run(device_class) self._pulseaudio_sanitizer.unload_pulseaudio_module() def setup_environ_for_server(self, server_name=None): env = super(EflPort, self).setup_environ_for_server(server_name) # If DISPLAY environment variable is unset in the system # e.g. on build bot, remove DISPLAY variable from the dictionary if not 'DISPLAY' in os.environ: del env['DISPLAY'] if 'ACCESSIBILITY_EAIL_LIBRARY_PATH' in os.environ: env['ACCESSIBILITY_EAIL_LIBRARY_PATH'] = os.environ['ACCESSIBILITY_EAIL_LIBRARY_PATH'] env['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path('lib', 'libTestRunnerInjectedBundle.so') env['TEST_RUNNER_PLUGIN_PATH'] = self._build_path('lib', 'plugins') # Silence GIO warnings about using the "memory" GSettings backend. env['GSETTINGS_BACKEND'] = 'memory' if self.webprocess_cmd_prefix: env['WEB_PROCESS_CMD_PREFIX'] = self.webprocess_cmd_prefix return env def supports_per_test_timeout(self): return True def default_timeout_ms(self): # Tests run considerably slower under gdb # or valgrind. if self.get_option('webprocess_cmd_prefix'): return 350 * 1000 return super(EflPort, self).default_timeout_ms() def clean_up_test_run(self): super(EflPort, self).clean_up_test_run() self._pulseaudio_sanitizer.restore_pulseaudio_module() def _generate_all_test_configurations(self): return [TestConfiguration(version=self._version, architecture='x86', build_type=build_type) for build_type in self.ALL_BUILD_TYPES] def _driver_class(self): if os.environ.get("USE_NATIVE_XDISPLAY"): return XorgDriver return XvfbDriver def _path_to_driver(self): return self._build_path('bin', self.driver_name()) def _path_to_image_diff(self): return self._build_path('bin', 'ImageDiff') def _image_diff_command(self, *args, **kwargs): return self._jhbuild_wrapper + super(EflPort, self)._image_diff_command(*args, **kwargs) def _path_to_webcore_library(self): static_path = self._build_path('lib', 'libwebcore_efl.a') dyn_path = self._build_path('lib', 'libwebcore_efl.so') return static_path if self._filesystem.exists(static_path) else dyn_path def _search_paths(self): search_paths = [] search_paths.append(self.port_name) search_paths.append('wk2') return search_paths def default_baseline_search_path(self): return map(self._webkit_baseline_path, self._search_paths()) def _port_specific_expectations_files(self): # FIXME: We should be able to use the default algorithm here. return list(reversed([self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in self._search_paths()])) def show_results_html_file(self, results_filename): self._run_script("run-minibrowser", [path.abspath_to_uri(self.host.platform, results_filename)]) def check_sys_deps(self, needs_http): return super(EflPort, self).check_sys_deps(needs_http) and self._driver_class().check_driver(self) def build_webkit_command(self, build_style=None): command = super(EflPort, self).build_webkit_command(build_style) command.extend(["--efl", "--update-efl"]) command.append(super(EflPort, self).make_args()) return command def _get_crash_log(self, name, pid, stdout, stderr, newer_than): return GDBCrashLogGenerator(name, pid, newer_than, self._filesystem, self.path_to_script("process-linux-coredump"), self._path_to_driver).generate_crash_log(stdout, stderr) def test_expectations_file_position(self): # EFL port baseline search path is efl -> wk2 -> generic (as efl-wk2 and efl baselines are merged), so port test expectations file is at third to last position. return 2
class GtkPort(Port): port_name = "gtk" def __init__(self, *args, **kwargs): super(GtkPort, self).__init__(*args, **kwargs) self._pulseaudio_sanitizer = PulseAudioSanitizer() if self.get_option("leaks"): if not self.get_option("wrapper"): raise ValueError('use --wrapper=\"valgrind\" for memory leak detection on GTK') def warn_if_bug_missing_in_test_expectations(self): return not self.get_option('webkit_test_runner') def _port_flag_for_scripts(self): return "--gtk" @memoized def _driver_class(self): if os.environ.get("WAYLAND_DISPLAY"): return WestonDriver return XvfbDriver def default_timeout_ms(self): # Starting an application under Valgrind takes a lot longer than normal # so increase the timeout (empirically 10x is enough to avoid timeouts). multiplier = 10 if self.get_option("leaks") else 1 if self.get_option('configuration') == 'Debug': return multiplier * 12 * 1000 return multiplier * 6 * 1000 def driver_stop_timeout(self): if self.get_option("leaks"): # Wait the default timeout time before killing the process in driver.stop(). return self.default_timeout_ms() return super(GtkPort, self).driver_stop_timeout() def setup_test_run(self): super(GtkPort, self).setup_test_run() self._pulseaudio_sanitizer.unload_pulseaudio_module() def clean_up_test_run(self): super(GtkPort, self).clean_up_test_run() self._pulseaudio_sanitizer.restore_pulseaudio_module() def setup_environ_for_server(self, server_name=None): environment = super(GtkPort, self).setup_environ_for_server(server_name) environment['GTK_MODULES'] = 'gail' environment['GSETTINGS_BACKEND'] = 'memory' environment['LIBOVERLAY_SCROLLBAR'] = '0' environment['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path('Libraries', 'libTestRunnerInjectedBundle.la') environment['TEST_RUNNER_TEST_PLUGIN_PATH'] = self._build_path('TestNetscapePlugin', '.libs') environment['WEBKIT_INSPECTOR_PATH'] = self._build_path('Programs', 'resources', 'inspector') environment['AUDIO_RESOURCES_PATH'] = self.path_from_webkit_base('Source', 'WebCore', 'platform', 'audio', 'resources') self._copy_value_from_environ_if_set(environment, 'WEBKIT_OUTPUTDIR') if self.get_option("leaks"): # Turn off GLib memory optimisations https://wiki.gnome.org/Valgrind. environment['G_SLICE'] = 'always-malloc' environment['G_DEBUG'] = 'gc-friendly' xmlfilename = "".join(("drt-%p-", uuid.uuid1().hex, "-leaks.xml")) xmlfile = os.path.join(self.results_directory(), xmlfilename) suppressionsfile = self.path_from_webkit_base('Tools', 'Scripts', 'valgrind', 'suppressions.txt') environment['VALGRIND_OPTS'] = \ "--tool=memcheck " \ "--num-callers=40 " \ "--demangle=no " \ "--trace-children=no " \ "--smc-check=all-non-file " \ "--leak-check=yes " \ "--leak-resolution=high " \ "--show-possibly-lost=no " \ "--show-reachable=no " \ "--leak-check=full " \ "--undef-value-errors=no " \ "--gen-suppressions=all " \ "--xml=yes " \ "--xml-file=\"%s\" " \ "--suppressions=%s" % (xmlfile, suppressionsfile) return environment def _generate_all_test_configurations(self): configurations = [] for build_type in self.ALL_BUILD_TYPES: configurations.append(TestConfiguration(version=self._version, architecture='x86', build_type=build_type)) return configurations def _path_to_driver(self): return self._build_path('Programs', self.driver_name()) def _path_to_image_diff(self): return self._build_path('Programs', 'ImageDiff') def _path_to_webcore_library(self): gtk_library_names = [ "libwebkitgtk-1.0.so", "libwebkitgtk-3.0.so", "libwebkit2gtk-1.0.so", ] for library in gtk_library_names: full_library = self._build_path(".libs", library) if self._filesystem.isfile(full_library): return full_library return None def _search_paths(self): search_paths = [] if self.get_option('webkit_test_runner'): search_paths.extend([self.port_name + '-wk2', 'wk2']) else: search_paths.append(self.port_name + '-wk1') search_paths.append(self.port_name) search_paths.extend(self.get_option("additional_platform_directory", [])) return search_paths def default_baseline_search_path(self): return map(self._webkit_baseline_path, self._search_paths()) def _port_specific_expectations_files(self): return [self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in reversed(self._search_paths())] # FIXME: We should find a way to share this implmentation with Gtk, # or teach run-launcher how to call run-safari and move this down to Port. def show_results_html_file(self, results_filename): run_launcher_args = ["file://%s" % results_filename] if self.get_option('webkit_test_runner'): run_launcher_args.append('-2') # FIXME: old-run-webkit-tests also added ["-graphicssystem", "raster", "-style", "windows"] # FIXME: old-run-webkit-tests converted results_filename path for cygwin. self._run_script("run-launcher", run_launcher_args) def check_sys_deps(self, needs_http): return super(GtkPort, self).check_sys_deps(needs_http) and self._driver_class().check_driver(self) def _get_gdb_output(self, coredump_path): cmd = ['gdb', '-ex', 'thread apply all bt 1024', '--batch', str(self._path_to_driver()), coredump_path] proc = subprocess.Popen(cmd, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = proc.communicate() errors = [l.strip().decode('utf8', 'ignore') for l in stderr.splitlines()] return (stdout.decode('utf8', 'ignore'), errors) def _get_crash_log(self, name, pid, stdout, stderr, newer_than): pid_representation = str(pid or '<unknown>') log_directory = os.environ.get("WEBKIT_CORE_DUMPS_DIRECTORY") errors = [] crash_log = '' expected_crash_dump_filename = "core-pid_%s-_-process_%s" % (pid_representation, name) def match_filename(filesystem, directory, filename): if pid: return filename == expected_crash_dump_filename return filename.find(name) > -1 if log_directory: dumps = self._filesystem.files_under(log_directory, file_filter=match_filename) if dumps: # Get the most recent coredump matching the pid and/or process name. coredump_path = list(reversed(sorted(dumps)))[0] if not newer_than or self._filesystem.mtime(coredump_path) > newer_than: crash_log, errors = self._get_gdb_output(coredump_path) stderr_lines = errors + (stderr or '<empty>').decode('utf8', 'ignore').splitlines() errors_str = '\n'.join(('STDERR: ' + l) for l in stderr_lines) if not crash_log: if not log_directory: log_directory = "/path/to/coredumps" core_pattern = os.path.join(log_directory, "core-pid_%p-_-process_%e") crash_log = """\ Coredump %(expected_crash_dump_filename)s not found. To enable crash logs: - run this command as super-user: echo "%(core_pattern)s" > /proc/sys/kernel/core_pattern - enable core dumps: ulimit -c unlimited - set the WEBKIT_CORE_DUMPS_DIRECTORY environment variable: export WEBKIT_CORE_DUMPS_DIRECTORY=%(log_directory)s """ % locals() return (stderr, """\ Crash log for %(name)s (pid %(pid_representation)s): %(crash_log)s %(errors_str)s""" % locals())
class GtkPort(Port): port_name = "gtk" def __init__(self, *args, **kwargs): super(GtkPort, self).__init__(*args, **kwargs) self._pulseaudio_sanitizer = PulseAudioSanitizer() if self.get_option("leaks"): if not self.get_option("wrapper"): raise ValueError( 'use --wrapper=\"valgrind\" for memory leak detection on GTK' ) def warn_if_bug_missing_in_test_expectations(self): return not self.get_option('webkit_test_runner') def _port_flag_for_scripts(self): return "--gtk" @memoized def _driver_class(self): if os.environ.get("WAYLAND_DISPLAY"): return WestonDriver return XvfbDriver def default_timeout_ms(self): # Starting an application under Valgrind takes a lot longer than normal # so increase the timeout (empirically 10x is enough to avoid timeouts). multiplier = 10 if self.get_option("leaks") else 1 if self.get_option('configuration') == 'Debug': return multiplier * 12 * 1000 return multiplier * 6 * 1000 def driver_stop_timeout(self): if self.get_option("leaks"): # Wait the default timeout time before killing the process in driver.stop(). return self.default_timeout_ms() return super(GtkPort, self).driver_stop_timeout() def setup_test_run(self): super(GtkPort, self).setup_test_run() self._pulseaudio_sanitizer.unload_pulseaudio_module() def clean_up_test_run(self): super(GtkPort, self).clean_up_test_run() self._pulseaudio_sanitizer.restore_pulseaudio_module() def setup_environ_for_server(self, server_name=None): environment = super(GtkPort, self).setup_environ_for_server(server_name) environment['GTK_MODULES'] = 'gail' environment['GSETTINGS_BACKEND'] = 'memory' environment['LIBOVERLAY_SCROLLBAR'] = '0' environment['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path( 'Libraries', 'libTestRunnerInjectedBundle.la') environment['TEST_RUNNER_TEST_PLUGIN_PATH'] = self._build_path( 'TestNetscapePlugin', '.libs') environment['WEBKIT_INSPECTOR_PATH'] = self._build_path( 'Programs', 'resources', 'inspector') environment['AUDIO_RESOURCES_PATH'] = self.path_from_webkit_base( 'Source', 'WebCore', 'platform', 'audio', 'resources') self._copy_value_from_environ_if_set(environment, 'WEBKIT_OUTPUTDIR') if self.get_option("leaks"): # Turn off GLib memory optimisations https://wiki.gnome.org/Valgrind. environment['G_SLICE'] = 'always-malloc' environment['G_DEBUG'] = 'gc-friendly' xmlfilename = "".join(("drt-%p-", uuid.uuid1().hex, "-leaks.xml")) xmlfile = os.path.join(self.results_directory(), xmlfilename) suppressionsfile = self.path_from_webkit_base( 'Tools', 'Scripts', 'valgrind', 'suppressions.txt') environment['VALGRIND_OPTS'] = \ "--tool=memcheck " \ "--num-callers=40 " \ "--demangle=no " \ "--trace-children=no " \ "--smc-check=all-non-file " \ "--leak-check=yes " \ "--leak-resolution=high " \ "--show-possibly-lost=no " \ "--show-reachable=no " \ "--leak-check=full " \ "--undef-value-errors=no " \ "--gen-suppressions=all " \ "--xml=yes " \ "--xml-file=\"%s\" " \ "--suppressions=%s" % (xmlfile, suppressionsfile) return environment def _generate_all_test_configurations(self): configurations = [] for build_type in self.ALL_BUILD_TYPES: configurations.append( TestConfiguration(version=self._version, architecture='x86', build_type=build_type)) return configurations def _path_to_driver(self): return self._build_path('Programs', self.driver_name()) def _path_to_image_diff(self): return self._build_path('Programs', 'ImageDiff') def _path_to_webcore_library(self): gtk_library_names = [ "libwebkitgtk-1.0.so", "libwebkitgtk-3.0.so", "libwebkit2gtk-1.0.so", ] for library in gtk_library_names: full_library = self._build_path(".libs", library) if self._filesystem.isfile(full_library): return full_library return None def _search_paths(self): search_paths = [] if self.get_option('webkit_test_runner'): search_paths.extend([self.port_name + '-wk2', 'wk2']) else: search_paths.append(self.port_name + '-wk1') search_paths.append(self.port_name) search_paths.extend( self.get_option("additional_platform_directory", [])) return search_paths def default_baseline_search_path(self): return map(self._webkit_baseline_path, self._search_paths()) def _port_specific_expectations_files(self): return [ self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in reversed(self._search_paths()) ] # FIXME: We should find a way to share this implmentation with Gtk, # or teach run-launcher how to call run-safari and move this down to Port. def show_results_html_file(self, results_filename): run_launcher_args = ["file://%s" % results_filename] if self.get_option('webkit_test_runner'): run_launcher_args.append('-2') # FIXME: old-run-webkit-tests also added ["-graphicssystem", "raster", "-style", "windows"] # FIXME: old-run-webkit-tests converted results_filename path for cygwin. self._run_script("run-launcher", run_launcher_args) def check_sys_deps(self, needs_http): return super(GtkPort, self).check_sys_deps( needs_http) and self._driver_class().check_driver(self) def _get_gdb_output(self, coredump_path): cmd = [ 'gdb', '-ex', 'thread apply all bt 1024', '--batch', str(self._path_to_driver()), coredump_path ] proc = subprocess.Popen(cmd, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = proc.communicate() errors = [ l.strip().decode('utf8', 'ignore') for l in stderr.splitlines() ] return (stdout.decode('utf8', 'ignore'), errors) def _get_crash_log(self, name, pid, stdout, stderr, newer_than): pid_representation = str(pid or '<unknown>') log_directory = os.environ.get("WEBKIT_CORE_DUMPS_DIRECTORY") errors = [] crash_log = '' expected_crash_dump_filename = "core-pid_%s-_-process_%s" % ( pid_representation, name) def match_filename(filesystem, directory, filename): if pid: return filename == expected_crash_dump_filename return filename.find(name) > -1 if log_directory: dumps = self._filesystem.files_under(log_directory, file_filter=match_filename) if dumps: # Get the most recent coredump matching the pid and/or process name. coredump_path = list(reversed(sorted(dumps)))[0] if not newer_than or self._filesystem.mtime( coredump_path) > newer_than: crash_log, errors = self._get_gdb_output(coredump_path) stderr_lines = errors + (stderr or '<empty>').decode( 'utf8', 'ignore').splitlines() errors_str = '\n'.join(('STDERR: ' + l) for l in stderr_lines) if not crash_log: if not log_directory: log_directory = "/path/to/coredumps" core_pattern = os.path.join(log_directory, "core-pid_%p-_-process_%e") crash_log = """\ Coredump %(expected_crash_dump_filename)s not found. To enable crash logs: - run this command as super-user: echo "%(core_pattern)s" > /proc/sys/kernel/core_pattern - enable core dumps: ulimit -c unlimited - set the WEBKIT_CORE_DUMPS_DIRECTORY environment variable: export WEBKIT_CORE_DUMPS_DIRECTORY=%(log_directory)s """ % locals() return (stderr, """\ Crash log for %(name)s (pid %(pid_representation)s): %(crash_log)s %(errors_str)s""" % locals())
class GtkPort(Port): port_name = "gtk" def __init__(self, *args, **kwargs): super(GtkPort, self).__init__(*args, **kwargs) self._pulseaudio_sanitizer = PulseAudioSanitizer() if self.get_option("leaks"): self._leakdetector = LeakDetectorValgrind(self._executive, self._filesystem, self.results_directory()) if not self.get_option("wrapper"): raise ValueError('use --wrapper="valgrind" for memory leak detection on GTK') def _is_cmake_build(self): # Look for the autotools config.log file, which means that we # assume a CMake build (--gtk) when lacking evidence of either. return not os.path.exists(self._build_path("config.log")) def _built_executables_path(self, *path): if self._is_cmake_build(): return self._build_path(*(("bin",) + path)) else: return self._build_path(*(("Programs",) + path)) def _built_libraries_path(self, *path): if self._is_cmake_build(): return self._build_path(*(("lib",) + path)) else: return self._build_path(*((".libs",) + path)) def warn_if_bug_missing_in_test_expectations(self): return not self.get_option("webkit_test_runner") def _port_flag_for_scripts(self): if self._is_cmake_build(): return "--gtk" else: return "--gtkautotools" @memoized def _driver_class(self): if os.environ.get("WAYLAND_DISPLAY"): return WestonDriver return XvfbDriver def default_timeout_ms(self): # Starting an application under Valgrind takes a lot longer than normal # so increase the timeout (empirically 10x is enough to avoid timeouts). multiplier = 10 if self.get_option("leaks") else 1 if self.get_option("configuration") == "Debug": return multiplier * 12 * 1000 return multiplier * 6 * 1000 def driver_stop_timeout(self): if self.get_option("leaks"): # Wait the default timeout time before killing the process in driver.stop(). return self.default_timeout_ms() return super(GtkPort, self).driver_stop_timeout() def setup_test_run(self): super(GtkPort, self).setup_test_run() self._pulseaudio_sanitizer.unload_pulseaudio_module() if self.get_option("leaks"): self._leakdetector.clean_leaks_files_from_results_directory() def clean_up_test_run(self): super(GtkPort, self).clean_up_test_run() self._pulseaudio_sanitizer.restore_pulseaudio_module() def setup_environ_for_server(self, server_name=None): environment = super(GtkPort, self).setup_environ_for_server(server_name) environment["GSETTINGS_BACKEND"] = "memory" environment["LIBOVERLAY_SCROLLBAR"] = "0" if self._is_cmake_build(): environment["TEST_RUNNER_INJECTED_BUNDLE_FILENAME"] = self._build_path( "lib", "libTestRunnerInjectedBundle.so" ) environment["TEST_RUNNER_TEST_PLUGIN_PATH"] = self._build_path("lib") else: environment["TEST_RUNNER_INJECTED_BUNDLE_FILENAME"] = self._build_path( "Libraries", "libTestRunnerInjectedBundle.la" ) environment["TEST_RUNNER_TEST_PLUGIN_PATH"] = self._build_path("TestNetscapePlugin", ".libs") environment["AUDIO_RESOURCES_PATH"] = self.path_from_webkit_base( "Source", "WebCore", "platform", "audio", "resources" ) self._copy_value_from_environ_if_set(environment, "WEBKIT_OUTPUTDIR") if self.get_option("leaks"): # Turn off GLib memory optimisations https://wiki.gnome.org/Valgrind. environment["G_SLICE"] = "always-malloc" environment["G_DEBUG"] = "gc-friendly" xmlfilename = "".join(("drt-%p-", uuid.uuid1().hex, "-leaks.xml")) xmlfile = os.path.join(self.results_directory(), xmlfilename) suppressionsfile = self.path_from_webkit_base("Tools", "Scripts", "valgrind", "suppressions.txt") environment["VALGRIND_OPTS"] = ( "--tool=memcheck " "--num-callers=40 " "--demangle=no " "--trace-children=no " "--smc-check=all-non-file " "--leak-check=yes " "--leak-resolution=high " "--show-possibly-lost=no " "--show-reachable=no " "--leak-check=full " "--undef-value-errors=no " "--gen-suppressions=all " "--xml=yes " "--xml-file=%s " "--suppressions=%s" % (xmlfile, suppressionsfile) ) return environment def _generate_all_test_configurations(self): configurations = [] for build_type in self.ALL_BUILD_TYPES: configurations.append(TestConfiguration(version=self._version, architecture="x86", build_type=build_type)) return configurations def _path_to_driver(self): return self._built_executables_path(self.driver_name()) def _path_to_image_diff(self): return self._built_executables_path("ImageDiff") def _path_to_webcore_library(self): gtk_library_names = ["libwebkitgtk-1.0.so", "libwebkitgtk-3.0.so", "libwebkit2gtk-1.0.so"] for library in gtk_library_names: full_library = self._built_libraries_path(library) if self._filesystem.isfile(full_library): return full_library return None def _search_paths(self): search_paths = [] if self.get_option("webkit_test_runner"): search_paths.extend([self.port_name + "-wk2", "wk2"]) else: search_paths.append(self.port_name + "-wk1") search_paths.append(self.port_name) search_paths.extend(self.get_option("additional_platform_directory", [])) return search_paths def default_baseline_search_path(self): return map(self._webkit_baseline_path, self._search_paths()) def _port_specific_expectations_files(self): return [ self._filesystem.join(self._webkit_baseline_path(p), "TestExpectations") for p in reversed(self._search_paths()) ] def print_leaks_summary(self): if not self.get_option("leaks"): return # FIXME: This is a hack, but we don't have a better way to get this information from the workers yet # because we're in the manager process. leaks_files = self._leakdetector.leaks_files_in_results_directory() if not leaks_files: return self._leakdetector.parse_and_print_leaks_detail(leaks_files) # FIXME: We should find a way to share this implmentation with Gtk, # or teach run-launcher how to call run-safari and move this down to Port. def show_results_html_file(self, results_filename): run_launcher_args = ["file://%s" % results_filename] if self.get_option("webkit_test_runner"): run_launcher_args.append("-2") # FIXME: old-run-webkit-tests also added ["-graphicssystem", "raster", "-style", "windows"] # FIXME: old-run-webkit-tests converted results_filename path for cygwin. self._run_script("run-launcher", run_launcher_args) def check_sys_deps(self, needs_http): return super(GtkPort, self).check_sys_deps(needs_http) and self._driver_class().check_driver(self) def _get_crash_log(self, name, pid, stdout, stderr, newer_than): return GDBCrashLogGenerator(name, pid, newer_than, self._filesystem, self._path_to_driver).generate_crash_log( stdout, stderr ) def build_webkit_command(self, build_style=None): command = super(GtkPort, self).build_webkit_command(build_style) if self._is_cmake_build(): command.extend(["--gtk", "--update-gtk"]) else: command.extend(["--gtkautotools", "--update-gtk"]) if self.get_option("webkit_test_runner"): command.append("--no-webkit1") else: command.append("--no-webkit2") command.append(super(GtkPort, self).make_args()) return command def run_webkit_tests_command(self): command = super(GtkPort, self).run_webkit_tests_command() command.append("--gtk") if self.get_option("webkit_test_runner"): command.append("-2") return command
class GtkPort(Port): port_name = "gtk" def __init__(self, *args, **kwargs): super(GtkPort, self).__init__(*args, **kwargs) self._pulseaudio_sanitizer = PulseAudioSanitizer() def warn_if_bug_missing_in_test_expectations(self): return not self.get_option('webkit_test_runner') def _port_flag_for_scripts(self): return "--gtk" def _driver_class(self): return XvfbDriver def default_timeout_ms(self): if self.get_option('configuration') == 'Debug': return 12 * 1000 return 6 * 1000 def setup_test_run(self): super(GtkPort, self).setup_test_run() self._pulseaudio_sanitizer.unload_pulseaudio_module() def clean_up_test_run(self): super(GtkPort, self).clean_up_test_run() self._pulseaudio_sanitizer.restore_pulseaudio_module() def setup_environ_for_server(self, server_name=None): environment = super(GtkPort, self).setup_environ_for_server(server_name) environment['GTK_MODULES'] = 'gail' environment['GSETTINGS_BACKEND'] = 'memory' environment['LIBOVERLAY_SCROLLBAR'] = '0' environment['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path('Libraries', 'libTestRunnerInjectedBundle.la') environment['TEST_RUNNER_TEST_PLUGIN_PATH'] = self._build_path('TestNetscapePlugin', '.libs') environment['WEBKIT_INSPECTOR_PATH'] = self._build_path('Programs', 'resources', 'inspector') environment['AUDIO_RESOURCES_PATH'] = self.path_from_webkit_base('Source', 'WebCore', 'platform', 'audio', 'resources') self._copy_value_from_environ_if_set(environment, 'WEBKIT_OUTPUTDIR') return environment def _generate_all_test_configurations(self): configurations = [] for build_type in self.ALL_BUILD_TYPES: configurations.append(TestConfiguration(version=self._version, architecture='x86', build_type=build_type)) return configurations def _path_to_driver(self): return self._build_path('Programs', self.driver_name()) def _path_to_image_diff(self): return self._build_path('Programs', 'ImageDiff') def _path_to_webcore_library(self): gtk_library_names = [ "libwebkitgtk-1.0.so", "libwebkitgtk-3.0.so", "libwebkit2gtk-1.0.so", ] for library in gtk_library_names: full_library = self._build_path(".libs", library) if self._filesystem.isfile(full_library): return full_library return None def _search_paths(self): search_paths = [] if self.get_option('webkit_test_runner'): search_paths.extend([self.port_name + '-wk2', 'wk2']) else: search_paths.append(self.port_name + '-wk1') search_paths.append(self.port_name) search_paths.extend(self.get_option("additional_platform_directory", [])) return search_paths def default_baseline_search_path(self): return map(self._webkit_baseline_path, self._search_paths()) def _port_specific_expectations_files(self): return [self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in reversed(self._search_paths())] # FIXME: We should find a way to share this implmentation with Gtk, # or teach run-launcher how to call run-safari and move this down to Port. def show_results_html_file(self, results_filename): run_launcher_args = ["file://%s" % results_filename] if self.get_option('webkit_test_runner'): run_launcher_args.append('-2') # FIXME: old-run-webkit-tests also added ["-graphicssystem", "raster", "-style", "windows"] # FIXME: old-run-webkit-tests converted results_filename path for cygwin. self._run_script("run-launcher", run_launcher_args) def check_sys_deps(self, needs_http): return super(GtkPort, self).check_sys_deps(needs_http) and XvfbDriver.check_xvfb(self) def _get_gdb_output(self, coredump_path): cmd = ['gdb', '-ex', 'thread apply all bt 1024', '--batch', str(self._path_to_driver()), coredump_path] proc = subprocess.Popen(cmd, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = proc.communicate() errors = [l.strip().decode('utf8', 'ignore') for l in stderr.splitlines()] return (stdout.decode('utf8', 'ignore'), errors) def _get_crash_log(self, name, pid, stdout, stderr, newer_than): pid_representation = str(pid or '<unknown>') log_directory = os.environ.get("WEBKIT_CORE_DUMPS_DIRECTORY") errors = [] crash_log = '' expected_crash_dump_filename = "core-pid_%s-_-process_%s" % (pid_representation, name) def match_filename(filesystem, directory, filename): if pid: return filename == expected_crash_dump_filename return filename.find(name) > -1 if log_directory: dumps = self._filesystem.files_under(log_directory, file_filter=match_filename) if dumps: # Get the most recent coredump matching the pid and/or process name. coredump_path = list(reversed(sorted(dumps)))[0] if not newer_than or self._filesystem.mtime(coredump_path) > newer_than: crash_log, errors = self._get_gdb_output(coredump_path) stderr_lines = errors + (stderr or '<empty>').decode('utf8', 'ignore').splitlines() errors_str = '\n'.join(('STDERR: ' + l) for l in stderr_lines) if not crash_log: if not log_directory: log_directory = "/path/to/coredumps" core_pattern = os.path.join(log_directory, "core-pid_%p-_-process_%e") crash_log = """\ Coredump %(expected_crash_dump_filename)s not found. To enable crash logs: - run this command as super-user: echo "%(core_pattern)s" > /proc/sys/kernel/core_pattern - enable core dumps: ulimit -c unlimited - set the WEBKIT_CORE_DUMPS_DIRECTORY environment variable: export WEBKIT_CORE_DUMPS_DIRECTORY=%(log_directory)s """ % locals() return (stderr, """\ Crash log for %(name)s (pid %(pid_representation)s): %(crash_log)s %(errors_str)s""" % locals())
class NixPort(Port): port_name = 'nix' def _wk2_port_name(self): return 'nix' @classmethod def determine_full_port_name(cls, host, options, port_name): """Determine the port name based on host and options values.""" # Currently the only "port" instance supported by Nix is "nix". Reimplementing # this method avoids changing port name to nix-wk2, which is the default # behavior in base.py. return port_name def __init__(self, *args, **kwargs): super(NixPort, self).__init__(*args, **kwargs) self._jhbuild_wrapper_path = [ self.path_from_webkit_base('Tools', 'jhbuild', 'jhbuild-wrapper'), '--nix', 'run' ] self.set_option_default('wrapper', ' '.join(self._jhbuild_wrapper_path)) self.set_option_default('webkit_test_runner', True) self.webprocess_cmd_prefix = self.get_option('webprocess_cmd_prefix') self._pulseaudio_sanitizer = PulseAudioSanitizer() def _port_flag_for_scripts(self): return "--nix" def setup_test_run(self): self._pulseaudio_sanitizer.unload_pulseaudio_module() def setup_environ_for_server(self, server_name=None): env = super(NixPort, self).setup_environ_for_server(server_name) # If DISPLAY environment variable is unset in the system # e.g. on build bot, remove DISPLAY variable from the dictionary if not 'DISPLAY' in os.environ: del env['DISPLAY'] env['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path( 'lib', 'libTestRunnerInjectedBundle.so') env['TEST_RUNNER_PLUGIN_PATH'] = self._build_path('lib') if self.webprocess_cmd_prefix: env['WEB_PROCESS_CMD_PREFIX'] = self.webprocess_cmd_prefix return env def default_timeout_ms(self): # Tests run considerably slower under gdb # or valgrind. if self.get_option('webprocess_cmd_prefix'): return 350 * 1000 return super(NixPort, self).default_timeout_ms() def clean_up_test_run(self): super(NixPort, self).clean_up_test_run() self._pulseaudio_sanitizer.restore_pulseaudio_module() def _generate_all_test_configurations(self): return [ TestConfiguration(version=self._version, architecture='x86', build_type=build_type) for build_type in self.ALL_BUILD_TYPES ] def _path_to_driver(self): return self._build_path('bin', self.driver_name()) def _path_to_image_diff(self): return self._build_path('bin', 'ImageDiff') def _image_diff_command(self, *args, **kwargs): return self._jhbuild_wrapper_path + super( NixPort, self)._image_diff_command(*args, **kwargs) def _search_paths(self): return [self.port_name] def show_results_html_file(self, results_filename): run_launcher_args = ["file://%s" % results_filename] self._run_script("run-launcher", run_launcher_args) def _port_specific_expectations_files(self): paths = self._search_paths() if self.get_option('webkit_test_runner'): paths.append('wk2') return list(([ self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in paths ])) def default_baseline_search_path(self): return map(self._webkit_baseline_path, ['nix', 'wk2'])
class GtkPort(Port): port_name = "gtk" def __init__(self, *args, **kwargs): super(GtkPort, self).__init__(*args, **kwargs) self._pulseaudio_sanitizer = PulseAudioSanitizer() self._wayland = self.get_option("wayland") if self.get_option("leaks"): self._leakdetector = LeakDetectorValgrind(self._executive, self._filesystem, self.results_directory()) if not self.get_option("wrapper"): raise ValueError('use --wrapper="valgrind" for memory leak detection on GTK') if self._should_use_jhbuild(): self._jhbuild_wrapper = [self.path_from_webkit_base("Tools", "jhbuild", "jhbuild-wrapper"), "--gtk", "run"] if self.get_option("wrapper"): self.set_option("wrapper", " ".join(self._jhbuild_wrapper) + " " + self.get_option("wrapper")) else: self.set_option_default("wrapper", " ".join(self._jhbuild_wrapper)) def _built_executables_path(self, *path): return self._build_path(*(("bin",) + path)) def _built_libraries_path(self, *path): return self._build_path(*(("lib",) + path)) def _port_flag_for_scripts(self): return "--gtk" @memoized def _driver_class(self): if self._wayland: return WestonDriver if os.environ.get("USE_NATIVE_XDISPLAY"): return XorgDriver return XvfbDriver def supports_per_test_timeout(self): return True def default_timeout_ms(self): # Starting an application under Valgrind takes a lot longer than normal # so increase the timeout (empirically 10x is enough to avoid timeouts). multiplier = 10 if self.get_option("leaks") else 1 if self.get_option("configuration") == "Debug": return multiplier * 12 * 1000 return multiplier * 6 * 1000 def driver_stop_timeout(self): if self.get_option("leaks"): # Wait the default timeout time before killing the process in driver.stop(). return self.default_timeout_ms() return super(GtkPort, self).driver_stop_timeout() def setup_test_run(self): super(GtkPort, self).setup_test_run() self._pulseaudio_sanitizer.unload_pulseaudio_module() if self.get_option("leaks"): self._leakdetector.clean_leaks_files_from_results_directory() def clean_up_test_run(self): super(GtkPort, self).clean_up_test_run() self._pulseaudio_sanitizer.restore_pulseaudio_module() def setup_environ_for_server(self, server_name=None): environment = super(GtkPort, self).setup_environ_for_server(server_name) environment["GSETTINGS_BACKEND"] = "memory" environment["LIBOVERLAY_SCROLLBAR"] = "0" environment["TEST_RUNNER_INJECTED_BUNDLE_FILENAME"] = self._build_path("lib", "libTestRunnerInjectedBundle.so") environment["TEST_RUNNER_TEST_PLUGIN_PATH"] = self._build_path("lib", "plugins") environment["OWR_USE_TEST_SOURCES"] = "1" self._copy_value_from_environ_if_set(environment, "WEBKIT_OUTPUTDIR") # Configure the software libgl renderer if jhbuild ready and we test inside a virtualized window system if self._driver_class() in [XvfbDriver, WestonDriver] and self._should_use_jhbuild(): llvmpipe_libgl_path = self.host.executive.run_command( self._jhbuild_wrapper + ["printenv", "LLVMPIPE_LIBGL_PATH"], error_handler=self.host.executive.ignore_error, ).strip() dri_libgl_path = os.path.join(llvmpipe_libgl_path, "dri") if os.path.exists(os.path.join(llvmpipe_libgl_path, "libGL.so")) and os.path.exists( os.path.join(dri_libgl_path, "swrast_dri.so") ): # Force the Gallium llvmpipe software rasterizer environment["LIBGL_ALWAYS_SOFTWARE"] = "1" environment["LIBGL_DRIVERS_PATH"] = dri_libgl_path environment["LD_LIBRARY_PATH"] = llvmpipe_libgl_path if os.environ.get("LD_LIBRARY_PATH"): environment["LD_LIBRARY_PATH"] += ":%s" % os.environ.get("LD_LIBRARY_PATH") else: _log.warning("Can't find Gallium llvmpipe driver. Try to run update-webkitgtk-libs") if self.get_option("leaks"): # Turn off GLib memory optimisations https://wiki.gnome.org/Valgrind. environment["G_SLICE"] = "always-malloc" environment["G_DEBUG"] = "gc-friendly" xmlfilename = "".join(("drt-%p-", uuid.uuid1().hex, "-leaks.xml")) xmlfile = os.path.join(self.results_directory(), xmlfilename) suppressionsfile = self.path_from_webkit_base("Tools", "Scripts", "valgrind", "suppressions.txt") environment["VALGRIND_OPTS"] = ( "--tool=memcheck " "--num-callers=40 " "--demangle=no " "--trace-children=no " "--smc-check=all-non-file " "--leak-check=yes " "--leak-resolution=high " "--show-possibly-lost=no " "--show-reachable=no " "--leak-check=full " "--undef-value-errors=no " "--gen-suppressions=all " "--xml=yes " "--xml-file=%s " "--suppressions=%s" % (xmlfile, suppressionsfile) ) return environment def _generate_all_test_configurations(self): configurations = [] for build_type in self.ALL_BUILD_TYPES: configurations.append(TestConfiguration(version=self._version, architecture="x86", build_type=build_type)) return configurations def _path_to_driver(self): return self._built_executables_path(self.driver_name()) def _path_to_image_diff(self): return self._built_executables_path("ImageDiff") def _path_to_webcore_library(self): gtk_library_names = ["libwebkitgtk-1.0.so", "libwebkitgtk-3.0.so", "libwebkit2gtk-1.0.so"] for library in gtk_library_names: full_library = self._built_libraries_path(library) if self._filesystem.isfile(full_library): return full_library return None def _search_paths(self): search_paths = [] if self._wayland: search_paths.append(self.port_name + "-wayland") search_paths.append(self.port_name) search_paths.append("wk2") search_paths.extend(self.get_option("additional_platform_directory", [])) return search_paths def default_baseline_search_path(self): return map(self._webkit_baseline_path, self._search_paths()) def _port_specific_expectations_files(self): return [ self._filesystem.join(self._webkit_baseline_path(p), "TestExpectations") for p in reversed(self._search_paths()) ] def print_leaks_summary(self): if not self.get_option("leaks"): return # FIXME: This is a hack, but we don't have a better way to get this information from the workers yet # because we're in the manager process. leaks_files = self._leakdetector.leaks_files_in_results_directory() if not leaks_files: return self._leakdetector.parse_and_print_leaks_detail(leaks_files) def show_results_html_file(self, results_filename): self._run_script("run-minibrowser", [path.abspath_to_uri(self.host.platform, results_filename)]) def check_sys_deps(self, needs_http): return super(GtkPort, self).check_sys_deps(needs_http) and self._driver_class().check_driver(self) def _get_crash_log(self, name, pid, stdout, stderr, newer_than): name = "WebKitWebProcess" if name == "WebProcess" else name return GDBCrashLogGenerator( name, pid, newer_than, self._filesystem, self.path_to_script("process-linux-coredump"), self._path_to_driver ).generate_crash_log(stdout, stderr) def test_expectations_file_position(self): # GTK port baseline search path is gtk -> wk2 -> generic (as gtk-wk2 and gtk baselines are merged), so port test expectations file is at third to last position. return 2 def build_webkit_command(self, build_style=None): command = super(GtkPort, self).build_webkit_command(build_style) command.extend(["--gtk", "--update-gtk"]) command.append(super(GtkPort, self).make_args()) return command def run_webkit_tests_command(self): command = super(GtkPort, self).run_webkit_tests_command() command.append("--gtk") return command
class NixPort(Port): port_name = 'nix' def _wk2_port_name(self): return 'nix' @classmethod def determine_full_port_name(cls, host, options, port_name): """Determine the port name based on host and options values.""" # Currently the only "port" instance supported by Nix is "nix". Reimplementing # this method avoids changing port name to nix-wk2, which is the default # behavior in base.py. return port_name def __init__(self, *args, **kwargs): super(NixPort, self).__init__(*args, **kwargs) self._jhbuild_wrapper_path = [self.path_from_webkit_base('Tools', 'jhbuild', 'jhbuild-wrapper'), '--nix', 'run'] self.set_option_default('wrapper', ' '.join(self._jhbuild_wrapper_path)) self.set_option_default('webkit_test_runner', True) self.webprocess_cmd_prefix = self.get_option('webprocess_cmd_prefix') self._pulseaudio_sanitizer = PulseAudioSanitizer() def _port_flag_for_scripts(self): return "--nix" def setup_test_run(self): self._pulseaudio_sanitizer.unload_pulseaudio_module() def setup_environ_for_server(self, server_name=None): env = super(NixPort, self).setup_environ_for_server(server_name) # If DISPLAY environment variable is unset in the system # e.g. on build bot, remove DISPLAY variable from the dictionary if not 'DISPLAY' in os.environ: del env['DISPLAY'] env['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path('lib', 'libTestRunnerInjectedBundle.so') env['TEST_RUNNER_PLUGIN_PATH'] = self._build_path('lib') if self.webprocess_cmd_prefix: env['WEB_PROCESS_CMD_PREFIX'] = self.webprocess_cmd_prefix return env def default_timeout_ms(self): # Tests run considerably slower under gdb # or valgrind. if self.get_option('webprocess_cmd_prefix'): return 350 * 1000 return super(NixPort, self).default_timeout_ms() def clean_up_test_run(self): super(NixPort, self).clean_up_test_run() self._pulseaudio_sanitizer.restore_pulseaudio_module() def _generate_all_test_configurations(self): return [TestConfiguration(version=self._version, architecture='x86', build_type=build_type) for build_type in self.ALL_BUILD_TYPES] def _path_to_driver(self): return self._build_path('bin', self.driver_name()) def _path_to_image_diff(self): return self._build_path('bin', 'ImageDiff') def _image_diff_command(self, *args, **kwargs): return self._jhbuild_wrapper_path + super(NixPort, self)._image_diff_command(*args, **kwargs) def _search_paths(self): return [self.port_name] def show_results_html_file(self, results_filename): run_launcher_args = ["file://%s" % results_filename] self._run_script("run-launcher", run_launcher_args) def _port_specific_expectations_files(self): paths = self._search_paths() if self.get_option('webkit_test_runner'): paths.append('wk2') return list(([self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in paths])) def default_baseline_search_path(self): return map(self._webkit_baseline_path, ['nix', 'wk2'])
class GtkPort(Port): port_name = "gtk" def __init__(self, *args, **kwargs): super(GtkPort, self).__init__(*args, **kwargs) self._pulseaudio_sanitizer = PulseAudioSanitizer() if self.get_option("leaks"): if not self.get_option("wrapper"): raise ValueError('use --wrapper=\"valgrind\" for memory leak detection on GTK') def warn_if_bug_missing_in_test_expectations(self): return not self.get_option('webkit_test_runner') def _port_flag_for_scripts(self): return "--gtk" @memoized def _driver_class(self): if os.environ.get("WAYLAND_DISPLAY"): return WestonDriver return XvfbDriver def default_timeout_ms(self): # Starting an application under Valgrind takes a lot longer than normal # so increase the timeout (empirically 10x is enough to avoid timeouts). multiplier = 10 if self.get_option("leaks") else 1 if self.get_option('configuration') == 'Debug': return multiplier * 12 * 1000 return multiplier * 6 * 1000 def driver_stop_timeout(self): if self.get_option("leaks"): # Wait the default timeout time before killing the process in driver.stop(). return self.default_timeout_ms() return super(GtkPort, self).driver_stop_timeout() def setup_test_run(self): super(GtkPort, self).setup_test_run() self._pulseaudio_sanitizer.unload_pulseaudio_module() def clean_up_test_run(self): super(GtkPort, self).clean_up_test_run() self._pulseaudio_sanitizer.restore_pulseaudio_module() def setup_environ_for_server(self, server_name=None): environment = super(GtkPort, self).setup_environ_for_server(server_name) environment['GSETTINGS_BACKEND'] = 'memory' environment['LIBOVERLAY_SCROLLBAR'] = '0' environment['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path('Libraries', 'libTestRunnerInjectedBundle.la') environment['TEST_RUNNER_TEST_PLUGIN_PATH'] = self._build_path('TestNetscapePlugin', '.libs') environment['AUDIO_RESOURCES_PATH'] = self.path_from_webkit_base('Source', 'WebCore', 'platform', 'audio', 'resources') self._copy_value_from_environ_if_set(environment, 'WEBKIT_OUTPUTDIR') if self.get_option("leaks"): # Turn off GLib memory optimisations https://wiki.gnome.org/Valgrind. environment['G_SLICE'] = 'always-malloc' environment['G_DEBUG'] = 'gc-friendly' xmlfilename = "".join(("drt-%p-", uuid.uuid1().hex, "-leaks.xml")) xmlfile = os.path.join(self.results_directory(), xmlfilename) suppressionsfile = self.path_from_webkit_base('Tools', 'Scripts', 'valgrind', 'suppressions.txt') environment['VALGRIND_OPTS'] = \ "--tool=memcheck " \ "--num-callers=40 " \ "--demangle=no " \ "--trace-children=no " \ "--smc-check=all-non-file " \ "--leak-check=yes " \ "--leak-resolution=high " \ "--show-possibly-lost=no " \ "--show-reachable=no " \ "--leak-check=full " \ "--undef-value-errors=no " \ "--gen-suppressions=all " \ "--xml=yes " \ "--xml-file=\"%s\" " \ "--suppressions=%s" % (xmlfile, suppressionsfile) return environment def _generate_all_test_configurations(self): configurations = [] for build_type in self.ALL_BUILD_TYPES: configurations.append(TestConfiguration(version=self._version, architecture='x86', build_type=build_type)) return configurations def _path_to_driver(self): return self._build_path('Programs', self.driver_name()) def _path_to_image_diff(self): return self._build_path('Programs', 'ImageDiff') def _path_to_webcore_library(self): gtk_library_names = [ "libwebkitgtk-1.0.so", "libwebkitgtk-3.0.so", "libwebkit2gtk-1.0.so", ] for library in gtk_library_names: full_library = self._build_path(".libs", library) if self._filesystem.isfile(full_library): return full_library return None def _search_paths(self): search_paths = [] if self.get_option('webkit_test_runner'): search_paths.extend([self.port_name + '-wk2', 'wk2']) else: search_paths.append(self.port_name + '-wk1') search_paths.append(self.port_name) search_paths.extend(self.get_option("additional_platform_directory", [])) return search_paths def default_baseline_search_path(self): return map(self._webkit_baseline_path, self._search_paths()) def _port_specific_expectations_files(self): return [self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in reversed(self._search_paths())] # FIXME: We should find a way to share this implmentation with Gtk, # or teach run-launcher how to call run-safari and move this down to Port. def show_results_html_file(self, results_filename): run_launcher_args = ["file://%s" % results_filename] if self.get_option('webkit_test_runner'): run_launcher_args.append('-2') # FIXME: old-run-webkit-tests also added ["-graphicssystem", "raster", "-style", "windows"] # FIXME: old-run-webkit-tests converted results_filename path for cygwin. self._run_script("run-launcher", run_launcher_args) def check_sys_deps(self, needs_http): return super(GtkPort, self).check_sys_deps(needs_http) and self._driver_class().check_driver(self) def _get_crash_log(self, name, pid, stdout, stderr, newer_than): return GDBCrashLogGenerator(name, pid, newer_than, self._filesystem, self._path_to_driver).generate_crash_log(stdout, stderr) def build_webkit_command(self, build_style=None): command = super(GtkPort, self).build_webkit_command(build_style) command.extend(["--gtk", "--update-gtk"]) if self.get_option('webkit_test_runner'): command.append("--no-webkit1") else: command.append("--no-webkit2") command.append(super(GtkPort, self).make_args()) return command def run_webkit_tests_command(self): command = super(GtkPort, self).run_webkit_tests_command() command.append("--gtk") if self.get_option('webkit_test_runner'): command.append("-2") return command
class GtkPort(Port): port_name = "gtk" def __init__(self, *args, **kwargs): super(GtkPort, self).__init__(*args, **kwargs) self._pulseaudio_sanitizer = PulseAudioSanitizer() if self.get_option("leaks"): self._leakdetector = LeakDetectorValgrind(self._executive, self._filesystem, self.results_directory()) if not self.get_option("wrapper"): raise ValueError('use --wrapper=\"valgrind\" for memory leak detection on GTK') if self._should_use_jhbuild(): self._jhbuild_wrapper = [self.path_from_webkit_base('Tools', 'jhbuild', 'jhbuild-wrapper'), '--gtk', 'run'] if self.get_option('wrapper'): self.set_option('wrapper', ' '.join(self._jhbuild_wrapper) + ' ' + self.get_option('wrapper')) else: self.set_option_default('wrapper', ' '.join(self._jhbuild_wrapper)) def _built_executables_path(self, *path): return self._build_path(*(('bin',) + path)) def _built_libraries_path(self, *path): return self._build_path(*(('lib',) + path)) def _port_flag_for_scripts(self): return "--gtk" @memoized def _driver_class(self): if os.environ.get("WAYLAND_DISPLAY"): return WestonDriver if os.environ.get("USE_NATIVE_XDISPLAY"): return XorgDriver return XvfbDriver def default_timeout_ms(self): # Starting an application under Valgrind takes a lot longer than normal # so increase the timeout (empirically 10x is enough to avoid timeouts). multiplier = 10 if self.get_option("leaks") else 1 if self.get_option('configuration') == 'Debug': return multiplier * 12 * 1000 return multiplier * 6 * 1000 def driver_stop_timeout(self): if self.get_option("leaks"): # Wait the default timeout time before killing the process in driver.stop(). return self.default_timeout_ms() return super(GtkPort, self).driver_stop_timeout() def setup_test_run(self): super(GtkPort, self).setup_test_run() self._pulseaudio_sanitizer.unload_pulseaudio_module() if self.get_option("leaks"): self._leakdetector.clean_leaks_files_from_results_directory() def clean_up_test_run(self): super(GtkPort, self).clean_up_test_run() self._pulseaudio_sanitizer.restore_pulseaudio_module() def setup_environ_for_server(self, server_name=None): environment = super(GtkPort, self).setup_environ_for_server(server_name) environment['GSETTINGS_BACKEND'] = 'memory' environment['LIBOVERLAY_SCROLLBAR'] = '0' environment['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path('lib', 'libTestRunnerInjectedBundle.so') environment['TEST_RUNNER_TEST_PLUGIN_PATH'] = self._build_path('lib') self._copy_value_from_environ_if_set(environment, 'WEBKIT_OUTPUTDIR') if self._driver_class() == XvfbDriver and self._should_use_jhbuild(): llvmpipe_libgl_path = self.host.executive.run_command(self._jhbuild_wrapper + ['printenv', 'LLVMPIPE_LIBGL_PATH'], error_handler=self.host.executive.ignore_error).strip() if os.path.exists(os.path.join(llvmpipe_libgl_path, "libGL.so")): # Force the Gallium llvmpipe software rasterizer environment['LD_LIBRARY_PATH'] = llvmpipe_libgl_path if os.environ.get('LD_LIBRARY_PATH'): environment['LD_LIBRARY_PATH'] += ':%s' % os.environ.get('LD_LIBRARY_PATH') else: _log.warning("Can't find Gallium llvmpipe driver. Try to run update-webkitgtk-libs") if self.get_option("leaks"): # Turn off GLib memory optimisations https://wiki.gnome.org/Valgrind. environment['G_SLICE'] = 'always-malloc' environment['G_DEBUG'] = 'gc-friendly' xmlfilename = "".join(("drt-%p-", uuid.uuid1().hex, "-leaks.xml")) xmlfile = os.path.join(self.results_directory(), xmlfilename) suppressionsfile = self.path_from_webkit_base('Tools', 'Scripts', 'valgrind', 'suppressions.txt') environment['VALGRIND_OPTS'] = \ "--tool=memcheck " \ "--num-callers=40 " \ "--demangle=no " \ "--trace-children=no " \ "--smc-check=all-non-file " \ "--leak-check=yes " \ "--leak-resolution=high " \ "--show-possibly-lost=no " \ "--show-reachable=no " \ "--leak-check=full " \ "--undef-value-errors=no " \ "--gen-suppressions=all " \ "--xml=yes " \ "--xml-file=%s " \ "--suppressions=%s" % (xmlfile, suppressionsfile) return environment def _generate_all_test_configurations(self): configurations = [] for build_type in self.ALL_BUILD_TYPES: configurations.append(TestConfiguration(version=self._version, architecture='x86', build_type=build_type)) return configurations def _path_to_driver(self): return self._built_executables_path(self.driver_name()) def _path_to_image_diff(self): return self._built_executables_path('ImageDiff') def _path_to_webcore_library(self): gtk_library_names = [ "libwebkitgtk-1.0.so", "libwebkitgtk-3.0.so", "libwebkit2gtk-1.0.so", ] for library in gtk_library_names: full_library = self._built_libraries_path(library) if self._filesystem.isfile(full_library): return full_library return None def _search_paths(self): search_paths = [] search_paths.append(self.port_name) search_paths.append('wk2') search_paths.extend(self.get_option("additional_platform_directory", [])) return search_paths def default_baseline_search_path(self): return map(self._webkit_baseline_path, self._search_paths()) def _port_specific_expectations_files(self): return [self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in reversed(self._search_paths())] def print_leaks_summary(self): if not self.get_option('leaks'): return # FIXME: This is a hack, but we don't have a better way to get this information from the workers yet # because we're in the manager process. leaks_files = self._leakdetector.leaks_files_in_results_directory() if not leaks_files: return self._leakdetector.parse_and_print_leaks_detail(leaks_files) # FIXME: We should find a way to share this implmentation with Gtk, # or teach run-launcher how to call run-safari and move this down to Port. def show_results_html_file(self, results_filename): run_launcher_args = ["file://%s" % results_filename] # FIXME: old-run-webkit-tests also added ["-graphicssystem", "raster", "-style", "windows"] # FIXME: old-run-webkit-tests converted results_filename path for cygwin. self._run_script("run-launcher", run_launcher_args) def check_sys_deps(self, needs_http): return super(GtkPort, self).check_sys_deps(needs_http) and self._driver_class().check_driver(self) def _get_crash_log(self, name, pid, stdout, stderr, newer_than): return GDBCrashLogGenerator(name, pid, newer_than, self._filesystem, self._path_to_driver).generate_crash_log(stdout, stderr) def test_expectations_file_position(self): # GTK port baseline search path is gtk -> wk2 -> generic (as gtk-wk2 and gtk baselines are merged), so port test expectations file is at third to last position. return 2 def build_webkit_command(self, build_style=None): command = super(GtkPort, self).build_webkit_command(build_style) command.extend(["--gtk", "--update-gtk"]) command.append(super(GtkPort, self).make_args()) return command def run_webkit_tests_command(self): command = super(GtkPort, self).run_webkit_tests_command() command.append("--gtk") return command