Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 """Test runners for iOS.""" | 5 """Test runners for iOS.""" |
| 6 | 6 |
| 7 import argparse | 7 import argparse |
| 8 import collections | 8 import collections |
| 9 import errno | 9 import errno |
| 10 import os | 10 import os |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 else: | 281 else: |
| 282 parser = gtest_utils.GTestLogParser() | 282 parser = gtest_utils.GTestLogParser() |
| 283 | 283 |
| 284 proc = subprocess.Popen( | 284 proc = subprocess.Popen( |
| 285 cmd, | 285 cmd, |
| 286 env=self.get_launch_env(), | 286 env=self.get_launch_env(), |
| 287 stdout=subprocess.PIPE, | 287 stdout=subprocess.PIPE, |
| 288 stderr=subprocess.STDOUT, | 288 stderr=subprocess.STDOUT, |
| 289 ) | 289 ) |
| 290 | 290 |
| 291 failed_test_count = len(parser.FailedTests()) | |
| 291 while True: | 292 while True: |
| 292 line = proc.stdout.readline() | 293 line = proc.stdout.readline() |
| 293 if not line: | 294 if not line: |
| 294 break | 295 break |
| 295 line = line.rstrip() | 296 line = line.rstrip() |
| 296 parser.ProcessLine(line) | 297 parser.ProcessLine(line) |
| 297 print line | 298 print line |
| 298 sys.stdout.flush() | 299 sys.stdout.flush() |
| 299 | 300 |
| 301 # If there is a new test failure, take screenshot of desktop. This can | |
| 302 # help with debugging failures on the bots. | |
| 303 if len(parser.FailedTests()) > failed_test_count: | |
| 304 failed_test_count = len(parser.FailedTests()) | |
| 305 self.screenshot_desktop() | |
|
smut
2017/03/22 22:46:54
parser is reinitialized every time (lines 279-282)
baxley
2017/03/22 23:24:39
Done.
baxley
2017/03/23 13:54:19
I don't think this works. parser is initialized ou
| |
| 306 | |
| 300 proc.wait() | 307 proc.wait() |
| 301 sys.stdout.flush() | 308 sys.stdout.flush() |
| 302 | 309 |
| 303 for test in parser.FailedTests(include_flaky=True): | 310 for test in parser.FailedTests(include_flaky=True): |
| 304 # Test cases are named as <test group>.<test case>. If the test case | 311 # Test cases are named as <test group>.<test case>. If the test case |
| 305 # is prefixed with "FLAKY_", it should be reported as flaked not failed. | 312 # is prefixed with "FLAKY_", it should be reported as flaked not failed. |
| 306 if '.' in test and test.split('.', 1)[1].startswith('FLAKY_'): | 313 if '.' in test and test.split('.', 1)[1].startswith('FLAKY_'): |
| 307 result.flaked_tests[test] = parser.FailureDescription(test) | 314 result.flaked_tests[test] = parser.FailureDescription(test) |
| 308 else: | 315 else: |
| 309 result.failed_tests[test] = parser.FailureDescription(test) | 316 result.failed_tests[test] = parser.FailureDescription(test) |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 760 """ | 767 """ |
| 761 env = super(DeviceTestRunner, self).get_launch_env() | 768 env = super(DeviceTestRunner, self).get_launch_env() |
| 762 if self.xctest_path: | 769 if self.xctest_path: |
| 763 env['NSUnbufferedIO'] = 'YES' | 770 env['NSUnbufferedIO'] = 'YES' |
| 764 # e.g. ios_web_shell_egtests | 771 # e.g. ios_web_shell_egtests |
| 765 env['APP_TARGET_NAME'] = os.path.splitext( | 772 env['APP_TARGET_NAME'] = os.path.splitext( |
| 766 os.path.basename(self.app_path))[0] | 773 os.path.basename(self.app_path))[0] |
| 767 # e.g. ios_web_shell_egtests_module | 774 # e.g. ios_web_shell_egtests_module |
| 768 env['TEST_TARGET_NAME'] = env['APP_TARGET_NAME'] + '_module' | 775 env['TEST_TARGET_NAME'] = env['APP_TARGET_NAME'] + '_module' |
| 769 return env | 776 return env |
| OLD | NEW |