Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Tools / Scripts / webkitpy / layout_tests / port / mac.py
1 # 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
31 import logging
32 import signal
33
34 from webkitpy.layout_tests.port import base
35
36
37 _log = logging.getLogger(__name__)
38
39
40 class MacPort(base.Port):
41     SUPPORTED_VERSIONS = ('snowleopard', 'lion', 'retina', 'mountainlion', 'mavericks')
42     port_name = 'mac'
43
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.
50
51     FALLBACK_PATHS = {}
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']
57
58     DEFAULT_BUILD_DIRECTORIES = ('xcodebuild', 'out')
59
60     CONTENT_SHELL_NAME = 'Content Shell'
61
62     @classmethod
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',):
66                 version = 'mavericks'
67             else:
68                 version = host.platform.os_version
69             if host.platform.is_highdpi():
70                 version = 'retina'
71             return port_name + '-' + version
72         return port_name
73
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
78
79     def _modules_to_search_for_symbols(self):
80         return [self._build_path('ffmpegsumo.so')]
81
82     def check_build(self, needs_http, printer):
83         result = super(MacPort, self).check_build(needs_http, printer)
84         if result:
85             _log.error('For complete Mac build requirements, please see:')
86             _log.error('')
87             _log.error('    http://code.google.com/p/chromium/wiki/MacBuildInstructions')
88
89         return result
90
91     def operating_system(self):
92         return 'mac'
93
94     #
95     # PROTECTED METHODS
96     #
97
98     def _lighttpd_path(self, *comps):
99         return self.path_from_chromium_base('third_party', 'lighttpd', 'mac', *comps)
100
101     def _wdiff_missing_message(self):
102         return 'wdiff is not installed; please install from MacPorts or elsewhere'
103
104     def path_to_apache(self):
105         return '/usr/sbin/httpd'
106
107     def path_to_apache_config_file(self):
108         return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 'apache2-httpd.conf')
109
110     def path_to_lighttpd(self):
111         return self._lighttpd_path('bin', 'lighttpd')
112
113     def path_to_lighttpd_modules(self):
114         return self._lighttpd_path('lib')
115
116     def path_to_lighttpd_php(self):
117         return self._lighttpd_path('bin', 'php-cgi')
118
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())
122
123     def _path_to_helper(self):
124         binary_name = 'layout_test_helper'
125         return self._build_path(binary_name)
126
127     def _path_to_wdiff(self):
128         return 'wdiff'