Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py

Issue 2878873002: webkitpy: Rename WebKitFinder to PathFinder (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 28 matching lines...) Expand all
39 import logging 39 import logging
40 import optparse 40 import optparse
41 import os 41 import os
42 import re 42 import re
43 import sys 43 import sys
44 44
45 from webkitpy.common import exit_codes 45 from webkitpy.common import exit_codes
46 from webkitpy.common import find_files 46 from webkitpy.common import find_files
47 from webkitpy.common import read_checksum_from_png 47 from webkitpy.common import read_checksum_from_png
48 from webkitpy.common.memoized import memoized 48 from webkitpy.common.memoized import memoized
49 from webkitpy.common.path_finder import PathFinder
49 from webkitpy.common.system.executive import ScriptError 50 from webkitpy.common.system.executive import ScriptError
50 from webkitpy.common.system.path import abspath_to_uri 51 from webkitpy.common.system.path import abspath_to_uri
51 from webkitpy.common.webkit_finder import WebKitFinder
52 from webkitpy.layout_tests.layout_package.bot_test_expectations import BotTestEx pectationsFactory 52 from webkitpy.layout_tests.layout_package.bot_test_expectations import BotTestEx pectationsFactory
53 from webkitpy.layout_tests.models import test_run_results 53 from webkitpy.layout_tests.models import test_run_results
54 from webkitpy.layout_tests.models.test_configuration import TestConfiguration 54 from webkitpy.layout_tests.models.test_configuration import TestConfiguration
55 from webkitpy.layout_tests.models.test_expectations import SKIP 55 from webkitpy.layout_tests.models.test_expectations import SKIP
56 from webkitpy.layout_tests.port import driver 56 from webkitpy.layout_tests.port import driver
57 from webkitpy.layout_tests.port import server_process 57 from webkitpy.layout_tests.port import server_process
58 from webkitpy.layout_tests.port.factory import PortFactory 58 from webkitpy.layout_tests.port.factory import PortFactory
59 from webkitpy.layout_tests.servers import apache_http 59 from webkitpy.layout_tests.servers import apache_http
60 from webkitpy.layout_tests.servers import pywebsocket 60 from webkitpy.layout_tests.servers import pywebsocket
61 from webkitpy.layout_tests.servers import wptserve 61 from webkitpy.layout_tests.servers import wptserve
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 self._version = '' 160 self._version = ''
161 self._architecture = 'x86' 161 self._architecture = 'x86'
162 162
163 # FIXME: Ideally we'd have a package-wide way to get a well-formed 163 # FIXME: Ideally we'd have a package-wide way to get a well-formed
164 # options object that had all of the necessary options defined on it. 164 # options object that had all of the necessary options defined on it.
165 self._options = options or optparse.Values() 165 self._options = options or optparse.Values()
166 166
167 self.host = host 167 self.host = host
168 self._executive = host.executive 168 self._executive = host.executive
169 self._filesystem = host.filesystem 169 self._filesystem = host.filesystem
170 self._webkit_finder = WebKitFinder(host.filesystem) 170 self._path_finder = PathFinder(host.filesystem)
171 171
172 self._http_server = None 172 self._http_server = None
173 self._websocket_server = None 173 self._websocket_server = None
174 self._wpt_server = None 174 self._wpt_server = None
175 self._image_differ = None 175 self._image_differ = None
176 self.server_process_constructor = server_process.ServerProcess # This c an be overridden for testing. 176 self.server_process_constructor = server_process.ServerProcess # This c an be overridden for testing.
177 self._http_lock = None # FIXME: Why does this live on the port object? 177 self._http_lock = None # FIXME: Why does this live on the port object?
178 self._dump_reader = None 178 self._dump_reader = None
179 179
180 # FIXME: prettypatch.py knows this path; it should not be copied here. 180 # FIXME: prettypatch.py knows this path; it should not be copied here.
181 self._pretty_patch_path = self._webkit_finder.path_from_tools_scripts('w ebkitruby', 'PrettyPatch', 'prettify.rb') 181 self._pretty_patch_path = self._path_finder.path_from_tools_scripts('web kitruby', 'PrettyPatch', 'prettify.rb')
182 self._pretty_patch_available = None 182 self._pretty_patch_available = None
183 183
184 if not hasattr(options, 'configuration') or not options.configuration: 184 if not hasattr(options, 'configuration') or not options.configuration:
185 self.set_option_default('configuration', self.default_configuration( )) 185 self.set_option_default('configuration', self.default_configuration( ))
186 if not hasattr(options, 'target') or not options.target: 186 if not hasattr(options, 'target') or not options.target:
187 self.set_option_default('target', self._options.configuration) 187 self.set_option_default('target', self._options.configuration)
188 self._test_configuration = None 188 self._test_configuration = None
189 self._reftest_list = {} 189 self._reftest_list = {}
190 self._results_directory = None 190 self._results_directory = None
191 self._virtual_test_suites = None 191 self._virtual_test_suites = None
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 baseline_path: the actual path to use for baseline, not the path to 866 baseline_path: the actual path to use for baseline, not the path to
867 the test. This function is used to update either generic or 867 the test. This function is used to update either generic or
868 platform-specific baselines, but we can't infer which here. 868 platform-specific baselines, but we can't infer which here.
869 data: contents of the baseline. 869 data: contents of the baseline.
870 """ 870 """
871 self._filesystem.write_binary_file(baseline_path, data) 871 self._filesystem.write_binary_file(baseline_path, data)
872 872
873 # TODO(qyearsley): Update callers to create a finder and call it instead 873 # TODO(qyearsley): Update callers to create a finder and call it instead
874 # of these next two routines (which should be protected). 874 # of these next two routines (which should be protected).
875 def path_from_chromium_base(self, *comps): 875 def path_from_chromium_base(self, *comps):
876 return self._webkit_finder.path_from_chromium_base(*comps) 876 return self._path_finder.path_from_chromium_base(*comps)
877 877
878 def perf_tests_dir(self): 878 def perf_tests_dir(self):
879 return self._webkit_finder.perf_tests_dir() 879 return self._path_finder.perf_tests_dir()
880 880
881 def layout_tests_dir(self): 881 def layout_tests_dir(self):
882 custom_layout_tests_dir = self.get_option('layout_tests_directory') 882 custom_layout_tests_dir = self.get_option('layout_tests_directory')
883 if custom_layout_tests_dir: 883 if custom_layout_tests_dir:
884 return custom_layout_tests_dir 884 return custom_layout_tests_dir
885 return self._webkit_finder.layout_tests_dir() 885 return self._path_finder.layout_tests_dir()
886 886
887 def skipped_layout_tests(self, _): 887 def skipped_layout_tests(self, _):
888 # TODO(qyearsley): Remove this method. 888 # TODO(qyearsley): Remove this method.
889 return set() 889 return set()
890 890
891 def skips_test(self, test, generic_expectations, full_expectations): 891 def skips_test(self, test, generic_expectations, full_expectations):
892 """Checks whether the given test is skipped for this port. 892 """Checks whether the given test is skipped for this port.
893 893
894 This should return True if the test is skipped because the port 894 This should return True if the test is skipped because the port
895 runs smoke tests only, or because the test is skipped in a file like 895 runs smoke tests only, or because the test is skipped in a file like
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 981
982 @memoized 982 @memoized
983 def path_to_generic_test_expectations_file(self): 983 def path_to_generic_test_expectations_file(self):
984 return self._filesystem.join(self.layout_tests_dir(), 'TestExpectations' ) 984 return self._filesystem.join(self.layout_tests_dir(), 'TestExpectations' )
985 985
986 def relative_test_filename(self, filename): 986 def relative_test_filename(self, filename):
987 """Returns a Unix-style path for a filename relative to LayoutTests. 987 """Returns a Unix-style path for a filename relative to LayoutTests.
988 988
989 Ports may legitimately return absolute paths here if no relative path 989 Ports may legitimately return absolute paths here if no relative path
990 makes sense. 990 makes sense.
991 TODO(qyearsley): De-duplicate this and WebKitFinder.layout_test_name. 991 TODO(qyearsley): De-duplicate this and PathFinder.layout_test_name.
992 """ 992 """
993 # Ports that run on windows need to override this method to deal with 993 # Ports that run on windows need to override this method to deal with
994 # filenames with backslashes in them. 994 # filenames with backslashes in them.
995 if filename.startswith(self.layout_tests_dir()): 995 if filename.startswith(self.layout_tests_dir()):
996 return self.host.filesystem.relpath(filename, self.layout_tests_dir( )) 996 return self.host.filesystem.relpath(filename, self.layout_tests_dir( ))
997 else: 997 else:
998 return self.host.filesystem.abspath(filename) 998 return self.host.filesystem.abspath(filename)
999 999
1000 @memoized 1000 @memoized
1001 def abspath_for_test(self, test_name): 1001 def abspath_for_test(self, test_name):
(...skipping 13 matching lines...) Expand all
1015 def bot_test_times_path(self): 1015 def bot_test_times_path(self):
1016 return self._build_path('webkit_test_times', 'bot_times_ms.json') 1016 return self._build_path('webkit_test_times', 'bot_times_ms.json')
1017 1017
1018 def perf_results_directory(self): 1018 def perf_results_directory(self):
1019 return self._build_path() 1019 return self._build_path()
1020 1020
1021 def inspector_build_directory(self): 1021 def inspector_build_directory(self):
1022 return self._build_path('resources', 'inspector') 1022 return self._build_path('resources', 'inspector')
1023 1023
1024 def apache_config_directory(self): 1024 def apache_config_directory(self):
1025 return self._webkit_finder.path_from_tools_scripts('apache_config') 1025 return self._path_finder.path_from_tools_scripts('apache_config')
1026 1026
1027 def default_results_directory(self): 1027 def default_results_directory(self):
1028 """Returns the absolute path to the default place to store the test resu lts.""" 1028 """Returns the absolute path to the default place to store the test resu lts."""
1029 return self._build_path('layout-test-results') 1029 return self._build_path('layout-test-results')
1030 1030
1031 def setup_test_run(self): 1031 def setup_test_run(self):
1032 """Performs port-specific work at the beginning of a test run.""" 1032 """Performs port-specific work at the beginning of a test run."""
1033 # Delete the disk cache if any to ensure a clean test run. 1033 # Delete the disk cache if any to ensure a clean test run.
1034 dump_render_tree_binary_path = self._path_to_driver() 1034 dump_render_tree_binary_path = self._path_to_driver()
1035 cachedir = self._filesystem.dirname(dump_render_tree_binary_path) 1035 cachedir = self._filesystem.dirname(dump_render_tree_binary_path)
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 1627
1628 def __init__(self, base, args, reference_args=None): 1628 def __init__(self, base, args, reference_args=None):
1629 self.name = base 1629 self.name = base
1630 self.base = base 1630 self.base = base
1631 self.args = args 1631 self.args = args
1632 self.reference_args = args if reference_args is None else reference_args 1632 self.reference_args = args if reference_args is None else reference_args
1633 self.tests = set() 1633 self.tests = set()
1634 1634
1635 def __repr__(self): 1635 def __repr__(self):
1636 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args) 1636 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698