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

Side by Side Diff: build/android/pylib/browsertests/dispatch.py

Issue 19479002: [Android] Clean up gtest filtering logic. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed all comments Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | build/android/pylib/gtest/dispatch.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 (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 """Dispatches content_browsertests.""" 5 """Dispatches content_browsertests."""
6 6
7 import logging 7 import logging
8 import os 8 import os
9 import shutil 9 import shutil
10 import sys 10 import sys
11 11
12 from pylib import android_commands 12 from pylib import android_commands
13 from pylib import cmd_helper 13 from pylib import cmd_helper
14 from pylib import constants 14 from pylib import constants
15 from pylib import ports 15 from pylib import ports
16 from pylib.base import base_test_result 16 from pylib.base import base_test_result
17 from pylib.base import shard 17 from pylib.base import shard
18 from pylib.gtest import dispatch as gtest_dispatch 18 from pylib.gtest import dispatch as gtest_dispatch
19 from pylib.gtest import test_runner 19 from pylib.gtest import test_runner
20 from pylib.utils import report_results 20 from pylib.utils import report_results
21 21
22 sys.path.insert(0,
23 os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib'))
24 from common import unittest_util
25
26 22
27 def Dispatch(options): 23 def Dispatch(options):
28 """Dispatches all content_browsertests. 24 """Dispatches all content_browsertests.
29 25
30 Args: 26 Args:
31 options: optparse.Options object containing command-line options 27 options: optparse.Options object containing command-line options
32 Returns: 28 Returns:
33 A tuple of (base_test_result.TestRunResults object, exit code). 29 A tuple of (base_test_result.TestRunResults object, exit code).
34 Raises: 30 Raises:
35 Exception: Failed to reset the test server port. 31 Exception: Failed to reset the test server port.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 options.timeout, 64 options.timeout,
69 options.cleanup_test_files, 65 options.cleanup_test_files,
70 options.tool, 66 options.tool,
71 options.build_type, 67 options.build_type,
72 options.webkit, 68 options.webkit,
73 options.push_deps, 69 options.push_deps,
74 constants.BROWSERTEST_TEST_PACKAGE_NAME, 70 constants.BROWSERTEST_TEST_PACKAGE_NAME,
75 constants.BROWSERTEST_TEST_ACTIVITY_NAME, 71 constants.BROWSERTEST_TEST_ACTIVITY_NAME,
76 constants.BROWSERTEST_COMMAND_LINE_FILE) 72 constants.BROWSERTEST_COMMAND_LINE_FILE)
77 73
78 # Get tests and split them up based on the number of devices. 74 tests = gtest_dispatch.GetTestsFiltered(
79 all_enabled = gtest_dispatch.GetAllEnabledTests(RunnerFactory, 75 constants.BROWSERTEST_SUITE_NAME, options.test_filter, RunnerFactory,
80 attached_devices) 76 attached_devices)
81 if options.test_filter:
82 all_tests = unittest_util.FilterTestNames(all_enabled,
83 options.test_filter)
84 else:
85 all_tests = _FilterTests(all_enabled)
86 77
87 # Run tests. 78 # Run tests.
88 # TODO(nileshagrawal): remove this abnormally long setup timeout once fewer 79 # TODO(nileshagrawal): remove this abnormally long setup timeout once fewer
89 # files are pushed to the devices for content_browsertests: crbug.com/138275 80 # files are pushed to the devices for content_browsertests: crbug.com/138275
90 setup_timeout = 20 * 60 # 20 minutes 81 setup_timeout = 20 * 60 # 20 minutes
91 test_results, exit_code = shard.ShardAndRunTests( 82 test_results, exit_code = shard.ShardAndRunTests(
92 RunnerFactory, attached_devices, all_tests, options.build_type, 83 RunnerFactory, attached_devices, tests, options.build_type,
93 setup_timeout=setup_timeout, test_timeout=None, 84 setup_timeout=setup_timeout, test_timeout=None,
94 num_retries=options.num_retries) 85 num_retries=options.num_retries)
95 report_results.LogFull( 86 report_results.LogFull(
96 results=test_results, 87 results=test_results,
97 test_type='Unit test', 88 test_type='Unit test',
98 test_package=constants.BROWSERTEST_SUITE_NAME, 89 test_package=constants.BROWSERTEST_SUITE_NAME,
99 build_type=options.build_type, 90 build_type=options.build_type,
100 flakiness_server=options.flakiness_dashboard_server) 91 flakiness_server=options.flakiness_dashboard_server)
101 92
102 if os.path.isdir(constants.ISOLATE_DEPS_DIR): 93 if os.path.isdir(constants.ISOLATE_DEPS_DIR):
103 shutil.rmtree(constants.ISOLATE_DEPS_DIR) 94 shutil.rmtree(constants.ISOLATE_DEPS_DIR)
104 95
105 return (test_results, exit_code) 96 return (test_results, exit_code)
106
107
108 def _FilterTests(all_enabled_tests):
109 """Filters out tests and fixtures starting with PRE_ and MANUAL_."""
110 return [t for t in all_enabled_tests if _ShouldRunOnBot(t)]
111
112
113 def _ShouldRunOnBot(test):
114 fixture, case = test.split('.', 1)
115 if _StartsWith(fixture, case, 'PRE_'):
116 return False
117 if _StartsWith(fixture, case, 'MANUAL_'):
118 return False
119 return True
120
121
122 def _StartsWith(a, b, prefix):
123 return a.startswith(prefix) or b.startswith(prefix)
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/gtest/dispatch.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698