Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py (105176 => 105177)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py 2012-01-17 19:16:24 UTC (rev 105176)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py 2012-01-17 19:25:01 UTC (rev 105177)
@@ -85,11 +85,20 @@
'linux': ['lucid'],
}
+ @classmethod
+ def _chromium_base_dir(cls, filesystem):
+ module_path = filesystem.path_to_module(cls.__module__)
+ offset = module_path.find('third_party')
+ if offset == -1:
+ return filesystem.join(module_path[0:module_path.find('Tools')], 'Source', 'WebKit', 'chromium')
+ else:
+ return module_path[0:offset]
+
def __init__(self, host, **kwargs):
Port.__init__(self, host, **kwargs)
# All sub-classes override this, but we need an initial value for testing.
self._version = 'xp'
- self._chromium_base_dir = None
+ self._chromium_base_dir_path = None
def _check_file_exists(self, path_to_file, file_description,
override_step=None, logging=True):
@@ -220,14 +229,9 @@
def path_from_chromium_base(self, *comps):
"""Returns the full path to path made by joining the top of the
Chromium source tree and the list of path components in |*comps|."""
- if not self._chromium_base_dir:
- chromium_module_path = self._filesystem.path_to_module(self.__module__)
- offset = chromium_module_path.find('third_party')
- if offset == -1:
- self._chromium_base_dir = self._filesystem.join(chromium_module_path[0:chromium_module_path.find('Tools')], 'Source', 'WebKit', 'chromium')
- else:
- self._chromium_base_dir = chromium_module_path[0:offset]
- return self._filesystem.join(self._chromium_base_dir, *comps)
+ if self._chromium_base_dir_path is None:
+ self._chromium_base_dir_path = self._chromium_base_dir(self._filesystem)
+ return self._filesystem.join(self._chromium_base_dir_path, *comps)
def path_to_test_expectations_file(self):
return self.path_from_webkit_base('LayoutTests', 'platform', 'chromium', 'test_expectations.txt')
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py (105176 => 105177)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py 2012-01-17 19:16:24 UTC (rev 105176)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_linux.py 2012-01-17 19:25:01 UTC (rev 105177)
@@ -28,9 +28,11 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import logging
-import chromium
+from webkitpy.layout_tests.port import chromium
+from webkitpy.layout_tests.port import config
+
_log = logging.getLogger(__name__)
@@ -55,13 +57,54 @@
],
}
+ @classmethod
+ def _determine_driver_path_statically(cls, host, options):
+ config_object = config.Config(host.executive, host.filesystem)
+ build_directory = getattr(options, 'build_directory', None)
+ webkit_base = config_object.path_from_webkit_base()
+ chromium_base = cls._chromium_base_dir(host.filesystem)
+ configuration = getattr(options, 'configuration', config_object.default_configuration())
+ return cls._static_build_path(host.filesystem, build_directory, chromium_base, webkit_base, configuration, 'DumpRenderTree')
+
+ @staticmethod
+ def _static_build_path(filesystem, build_directory, chromium_base, webkit_base, *comps):
+ if build_directory:
+ return filesystem.join(build_directory, *comps)
+ if filesystem.exists(filesystem.join(chromium_base, 'sconsbuild')):
+ return filesystem.join(chromium_base, 'sconsbuild', *comps)
+ if filesystem.exists(filesystem.join(chromium_base, 'out', *comps)):
+ return filesystem.join(chromium_base, 'out', *comps)
+ if filesystem.exists(filesystem.join(webkit_base, 'sconsbuild')):
+ return filesystem.join(webkit_base, 'sconsbuild', *comps)
+ return filesystem.join(webkit_base, 'out', *comps)
+
+ @staticmethod
+ def _determine_architecture(filesystem, executive, driver_path):
+ file_output = ''
+ if filesystem.exists(driver_path):
+ # The --dereference flag tells file to follow symlinks
+ file_output = executive.run_command(['file', '--dereference', driver_path], return_stderr=True)
+
+ if 'ELF 32-bit LSB executable' in file_output:
+ return 'x86'
+ if 'ELF 64-bit LSB executable' in file_output:
+ return 'x86_64'
+ if file_output:
+ _log.warning('Could not determine architecture from "file" output: %s' % file_output)
+
+ # We don't know what the architecture is; default to 'x86' because
+ # maybe we're rebaselining and the binary doesn't actually exist,
+ # or something else weird is going on. It's okay to do this because
+ # if we actually try to use the binary, check_build() should fail.
+ return 'x86_64'
+
def __init__(self, host, port_name=None, **kwargs):
port_name = port_name or 'chromium-linux'
chromium.ChromiumPort.__init__(self, host, port_name=port_name, **kwargs)
# We re-set the port name once the base object is fully initialized
# in order to be able to find the DRT binary properly.
if port_name.endswith('-linux'):
- self._architecture = self._determine_architecture()
+ self._architecture = self._determine_architecture(self._filesystem, self._executive, self._determine_driver_path_statically(host, self._options))
# FIXME: This is an ugly hack to avoid renaming the GPU port.
if port_name == 'chromium-linux':
port_name = port_name + '-' + self._architecture
@@ -76,26 +119,6 @@
self._name = port_name
self._version = 'lucid' # We only support lucid right now.
- def _determine_architecture(self):
- driver_path = self._path_to_driver()
- file_output = ''
- if self._filesystem.exists(driver_path):
- # The --dereference flag tells file to follow symlinks
- file_output = self._executive.run_command(['file', '--dereference', driver_path], return_stderr=True)
-
- if 'ELF 32-bit LSB executable' in file_output:
- return 'x86'
- if 'ELF 64-bit LSB executable' in file_output:
- return 'x86_64'
- if file_output:
- _log.warning('Could not determine architecture from "file" output: %s' % file_output)
-
- # We don't know what the architecture is; default to 'x86' because
- # maybe we're rebaselining and the binary doesn't actually exist,
- # or something else weird is going on. It's okay to do this because
- # if we actually try to use the binary, check_build() should fail.
- return 'x86_64'
-
def baseline_search_path(self):
port_names = self.FALLBACK_PATHS[self._architecture]
return map(self._webkit_baseline_path, port_names)
@@ -118,19 +141,8 @@
#
def _build_path(self, *comps):
- if self.get_option('build_directory'):
- return self._filesystem.join(self.get_option('build_directory'), *comps)
+ return self._static_build_path(self._filesystem, self.get_option('build_directory'), self.path_from_chromium_base(), self.path_from_webkit_base(), *comps)
- base = self.path_from_chromium_base()
- if self._filesystem.exists(self._filesystem.join(base, 'sconsbuild')):
- return self._filesystem.join(base, 'sconsbuild', *comps)
- if self._filesystem.exists(self._filesystem.join(base, 'out', *comps)):
- return self._filesystem.join(base, 'out', *comps)
- base = self.path_from_webkit_base()
- if self._filesystem.exists(self._filesystem.join(base, 'sconsbuild')):
- return self._filesystem.join(base, 'sconsbuild', *comps)
- return self._filesystem.join(base, 'out', *comps)
-
def _check_apache_install(self):
result = self._check_file_exists(self._path_to_apache(), "apache2")
result = self._check_file_exists(self._path_to_apache_config_file(), "apache2 config file") and result