Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(622)

Side by Side Diff: build/android/pylib/linker/test_case.py

Issue 2605793002: [android] Convert linker tests to platform mode. (Closed)
Patch Set: mikecase comment Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/pylib/linker/setup.py ('k') | build/android/pylib/linker/test_runner.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Base class for linker-specific test cases. 5 """Base class for linker-specific test cases.
6 6
7 The custom dynamic linker can only be tested through a custom test case 7 The custom dynamic linker can only be tested through a custom test case
8 for various technical reasons: 8 for various technical reasons:
9 9
10 - It's an 'invisible feature', i.e. it doesn't expose a new API or 10 - It's an 'invisible feature', i.e. it doesn't expose a new API or
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 logging.debug('Found browser match: %s', browser_match.group(0)) 87 logging.debug('Found browser match: %s', browser_match.group(0))
88 renderer_match = logmon.WaitFor(_RE_RENDERER_STATUS_LINE, 88 renderer_match = logmon.WaitFor(_RE_RENDERER_STATUS_LINE,
89 timeout=timeout) 89 timeout=timeout)
90 logging.debug('Found renderer match: %s', renderer_match.group(0)) 90 logging.debug('Found renderer match: %s', renderer_match.group(0))
91 if (browser_match.group(1) != 'SUCCESS' 91 if (browser_match.group(1) != 'SUCCESS'
92 or renderer_match.group(1) != 'SUCCESS'): 92 or renderer_match.group(1) != 'SUCCESS'):
93 result = ResultType.FAIL 93 result = ResultType.FAIL
94 except device_errors.CommandTimeoutError: 94 except device_errors.CommandTimeoutError:
95 result = ResultType.TIMEOUT 95 result = ResultType.TIMEOUT
96 96
97 return result, '\n'.join(device.adb.Logcat(dump=True)) 97 logcat = device.adb.Logcat(dump=True)
98
99 logmon.Close()
100 return result, '\n'.join(logcat)
98 101
99 102
100 class LibraryLoadMap(dict): 103 class LibraryLoadMap(dict):
101 """A helper class to pretty-print a map of library names to load addresses.""" 104 """A helper class to pretty-print a map of library names to load addresses."""
102 def __str__(self): 105 def __str__(self):
103 items = ['\'%s\': 0x%x' % (name, address) for \ 106 items = ['\'%s\': 0x%x' % (name, address) for \
104 (name, address) in self.iteritems()] 107 (name, address) in self.iteritems()]
105 return '{%s}' % (', '.join(items)) 108 return '{%s}' % (', '.join(items))
106 109
107 def __repr__(self): 110 def __repr__(self):
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 # Run the test. 178 # Run the test.
176 status, logs = self._RunTest(device) 179 status, logs = self._RunTest(device)
177 180
178 result_text = 'OK' 181 result_text = 'OK'
179 if status == ResultType.FAIL: 182 if status == ResultType.FAIL:
180 result_text = 'FAILED' 183 result_text = 'FAILED'
181 elif status == ResultType.TIMEOUT: 184 elif status == ResultType.TIMEOUT:
182 result_text = 'TIMEOUT' 185 result_text = 'TIMEOUT'
183 print '[ %*s ] %s' % (margin, result_text, self.tagged_name) 186 print '[ %*s ] %s' % (margin, result_text, self.tagged_name)
184 187
185 results = base_test_result.TestRunResults() 188 return base_test_result.BaseTestResult(self.tagged_name, status, log=logs)
186 results.AddResult(
187 base_test_result.BaseTestResult(
188 self.tagged_name,
189 status,
190 log=logs))
191 189
192 return results
193 190
194 def __str__(self): 191 def __str__(self):
195 return self.tagged_name 192 return self.tagged_name
196 193
197 def __repr__(self): 194 def __repr__(self):
198 return self.tagged_name 195 return self.tagged_name
199 196
200 197
201 class LinkerSharedRelroTest(LinkerTestCaseBase): 198 class LinkerSharedRelroTest(LinkerTestCaseBase):
202 """A linker test case to check the status of shared RELRO sections. 199 """A linker test case to check the status of shared RELRO sections.
(...skipping 15 matching lines...) Expand all
218 215
219 Note that there can be other lines beginning with BROWSER_LINKER_TEST: 216 Note that there can be other lines beginning with BROWSER_LINKER_TEST:
220 and RENDERER_LINKER_TEST:, but are not followed by a <status> code. 217 and RENDERER_LINKER_TEST:, but are not followed by a <status> code.
221 218
222 - The test case passes if the <status> for both the browser and renderer 219 - The test case passes if the <status> for both the browser and renderer
223 process are SUCCESS. Otherwise its a fail. 220 process are SUCCESS. Otherwise its a fail.
224 """ 221 """
225 def _RunTest(self, device): 222 def _RunTest(self, device):
226 # Wait up to 30 seconds until the linker test status is in the logcat. 223 # Wait up to 30 seconds until the linker test status is in the logcat.
227 return _StartActivityAndWaitForLinkerTestStatus(device, timeout=30) 224 return _StartActivityAndWaitForLinkerTestStatus(device, timeout=30)
OLDNEW
« no previous file with comments | « build/android/pylib/linker/setup.py ('k') | build/android/pylib/linker/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698