| Index: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py
|
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py
|
| index 1bb2831d109be80b0a012ba59c347a0f6ee44793..37c93991cbdab119c16fcaea5433e11cd46ccf39 100644
|
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py
|
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py
|
| @@ -25,7 +25,6 @@
|
| # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| -
|
| """Abstract base class of Port-specific entry points for the layout tests
|
| test infrastructure (the Port and Driver classes)."""
|
|
|
| @@ -47,7 +46,6 @@ except ImportError:
|
| # Needed for Python < 2.7
|
| from webkitpy.thirdparty.ordered_dict import OrderedDict
|
|
|
| -
|
| from webkitpy.common import find_files
|
| from webkitpy.common import read_checksum_from_png
|
| from webkitpy.common.memoized import memoized
|
| @@ -97,7 +95,6 @@ class Port(object):
|
| # a different operating system version. This isn't accurate, but will work until
|
| # we need to test and support baselines across multiple O/S versions.
|
| ('retina', 'x86'),
|
| -
|
| ('mac10.9', 'x86'),
|
| ('mac10.10', 'x86'),
|
| ('mac10.11', 'x86'),
|
| @@ -107,8 +104,7 @@ class Port(object):
|
| ('trusty', 'x86_64'),
|
| # FIXME: Technically this should be 'arm', but adding a third architecture type breaks TestConfigurationConverter.
|
| # If we need this to be 'arm' in the future, then we first have to fix TestConfigurationConverter.
|
| - ('icecreamsandwich', 'x86'),
|
| - )
|
| + ('icecreamsandwich', 'x86'), )
|
|
|
| CONFIGURATION_SPECIFIER_MACROS = {
|
| 'mac': ['retina', 'mac10.9', 'mac10.10', 'mac10.11'],
|
| @@ -117,7 +113,7 @@ class Port(object):
|
| 'android': ['icecreamsandwich'],
|
| }
|
|
|
| - DEFAULT_BUILD_DIRECTORIES = ('out',)
|
| + DEFAULT_BUILD_DIRECTORIES = ('out', )
|
|
|
| # overridden in subclasses.
|
| FALLBACK_PATHS = {}
|
| @@ -217,7 +213,8 @@ class Port(object):
|
| self._virtual_test_suites = None
|
|
|
| def __str__(self):
|
| - return "Port{name=%s, version=%s, architecture=%s, test_configuration=%s}" % (self._name, self._version, self._architecture, self._test_configuration)
|
| + return "Port{name=%s, version=%s, architecture=%s, test_configuration=%s}" % (self._name, self._version, self._architecture,
|
| + self._test_configuration)
|
|
|
| def buildbot_archives_baselines(self):
|
| return True
|
| @@ -320,8 +317,7 @@ class Port(object):
|
| return factory.get(target_port).default_baseline_search_path()
|
| return []
|
|
|
| - def _check_file_exists(self, path_to_file, file_description,
|
| - override_step=None, logging=True):
|
| + def _check_file_exists(self, path_to_file, file_description, override_step=None, logging=True):
|
| """Verify the file is present where expected or log an error.
|
|
|
| Args:
|
| @@ -343,22 +339,18 @@ class Port(object):
|
| result = True
|
|
|
| dump_render_tree_binary_path = self._path_to_driver()
|
| - result = self._check_file_exists(dump_render_tree_binary_path,
|
| - 'test driver') and result
|
| + result = self._check_file_exists(dump_render_tree_binary_path, 'test driver') and result
|
| if not result and self.get_option('build'):
|
| - result = self._check_driver_build_up_to_date(
|
| - self.get_option('configuration'))
|
| + result = self._check_driver_build_up_to_date(self.get_option('configuration'))
|
| else:
|
| _log.error('')
|
|
|
| helper_path = self._path_to_helper()
|
| if helper_path:
|
| - result = self._check_file_exists(helper_path,
|
| - 'layout test helper') and result
|
| + result = self._check_file_exists(helper_path, 'layout test helper') and result
|
|
|
| if self.get_option('pixel_tests'):
|
| - result = self.check_image_diff(
|
| - 'To override, invoke with --no-pixel-tests') and result
|
| + result = self.check_image_diff('To override, invoke with --no-pixel-tests') and result
|
|
|
| # It's okay if pretty patch and wdiff aren't available, but we will at least log messages.
|
| self._pretty_patch_available = self.check_pretty_patch()
|
| @@ -539,12 +531,11 @@ class Port(object):
|
| if isinstance(string_value, unicode):
|
| return string_value.encode('utf-8')
|
| return string_value
|
| +
|
| expected_filename = to_raw_bytes(expected_filename)
|
| actual_filename = to_raw_bytes(actual_filename)
|
| - diff = difflib.unified_diff(expected_text.splitlines(True),
|
| - actual_text.splitlines(True),
|
| - expected_filename,
|
| - actual_filename)
|
| + diff = difflib.unified_diff(
|
| + expected_text.splitlines(True), actual_text.splitlines(True), expected_filename, actual_filename)
|
|
|
| # The diff generated by the difflib is incorrect if one of the files
|
| # does not have a newline at the end of the file and it is present in
|
| @@ -726,7 +717,8 @@ class Port(object):
|
| if len(split_line) < 3:
|
| continue
|
| expectation_type, test_file, ref_file = split_line
|
| - parsed_list.setdefault(filesystem.join(test_dirpath, test_file), []).append((expectation_type, filesystem.join(test_dirpath, ref_file)))
|
| + parsed_list.setdefault(
|
| + filesystem.join(test_dirpath, test_file), []).append((expectation_type, filesystem.join(test_dirpath, ref_file)))
|
| return parsed_list
|
|
|
| def reference_files(self, test_name):
|
| @@ -758,14 +750,15 @@ class Port(object):
|
| def _real_tests(self, paths):
|
| # When collecting test cases, skip these directories
|
| skipped_directories = set(['.svn', '_svn', 'platform', 'resources', 'support', 'script-tests', 'reference', 'reftest'])
|
| - files = find_files.find(self._filesystem, self.layout_tests_dir(), paths, skipped_directories, Port.is_test_file, self.test_key)
|
| + files = find_files.find(self._filesystem, self.layout_tests_dir(), paths, skipped_directories, Port.is_test_file,
|
| + self.test_key)
|
| return [self.relative_test_filename(f) for f in files]
|
|
|
| # When collecting test cases, we include any file with these extensions.
|
| - _supported_file_extensions = set(['.html', '.xml', '.xhtml', '.xht', '.pl',
|
| - '.htm', '.php', '.svg', '.mht', '.pdf'])
|
| + _supported_file_extensions = set(['.html', '.xml', '.xhtml', '.xht', '.pl', '.htm', '.php', '.svg', '.mht', '.pdf'])
|
|
|
| @staticmethod
|
| +
|
| # If any changes are made here be sure to update the isUsedInReftest method in old-run-webkit-tests as well.
|
| def is_reference_html_file(filesystem, dirname, filename):
|
| if filename.startswith('ref-') or filename.startswith('notref-'):
|
| @@ -784,7 +777,8 @@ class Port(object):
|
|
|
| @staticmethod
|
| def is_test_file(filesystem, dirname, filename):
|
| - return Port._has_supported_extension(filesystem, filename) and not Port.is_reference_html_file(filesystem, dirname, filename)
|
| + return Port._has_supported_extension(filesystem, filename) and not Port.is_reference_html_file(filesystem, dirname,
|
| + filename)
|
|
|
| ALL_TEST_TYPES = ['audio', 'harness', 'pixel', 'ref', 'text', 'unknown']
|
|
|
| @@ -823,6 +817,7 @@ class Port(object):
|
| http://www.codinghorror.com/blog/2007/12/sorting-for-humans-natural-sort-order.html
|
| http://nedbatchelder.com/blog/200712.html#e20071211T054956
|
| """
|
| +
|
| def tryint(val):
|
| try:
|
| return int(val)
|
| @@ -1075,7 +1070,7 @@ class Port(object):
|
| }
|
| variables_to_copy = [
|
| 'WEBKIT_TESTFONTS', # FIXME: Is this still used?
|
| - 'WEBKITOUTPUTDIR', # FIXME: Is this still used?
|
| + 'WEBKITOUTPUTDIR', # FIXME: Is this still used?
|
| 'CHROME_DEVEL_SANDBOX',
|
| 'CHROME_IPC_LOGGING',
|
| 'ASAN_OPTIONS',
|
| @@ -1087,31 +1082,18 @@ class Port(object):
|
| 'VALGRIND_LIB_INNER',
|
| ]
|
| if self.host.platform.is_linux() or self.host.platform.is_freebsd():
|
| - variables_to_copy += [
|
| - 'XAUTHORITY',
|
| - 'HOME',
|
| - 'LANG',
|
| - 'LD_LIBRARY_PATH',
|
| - 'DBUS_SESSION_BUS_ADDRESS',
|
| - 'XDG_DATA_DIRS',
|
| - ]
|
| + variables_to_copy += ['XAUTHORITY', 'HOME', 'LANG', 'LD_LIBRARY_PATH', 'DBUS_SESSION_BUS_ADDRESS', 'XDG_DATA_DIRS', ]
|
| clean_env['DISPLAY'] = self._value_or_default_from_environ('DISPLAY', ':1')
|
| if self.host.platform.is_mac():
|
| clean_env['DYLD_LIBRARY_PATH'] = self._build_path()
|
| - variables_to_copy += [
|
| - 'HOME',
|
| - ]
|
| + variables_to_copy += ['HOME', ]
|
| if self.host.platform.is_win():
|
| variables_to_copy += [
|
| 'PATH',
|
| 'GYP_DEFINES', # Required to locate win sdk.
|
| ]
|
| if self.host.platform.is_cygwin():
|
| - variables_to_copy += [
|
| - 'HOMEDRIVE',
|
| - 'HOMEPATH',
|
| - '_NT_SYMBOL_PATH',
|
| - ]
|
| + variables_to_copy += ['HOMEDRIVE', 'HOMEPATH', '_NT_SYMBOL_PATH', ]
|
|
|
| for variable in variables_to_copy:
|
| self._copy_value_from_environ_if_set(clean_env, variable)
|
| @@ -1140,7 +1122,9 @@ class Port(object):
|
| _log.debug("Starting layout helper %s" % helper_path)
|
| # Note: Not thread safe: http://bugs.python.org/issue2320
|
| self._helper = self._executive.popen([helper_path],
|
| - stdin=self._executive.PIPE, stdout=self._executive.PIPE, stderr=None)
|
| + stdin=self._executive.PIPE,
|
| + stdout=self._executive.PIPE,
|
| + stderr=None)
|
| is_ready = self._helper.stdout.readline()
|
| if not is_ready.startswith('ready'):
|
| _log.error("layout_test_helper failed to be ready")
|
| @@ -1156,7 +1140,8 @@ class Port(object):
|
| Ports can stub this out if they don't need a web server to be running."""
|
| assert not self._http_server, 'Already running an http server.'
|
|
|
| - server = apache_http.ApacheHTTP(self, self.results_directory(),
|
| + server = apache_http.ApacheHTTP(self,
|
| + self.results_directory(),
|
| additional_dirs=additional_dirs,
|
| number_of_servers=(number_of_drivers * 4))
|
| server.start()
|
| @@ -1334,8 +1319,7 @@ class Port(object):
|
| return {}
|
|
|
| def expectations_files(self):
|
| - return ([self.path_to_generic_test_expectations_file()] +
|
| - self._port_specific_expectations_files() +
|
| + return ([self.path_to_generic_test_expectations_file()] + self._port_specific_expectations_files() +
|
| self._flag_specific_expectations_files())
|
|
|
| def repository_path(self):
|
| @@ -1358,13 +1342,8 @@ class Port(object):
|
|
|
| def _wdiff_command(self, actual_filename, expected_filename):
|
| executable = self._path_to_wdiff()
|
| - return [executable,
|
| - "--start-delete=%s" % self._WDIFF_DEL,
|
| - "--end-delete=%s" % self._WDIFF_END,
|
| - "--start-insert=%s" % self._WDIFF_ADD,
|
| - "--end-insert=%s" % self._WDIFF_END,
|
| - actual_filename,
|
| - expected_filename]
|
| + return [executable, "--start-delete=%s" % self._WDIFF_DEL, "--end-delete=%s" % self._WDIFF_END,
|
| + "--start-insert=%s" % self._WDIFF_ADD, "--end-insert=%s" % self._WDIFF_END, actual_filename, expected_filename]
|
|
|
| @staticmethod
|
| def _handle_wdiff_error(script_error):
|
| @@ -1378,8 +1357,7 @@ class Port(object):
|
| # Diffs are treated as binary as they may include multiple files
|
| # with conflicting encodings. Thus we do not decode the output.
|
| command = self._wdiff_command(actual_filename, expected_filename)
|
| - wdiff = self._executive.run_command(command, decode_output=False,
|
| - error_handler=self._handle_wdiff_error)
|
| + wdiff = self._executive.run_command(command, decode_output=False, error_handler=self._handle_wdiff_error)
|
| return self._format_wdiff_output_as_html(wdiff)
|
|
|
| _wdiff_error_html = "Failed to run wdiff, see error log."
|
| @@ -1412,8 +1390,7 @@ class Port(object):
|
| self._pretty_patch_available = self.check_pretty_patch(logging=False)
|
| if not self._pretty_patch_available:
|
| return self._pretty_patch_error_html
|
| - command = ("ruby", "-I", self._filesystem.dirname(self._pretty_patch_path),
|
| - self._pretty_patch_path, diff_path)
|
| + command = ("ruby", "-I", self._filesystem.dirname(self._pretty_patch_path), self._pretty_patch_path, diff_path)
|
| try:
|
| # Diffs are treated as binary (we pass decode_output=False) as they
|
| # may contain multiple files of conflicting encodings.
|
| @@ -1538,7 +1515,8 @@ class Port(object):
|
| # Running the symbolizer script can take a lot of memory, so we need to
|
| # serialize access to it across all the concurrently running drivers.
|
|
|
| - llvm_symbolizer_path = self.path_from_chromium_base('third_party', 'llvm-build', 'Release+Asserts', 'bin', 'llvm-symbolizer')
|
| + llvm_symbolizer_path = self.path_from_chromium_base('third_party', 'llvm-build', 'Release+Asserts', 'bin',
|
| + 'llvm-symbolizer')
|
| if self._filesystem.exists(llvm_symbolizer_path):
|
| env = os.environ.copy()
|
| env['LLVM_SYMBOLIZER_PATH'] = llvm_symbolizer_path
|
| @@ -1547,7 +1525,11 @@ class Port(object):
|
| sanitizer_filter_path = self.path_from_chromium_base('tools', 'valgrind', 'asan', 'asan_symbolize.py')
|
| sanitizer_strip_path_prefix = 'Release/../../'
|
| if self._filesystem.exists(sanitizer_filter_path):
|
| - stderr = self._executive.run_command(['flock', sys.executable, sanitizer_filter_path, sanitizer_strip_path_prefix], input=stderr, decode_output=False, env=env)
|
| + stderr = self._executive.run_command(
|
| + ['flock', sys.executable, sanitizer_filter_path, sanitizer_strip_path_prefix],
|
| + input=stderr,
|
| + decode_output=False,
|
| + env=env)
|
|
|
| name_str = name or '<unknown process name>'
|
| pid_str = str(pid or '<unknown>')
|
| @@ -1564,9 +1546,9 @@ class Port(object):
|
| else:
|
| stderr_lines = [u'<empty>']
|
|
|
| - return (stderr, 'crash log for %s (pid %s):\n%s\n%s\n' % (name_str, pid_str,
|
| - '\n'.join(('STDOUT: ' + l) for l in stdout_lines),
|
| - '\n'.join(('STDERR: ' + l) for l in stderr_lines)))
|
| + return (stderr, 'crash log for %s (pid %s):\n%s\n%s\n' % (name_str, pid_str, '\n'.join(('STDOUT: ' + l)
|
| + for l in stdout_lines),
|
| + '\n'.join(('STDERR: ' + l) for l in stderr_lines)))
|
|
|
| def look_for_new_crash_logs(self, crashed_processes, start_time):
|
| pass
|
| @@ -1692,10 +1674,7 @@ class Port(object):
|
| if self.PORT_HAS_AUDIO_CODECS_BUILT_IN:
|
| return {}
|
| else:
|
| - return {
|
| - "ff_mp3_decoder": ["webaudio/codec-tests/mp3"],
|
| - "ff_aac_decoder": ["webaudio/codec-tests/aac"],
|
| - }
|
| + return {"ff_mp3_decoder": ["webaudio/codec-tests/mp3"], "ff_aac_decoder": ["webaudio/codec-tests/aac"], }
|
|
|
| def _has_test_in_directories(self, directory_lists, test_list):
|
| if not test_list:
|
| @@ -1715,7 +1694,9 @@ class Port(object):
|
| if self._has_test_in_directories(self._missing_symbol_to_skipped_tests().values(), test_list):
|
| symbols_string = self._symbols_string()
|
| if symbols_string is not None:
|
| - return reduce(operator.add, [directories for symbol_substring, directories in self._missing_symbol_to_skipped_tests().items() if symbol_substring not in symbols_string], [])
|
| + return reduce(operator.add, [directories
|
| + for symbol_substring, directories in self._missing_symbol_to_skipped_tests().items()
|
| + if symbol_substring not in symbols_string], [])
|
| return []
|
|
|
| def _convert_path(self, path):
|
| @@ -1733,8 +1714,8 @@ class Port(object):
|
| # base class does, because finding the right directory is relatively
|
| # fast.
|
| target = target or self.get_option('target')
|
| - return self._static_build_path(self._filesystem, self.get_option('build_directory'),
|
| - self.path_from_chromium_base(), target, comps)
|
| + return self._static_build_path(self._filesystem, self.get_option('build_directory'), self.path_from_chromium_base(), target,
|
| + comps)
|
|
|
| def _check_driver_build_up_to_date(self, target):
|
| # We should probably get rid of this check altogether as it has
|
| @@ -1751,8 +1732,7 @@ class Port(object):
|
| debug_mtime = self._filesystem.mtime(debug_path)
|
| release_mtime = self._filesystem.mtime(release_path)
|
|
|
| - if (debug_mtime > release_mtime and target == 'Release' or
|
| - release_mtime > debug_mtime and target == 'Debug'):
|
| + if (debug_mtime > release_mtime and target == 'Release' or release_mtime > debug_mtime and target == 'Debug'):
|
| most_recent_binary = 'Release' if target == 'Debug' else 'Debug'
|
| _log.warning('You are running the %s binary. However the %s binary appears to be more recent. '
|
| 'Please pass --%s.', target, most_recent_binary, most_recent_binary.lower())
|
|
|