| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import logging | 5 import logging |
| 6 import os | 6 import os |
| 7 import re | 7 import re |
| 8 import sys | 8 import sys |
| 9 import tempfile | 9 import tempfile |
| 10 | 10 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 | 267 |
| 268 # pylint: disable=no-self-use | 268 # pylint: disable=no-self-use |
| 269 def ParseGTestOutput(self, output): | 269 def ParseGTestOutput(self, output): |
| 270 """Parses raw gtest output and returns a list of results. | 270 """Parses raw gtest output and returns a list of results. |
| 271 | 271 |
| 272 Args: | 272 Args: |
| 273 output: A list of output lines. | 273 output: A list of output lines. |
| 274 Returns: | 274 Returns: |
| 275 A list of base_test_result.BaseTestResults. | 275 A list of base_test_result.BaseTestResults. |
| 276 """ | 276 """ |
| 277 log = [] |
| 278 result_type = None |
| 277 results = [] | 279 results = [] |
| 278 for l in output: | 280 for l in output: |
| 281 logging.info(l) |
| 279 matcher = _RE_TEST_STATUS.match(l) | 282 matcher = _RE_TEST_STATUS.match(l) |
| 280 if matcher: | 283 if matcher: |
| 281 result_type = None | 284 if matcher.group(1) == 'RUN': |
| 282 if matcher.group(1) == 'OK': | 285 log = [] |
| 286 elif matcher.group(1) == 'OK': |
| 283 result_type = base_test_result.ResultType.PASS | 287 result_type = base_test_result.ResultType.PASS |
| 284 elif matcher.group(1) == 'FAILED': | 288 elif matcher.group(1) == 'FAILED': |
| 285 result_type = base_test_result.ResultType.FAIL | 289 result_type = base_test_result.ResultType.FAIL |
| 286 | 290 |
| 287 if result_type: | 291 if log is not None: |
| 288 test_name = matcher.group(2) | 292 log.append(l) |
| 289 duration = matcher.group(3) if matcher.group(3) else 0 | 293 |
| 290 results.append(base_test_result.BaseTestResult( | 294 if result_type: |
| 291 test_name, result_type, duration)) | 295 test_name = matcher.group(2) |
| 292 logging.info(l) | 296 duration = matcher.group(3) if matcher.group(3) else 0 |
| 297 results.append(base_test_result.BaseTestResult( |
| 298 test_name, result_type, duration, |
| 299 log=('\n'.join(log) if log else ''))) |
| 300 log = None |
| 301 result_type = None |
| 302 |
| 293 return results | 303 return results |
| 294 | 304 |
| 295 #override | 305 #override |
| 296 def TearDown(self): | 306 def TearDown(self): |
| 297 """Clear the mappings created by SetUp.""" | 307 """Clear the mappings created by SetUp.""" |
| 298 if self._isolate_delegate: | 308 if self._isolate_delegate: |
| 299 self._isolate_delegate.Clear() | 309 self._isolate_delegate.Clear() |
| 300 | 310 |
| 301 @property | 311 @property |
| 302 def activity(self): | 312 def activity(self): |
| (...skipping 28 matching lines...) Expand all Loading... |
| 331 return self._permissions | 341 return self._permissions |
| 332 | 342 |
| 333 @property | 343 @property |
| 334 def runner(self): | 344 def runner(self): |
| 335 return self._runner | 345 return self._runner |
| 336 | 346 |
| 337 @property | 347 @property |
| 338 def suite(self): | 348 def suite(self): |
| 339 return self._suite | 349 return self._suite |
| 340 | 350 |
| OLD | NEW |