1 # Copyright (C) 2010 Google Inc. All rights reserved.
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are
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
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.
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.
29 """Chromium Mac implementation of the Port interface."""
34 from webkitpy.layout_tests.port import base
37 _log = logging.getLogger(__name__)
40 class MacPort(base.Port):
41 SUPPORTED_VERSIONS = ('snowleopard', 'lion', 'retina', 'mountainlion', 'mavericks')
44 # FIXME: We treat Retina (High-DPI) devices as if they are running
45 # a different operating system version. This is lame and should be fixed.
46 # Note that the retina versions fallback to the non-retina versions and so no
47 # baselines are shared between retina versions; this keeps the fallback graph as a tree
48 # and maximizes the number of baselines we can share that way.
49 # We also currently only support Retina on 10.8; we need to either upgrade to 10.9 or support both.
52 FALLBACK_PATHS['mavericks'] = ['mac']
53 FALLBACK_PATHS['mountainlion'] = ['mac-mountainlion'] + FALLBACK_PATHS['mavericks']
54 FALLBACK_PATHS['retina'] = ['mac-retina'] + FALLBACK_PATHS['mountainlion']
55 FALLBACK_PATHS['lion'] = ['mac-lion'] + FALLBACK_PATHS['mountainlion']
56 FALLBACK_PATHS['snowleopard'] = ['mac-snowleopard'] + FALLBACK_PATHS['lion']
58 DEFAULT_BUILD_DIRECTORIES = ('xcodebuild', 'out')
60 CONTENT_SHELL_NAME = 'Content Shell'
63 def determine_full_port_name(cls, host, options, port_name):
64 if port_name.endswith('mac'):
65 if host.platform.os_version in ('future',):
68 version = host.platform.os_version
69 if host.platform.is_highdpi():
71 return port_name + '-' + version
74 def __init__(self, host, port_name, **kwargs):
75 super(MacPort, self).__init__(host, port_name, **kwargs)
76 self._version = port_name[port_name.index('mac-') + len('mac-'):]
77 assert self._version in self.SUPPORTED_VERSIONS
79 def _modules_to_search_for_symbols(self):
80 return [self._build_path('ffmpegsumo.so')]
82 def check_build(self, needs_http, printer):
83 result = super(MacPort, self).check_build(needs_http, printer)
85 _log.error('For complete Mac build requirements, please see:')
87 _log.error(' http://code.google.com/p/chromium/wiki/MacBuildInstructions')
91 def operating_system(self):
98 def _lighttpd_path(self, *comps):
99 return self.path_from_chromium_base('third_party', 'lighttpd', 'mac', *comps)
101 def _wdiff_missing_message(self):
102 return 'wdiff is not installed; please install from MacPorts or elsewhere'
104 def path_to_apache(self):
105 return '/usr/sbin/httpd'
107 def path_to_apache_config_file(self):
108 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 'apache2-httpd.conf')
110 def path_to_lighttpd(self):
111 return self._lighttpd_path('bin', 'lighttpd')
113 def path_to_lighttpd_modules(self):
114 return self._lighttpd_path('lib')
116 def path_to_lighttpd_php(self):
117 return self._lighttpd_path('bin', 'php-cgi')
119 def _path_to_driver(self, configuration=None):
120 # FIXME: make |configuration| happy with case-sensitive file systems.
121 return self._build_path_with_configuration(configuration, self.driver_name() + '.app', 'Contents', 'MacOS', self.driver_name())
123 def _path_to_helper(self):
124 binary_name = 'layout_test_helper'
125 return self._build_path(binary_name)
127 def _path_to_wdiff(self):