blob: 4a62eb920c9f5fe36771e07e90a7f9d64ee1c11c [file] [log] [blame]
Ben Murdoche69819b2013-07-17 14:56:49 +01001# Copyright (C) 2010 Google Inc. All rights reserved.
2#
3# Redistribution and use in source and binary forms, with or without
4# modification, are permitted provided that the following conditions are
5# met:
6#
7# * Redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer.
9# * Redistributions in binary form must reproduce the above
10# copyright notice, this list of conditions and the following disclaimer
11# in the documentation and/or other materials provided with the
12# distribution.
13# * Neither the name of Google Inc. nor the names of its
14# contributors may be used to endorse or promote products derived from
15# this software without specific prior written permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29"""Chromium Mac implementation of the Port interface."""
30
31import logging
32import signal
33
34from webkitpy.layout_tests.port import chromium
35
36
37_log = logging.getLogger(__name__)
38
39
40class MacPort(chromium.ChromiumPort):
41 SUPPORTED_VERSIONS = ('snowleopard', 'lion', 'mountainlion')
42 port_name = 'mac'
43
44 FALLBACK_PATHS = { 'mountainlion': [ 'mac' ]}
45 FALLBACK_PATHS['lion'] = ['mac-lion'] + FALLBACK_PATHS['mountainlion']
46 FALLBACK_PATHS['snowleopard'] = ['mac-snowleopard'] + FALLBACK_PATHS['lion']
47
48 DEFAULT_BUILD_DIRECTORIES = ('xcodebuild', 'out')
49
50 CONTENT_SHELL_NAME = 'Content Shell'
51
52 @classmethod
53 def determine_full_port_name(cls, host, options, port_name):
54 if port_name.endswith('mac'):
55 return port_name + '-' + host.platform.os_version
56 return port_name
57
58 def __init__(self, host, port_name, **kwargs):
59 chromium.ChromiumPort.__init__(self, host, port_name, **kwargs)
60 self._version = port_name[port_name.index('mac-') + len('mac-'):]
61 assert self._version in self.SUPPORTED_VERSIONS
62
63 def _modules_to_search_for_symbols(self):
64 return [self._build_path('ffmpegsumo.so')]
65
66 def check_build(self, needs_http):
67 result = chromium.ChromiumPort.check_build(self, needs_http)
68 if not result:
69 _log.error('For complete Mac build requirements, please see:')
70 _log.error('')
71 _log.error(' http://code.google.com/p/chromium/wiki/MacBuildInstructions')
72
73 return result
74
75 def operating_system(self):
76 return 'mac'
77
78 #
79 # PROTECTED METHODS
80 #
81
82 def _lighttpd_path(self, *comps):
83 return self.path_from_chromium_base('third_party', 'lighttpd', 'mac', *comps)
84
85 def _wdiff_missing_message(self):
86 return 'wdiff is not installed; please install from MacPorts or elsewhere'
87
88 def _path_to_apache(self):
89 return '/usr/sbin/httpd'
90
91 def _path_to_apache_config_file(self):
92 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 'apache2-httpd.conf')
93
94 def _path_to_lighttpd(self):
95 return self._lighttpd_path('bin', 'lighttpd')
96
97 def _path_to_lighttpd_modules(self):
98 return self._lighttpd_path('lib')
99
100 def _path_to_lighttpd_php(self):
101 return self._lighttpd_path('bin', 'php-cgi')
102
103 def _path_to_driver(self, configuration=None):
104 # FIXME: make |configuration| happy with case-sensitive file systems.
105 return self._build_path_with_configuration(configuration, self.driver_name() + '.app', 'Contents', 'MacOS', self.driver_name())
106
107 def _path_to_helper(self):
108 binary_name = 'LayoutTestHelper'
109 return self._build_path(binary_name)
110
111 def _path_to_wdiff(self):
112 return 'wdiff'