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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 options.build_type, | 48 options.build_type, |
49 options.webkit, | 49 options.webkit, |
50 constants.BROWSERTEST_TEST_PACKAGE_NAME, | 50 constants.BROWSERTEST_TEST_PACKAGE_NAME, |
51 constants.BROWSERTEST_TEST_ACTIVITY_NAME, | 51 constants.BROWSERTEST_TEST_ACTIVITY_NAME, |
52 constants.BROWSERTEST_COMMAND_LINE_FILE) | 52 constants.BROWSERTEST_COMMAND_LINE_FILE) |
53 | 53 |
54 # Get tests and split them up based on the number of devices. | 54 # Get tests and split them up based on the number of devices. |
55 if options.gtest_filter: | 55 if options.gtest_filter: |
56 all_tests = [t for t in options.gtest_filter.split(':') if t] | 56 all_tests = [t for t in options.gtest_filter.split(':') if t] |
57 else: | 57 else: |
58 all_tests = gtest_dispatch.GetAllEnabledTests(RunnerFactory, | 58 all_enabled = gtest_dispatch.GetAllEnabledTests(RunnerFactory, |
59 attached_devices) | 59 attached_devices) |
| 60 all_tests = _FilterTests(all_enabled) |
60 | 61 |
61 # Run tests. | 62 # Run tests. |
62 test_results = shard.ShardAndRunTests(RunnerFactory, attached_devices, | 63 test_results = shard.ShardAndRunTests(RunnerFactory, attached_devices, |
63 all_tests, options.build_type) | 64 all_tests, options.build_type) |
64 test_results.LogFull( | 65 test_results.LogFull( |
65 test_type='Unit test', | 66 test_type='Unit test', |
66 test_package=constants.BROWSERTEST_SUITE_NAME, | 67 test_package=constants.BROWSERTEST_SUITE_NAME, |
67 build_type=options.build_type, | 68 build_type=options.build_type, |
68 flakiness_server=options.flakiness_dashboard_server) | 69 flakiness_server=options.flakiness_dashboard_server) |
69 test_results.PrintAnnotation() | 70 test_results.PrintAnnotation() |
| 71 |
| 72 def _FilterTests(all_enabled_tests): |
| 73 """Filters out tests and fixtures starting with PRE_ and MANUAL_.""" |
| 74 return [t for t in all_enabled_tests if _ShouldRunOnBot(t)] |
| 75 |
| 76 def _ShouldRunOnBot(test): |
| 77 fixture, case = test.split('.', 1) |
| 78 if _StartsWith(fixture, case, "PRE_"): |
| 79 return False |
| 80 if _StartsWith(fixture, case, "MANUAL_"): |
| 81 return False |
| 82 return True |
| 83 |
| 84 def _StartsWith(a, b, prefix): |
| 85 return a.startswith(prefix) or b.startswith(prefix) |
OLD | NEW |