OLD | NEW |
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 |
11 # in the documentation and/or other materials provided with the | 11 # in the documentation and/or other materials provided with the |
12 # distribution. | 12 # distribution. |
13 # * Neither the name of Google Inc. nor the names of its | 13 # * Neither the name of Google Inc. nor the names of its |
14 # contributors may be used to endorse or promote products derived from | 14 # contributors may be used to endorse or promote products derived from |
15 # this software without specific prior written permission. | 15 # this software without specific prior written permission. |
16 # | 16 # |
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | 28 |
29 import logging | 29 import logging |
| 30 import os |
30 | 31 |
31 from webkitpy.common.webkit_finder import WebKitFinder | |
32 from webkitpy.layout_tests.breakpad.dump_reader_multipart import DumpReaderLinux | 32 from webkitpy.layout_tests.breakpad.dump_reader_multipart import DumpReaderLinux |
33 from webkitpy.layout_tests.models import test_run_results | |
34 from webkitpy.layout_tests.port import base | 33 from webkitpy.layout_tests.port import base |
35 from webkitpy.layout_tests.port import win | 34 from webkitpy.layout_tests.port import win |
36 | 35 |
37 | 36 |
38 _log = logging.getLogger(__name__) | 37 _log = logging.getLogger(__name__) |
39 | 38 |
40 | 39 |
41 class LinuxPort(base.Port): | 40 class LinuxPort(base.Port): |
42 port_name = 'linux' | 41 port_name = 'linux' |
43 | 42 |
(...skipping 17 matching lines...) Expand all Loading... |
61 | 60 |
62 def __init__(self, host, port_name, **kwargs): | 61 def __init__(self, host, port_name, **kwargs): |
63 super(LinuxPort, self).__init__(host, port_name, **kwargs) | 62 super(LinuxPort, self).__init__(host, port_name, **kwargs) |
64 self._version = port_name[port_name.index('linux-') + len('linux-'):] | 63 self._version = port_name[port_name.index('linux-') + len('linux-'):] |
65 self._architecture = "x86_64" | 64 self._architecture = "x86_64" |
66 assert self._version in self.SUPPORTED_VERSIONS | 65 assert self._version in self.SUPPORTED_VERSIONS |
67 | 66 |
68 if not self.get_option('disable_breakpad'): | 67 if not self.get_option('disable_breakpad'): |
69 self._dump_reader = DumpReaderLinux(host, self._build_path()) | 68 self._dump_reader = DumpReaderLinux(host, self._build_path()) |
70 | 69 |
| 70 self._original_home = os.environ['HOME'] |
| 71 self._dummy_home = None |
| 72 |
71 def additional_driver_flag(self): | 73 def additional_driver_flag(self): |
72 flags = super(LinuxPort, self).additional_driver_flag() | 74 flags = super(LinuxPort, self).additional_driver_flag() |
73 if not self.get_option('disable_breakpad'): | 75 if not self.get_option('disable_breakpad'): |
74 flags += ['--enable-crash-reporter', '--crash-dumps-dir=%s' % self._
dump_reader.crash_dumps_directory()] | 76 flags += ['--enable-crash-reporter', '--crash-dumps-dir=%s' % self._
dump_reader.crash_dumps_directory()] |
75 return flags | 77 return flags |
76 | 78 |
77 def check_build(self, needs_http, printer): | 79 def check_build(self, needs_http, printer): |
78 result = super(LinuxPort, self).check_build(needs_http, printer) | 80 result = super(LinuxPort, self).check_build(needs_http, printer) |
79 | 81 |
80 if result: | 82 if result: |
(...skipping 16 matching lines...) Expand all Loading... |
97 | 99 |
98 def path_to_apache(self): | 100 def path_to_apache(self): |
99 # The Apache binary path can vary depending on OS and distribution | 101 # The Apache binary path can vary depending on OS and distribution |
100 # See http://wiki.apache.org/httpd/DistrosDefaultLayout | 102 # See http://wiki.apache.org/httpd/DistrosDefaultLayout |
101 for path in ["/usr/sbin/httpd", "/usr/sbin/apache2"]: | 103 for path in ["/usr/sbin/httpd", "/usr/sbin/apache2"]: |
102 if self._filesystem.exists(path): | 104 if self._filesystem.exists(path): |
103 return path | 105 return path |
104 _log.error("Could not find apache. Not installed or unknown path.") | 106 _log.error("Could not find apache. Not installed or unknown path.") |
105 return None | 107 return None |
106 | 108 |
| 109 def setup_test_run(self): |
| 110 super(LinuxPort, self).setup_test_run() |
| 111 self._setup_dummy_home_dir() |
| 112 |
| 113 def clean_up_test_run(self): |
| 114 super(LinuxPort, self).clean_up_test_run() |
| 115 self._clean_up_dummy_home_dir() |
| 116 |
107 # | 117 # |
108 # PROTECTED METHODS | 118 # PROTECTED METHODS |
109 # | 119 # |
110 | 120 |
| 121 def _setup_dummy_home_dir(self): |
| 122 """Creates a dummy home directory for running the test. |
| 123 |
| 124 This is a workaround for crbug.com/595504; see crbug.com/612730. |
| 125 If crbug.com/612730 is resolved in another way, then this may be |
| 126 unnecessary. |
| 127 """ |
| 128 dummy_home = str(self._filesystem.mkdtemp()) |
| 129 os.environ['HOME'] = dummy_home |
| 130 self._copy_files_to_dummy_home_dir(dummy_home) |
| 131 |
| 132 def _copy_files_to_dummy_home_dir(self, dummy_home): |
| 133 # Note: This may be unnecessary. |
| 134 fs = self._filesystem |
| 135 for filename in ['.Xauthority']: |
| 136 original_path = fs.join(self._original_home, filename) |
| 137 if not fs.exists(original_path): |
| 138 continue |
| 139 fs.copyfile(original_path, fs.join(dummy_home, filename)) |
| 140 |
| 141 def _clean_up_dummy_home_dir(self): |
| 142 """Cleans up the dummy dir and resets the HOME environment variable.""" |
| 143 dummy_home = os.environ['HOME'] |
| 144 assert dummy_home != self._original_home |
| 145 self._filesystem.rmtree(dummy_home) |
| 146 os.environ['HOME'] = self._original_home |
| 147 |
111 def _check_apache_install(self): | 148 def _check_apache_install(self): |
112 result = self._check_file_exists(self.path_to_apache(), "apache2") | 149 result = self._check_file_exists(self.path_to_apache(), "apache2") |
113 result = self._check_file_exists(self.path_to_apache_config_file(), "apa
che2 config file") and result | 150 result = self._check_file_exists(self.path_to_apache_config_file(), "apa
che2 config file") and result |
114 if not result: | 151 if not result: |
115 _log.error(' Please install using: "sudo apt-get install apache2
libapache2-mod-php5"') | 152 _log.error(' Please install using: "sudo apt-get install apache2
libapache2-mod-php5"') |
116 _log.error('') | 153 _log.error('') |
117 return result | 154 return result |
118 | 155 |
119 def _wdiff_missing_message(self): | 156 def _wdiff_missing_message(self): |
120 return 'wdiff is not installed; please install using "sudo apt-get insta
ll wdiff"' | 157 return 'wdiff is not installed; please install using "sudo apt-get insta
ll wdiff"' |
121 | 158 |
122 def _path_to_driver(self, target=None): | 159 def _path_to_driver(self, target=None): |
123 binary_name = self.driver_name() | 160 binary_name = self.driver_name() |
124 return self._build_path_with_target(target, binary_name) | 161 return self._build_path_with_target(target, binary_name) |
125 | 162 |
126 def _path_to_helper(self): | 163 def _path_to_helper(self): |
127 return None | 164 return None |
OLD | NEW |