| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 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 import logging | 5 import logging |
| 6 import os | 6 import os |
| 7 | 7 |
| 8 from pylib import android_commands | 8 from pylib import android_commands |
| 9 from pylib import cmd_helper | 9 from pylib import cmd_helper |
| 10 from pylib import constants | 10 from pylib import constants |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 # Get tests and split them up based on the number of devices. | 56 # Get tests and split them up based on the number of devices. |
| 57 if options.gtest_filter: | 57 if options.gtest_filter: |
| 58 all_tests = [t for t in options.gtest_filter.split(':') if t] | 58 all_tests = [t for t in options.gtest_filter.split(':') if t] |
| 59 else: | 59 else: |
| 60 all_enabled = gtest_dispatch.GetAllEnabledTests(RunnerFactory, | 60 all_enabled = gtest_dispatch.GetAllEnabledTests(RunnerFactory, |
| 61 attached_devices) | 61 attached_devices) |
| 62 all_tests = _FilterTests(all_enabled) | 62 all_tests = _FilterTests(all_enabled) |
| 63 | 63 |
| 64 # Run tests. | 64 # Run tests. |
| 65 test_results = shard.ShardAndRunTests(RunnerFactory, attached_devices, | 65 test_results = shard.ShardAndRunTests(RunnerFactory, attached_devices, |
| 66 all_tests, options.build_type) | 66 all_tests, options.build_type, |
| 67 test_timeout=None) |
| 67 report_results.LogFull( | 68 report_results.LogFull( |
| 68 results=test_results, | 69 results=test_results, |
| 69 test_type='Unit test', | 70 test_type='Unit test', |
| 70 test_package=constants.BROWSERTEST_SUITE_NAME, | 71 test_package=constants.BROWSERTEST_SUITE_NAME, |
| 71 build_type=options.build_type, | 72 build_type=options.build_type, |
| 72 flakiness_server=options.flakiness_dashboard_server) | 73 flakiness_server=options.flakiness_dashboard_server) |
| 73 report_results.PrintAnnotation(test_results) | 74 report_results.PrintAnnotation(test_results) |
| 74 | 75 |
| 75 def _FilterTests(all_enabled_tests): | 76 def _FilterTests(all_enabled_tests): |
| 76 """Filters out tests and fixtures starting with PRE_ and MANUAL_.""" | 77 """Filters out tests and fixtures starting with PRE_ and MANUAL_.""" |
| 77 return [t for t in all_enabled_tests if _ShouldRunOnBot(t)] | 78 return [t for t in all_enabled_tests if _ShouldRunOnBot(t)] |
| 78 | 79 |
| 79 def _ShouldRunOnBot(test): | 80 def _ShouldRunOnBot(test): |
| 80 fixture, case = test.split('.', 1) | 81 fixture, case = test.split('.', 1) |
| 81 if _StartsWith(fixture, case, "PRE_"): | 82 if _StartsWith(fixture, case, "PRE_"): |
| 82 return False | 83 return False |
| 83 if _StartsWith(fixture, case, "MANUAL_"): | 84 if _StartsWith(fixture, case, "MANUAL_"): |
| 84 return False | 85 return False |
| 85 return True | 86 return True |
| 86 | 87 |
| 87 def _StartsWith(a, b, prefix): | 88 def _StartsWith(a, b, prefix): |
| 88 return a.startswith(prefix) or b.startswith(prefix) | 89 return a.startswith(prefix) or b.startswith(prefix) |
| OLD | NEW |