1 # Copyright (C) 2011 ProFUSION Embedded Systems. All rights reserved.
2 # Copyright (C) 2011 Samsung Electronics. All rights reserved.
3 # Copyright (C) 2012 Intel Corporation
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # * Redistributions in binary form must reproduce the above
12 # copyright notice, this list of conditions and the following disclaimer
13 # in the documentation and/or other materials provided with the
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 """WebKit Efl implementation of the Port interface."""
35 from webkitpy.layout_tests.models.test_configuration import TestConfiguration
36 from webkitpy.layout_tests.port.webkit import WebKitPort
37 from webkitpy.layout_tests.port.pulseaudio_sanitizer import PulseAudioSanitizer
39 _log = logging.getLogger(__name__)
41 #if ENABLE(TIZEN_WEBKIT2_EFL_WTR)
42 # Please do not enable jhbuild since Tizen is not using it
43 #class EflDriver(WebKitDriver):
44 #def cmd_line(self, pixel_tests, per_test_args):
45 #wrapper_path = self._port.path_from_webkit_base("Tools", "efl", "run-with-jhbuild")
46 #return [wrapper_path] + WebKitDriver.cmd_line(self, pixel_tests, per_test_args)
49 class EflPort(WebKitPort, PulseAudioSanitizer):
51 #if ENABLE(TIZEN_WEBKIT2_EFL_WTR)
52 TARGET_LIST = ['U1SLP']
55 def __init__(self, *args, **kwargs):
56 WebKitPort.__init__(self, *args, **kwargs)
58 #if ENABLE(TIZEN_WEBKIT2_EFL_WTR)
59 # Please do not enable jhbuild since Tizen is not using it
60 #self._jhbuild_wrapper_path = self.path_from_webkit_base('Tools', 'efl', 'run-with-jhbuild')
61 #self.set_option_default('wrapper', self._jhbuild_wrapper_path)
63 self.webprocess_cmd_prefix = self.get_option('webprocess_cmd_prefix')
65 def _port_flag_for_scripts(self):
68 #if ENABLE(TIZEN_WEBKIT2_EFL_WTR)
69 # Please do not enable jhbuild since Tizen is not using it
70 #def _driver_class(self):
74 def setup_test_run(self):
75 self._unload_pulseaudio_module()
77 def setup_environ_for_server(self, server_name=None):
78 env = super(EflPort, self).setup_environ_for_server(server_name)
79 env['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = self._build_path('lib', 'libTestRunnerInjectedBundle.so')
80 env['TEST_RUNNER_PLUGIN_PATH'] = self._build_path('lib')
81 if self.webprocess_cmd_prefix:
82 env['WEB_PROCESS_CMD_PREFIX'] = self.webprocess_cmd_prefix
83 #if ENABLE(TIZEN_WEBKIT2_EFL_WTR)
84 env['TEST_RUNNER_FONT_CONF_PATH'] = self._build_path('../..', 'Tools/DumpRenderTree/gtk/fonts')
88 def default_timeout_ms(self):
89 # Tests run considerably slower under gdb
91 if self.get_option('webprocess_cmd_prefix'):
93 return super(EflPort, self).default_timeout_ms()
95 def clean_up_test_run(self):
96 self._restore_pulseaudio_module()
98 def _generate_all_test_configurations(self):
99 return [TestConfiguration(version=self._version, architecture='x86', build_type=build_type) for build_type in self.ALL_BUILD_TYPES]
101 #if ENABLE(TIZEN_WEBKIT2_EFL_WTR)
102 # FIXME: Need to use system apache configuration. target -> obs -> sbs order.
103 def _path_to_apache(self):
104 if os.getenv('HOSTNAME') in self.TARGET_LIST:
105 return self._filesystem.join('/wtr', 'apache', 'bin', 'httpd')
106 if os.getenv('SBOX_SESSION_DIR') == None:
107 return '/usr/local/apache2/bin/httpd'
108 return self._filesystem.join(os.environ['HOME'], 'sbs-install', 'apache', 'bin', 'httpd')
110 def _path_to_apache_config_file(self):
111 if os.getenv('HOSTNAME') in self.TARGET_LIST:
112 return self._filesystem.join(self.layout_tests_dir(), 'platform', 'efl-tizen', 'http', 'conf', 'apache2-target-httpd.conf')
113 if os.getenv('SBOX_SESSION_DIR') == None:
114 return self._filesystem.join(self.layout_tests_dir(), 'platform', 'efl-tizen', 'http', 'conf', 'apache2-suse-httpd.conf')
115 return self._filesystem.join(self.layout_tests_dir(), 'platform', 'efl-tizen', 'http', 'conf', 'apache2-debian-httpd.conf')
118 def _path_to_driver(self):
119 return self._build_path('bin', self.driver_name())
121 def _path_to_image_diff(self):
122 return self._build_path('bin', 'ImageDiff')
124 #if ENABLE(TIZEN_WEBKIT2_EFL_WTR)
125 # Please do not enable jhbuild since Tizen is not using it
126 #def _image_diff_command(self, *args, **kwargs):
127 #return [self._jhbuild_wrapper_path] + super(EflPort, self)._image_diff_command(*args, **kwargs)
130 # FIXME: I doubt EFL wants to override this method.
131 def check_build(self, needs_http):
132 return self._check_driver()
134 #if ENABLE(TIZEN_WEBKIT2_EFL_WTR)
135 def _path_to_webcore_library(self):
136 static_path = self._build_path('lib', 'libwebcore_efl.a')
137 dyn_path = self._build_path('lib', 'libwebcore_efl.so')
138 return static_path if self._filesystem.exists(static_path) else dyn_path
141 def show_results_html_file(self, results_filename):
142 # FIXME: We should find a way to share this implmentation with Gtk,
143 # or teach run-launcher how to call run-safari and move this down to WebKitPort.
144 run_launcher_args = ["file://%s" % results_filename]
145 # FIXME: old-run-webkit-tests also added ["-graphicssystem", "raster", "-style", "windows"]
146 # FIXME: old-run-webkit-tests converted results_filename path for cygwin.
147 self._run_script("run-launcher", run_launcher_args)
149 #if ENABLE(TIZEN_WEBKIT_EFL_DRT) || ENABLE(TIZEN_WEBKIT2_EFL_WTR)
150 def baseline_search_path(self):
151 # FIXME: We need some option check(s) here to distinguish drt between open source and tizen.
153 search_paths.append('efl-tizen')
154 search_paths.append(self.name())
155 if self.name() != self.port_name:
156 search_paths.append(self.port_name)
157 return map(self._webkit_baseline_path, search_paths)
159 def _skipped_file_search_paths(self):
161 # FIXME: We need some option check(s) here to distinguish drt between open source and tizen.
162 search_paths.append('efl-tizen')
165 def path_to_test_expectations_file(self):
166 return self._filesystem.join(self.layout_tests_dir(), 'platform', 'efl-tizen', 'TestExpectations')