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

Side by Side Diff: build/android/pylib/gtest/gtest_test_instance.py

Issue 1186513002: Revert of [Android] Refactor browser test execution. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | build/android/pylib/gtest/local_device_gtest_run.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 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 shutil 8 import shutil
9 import sys 9 import sys
10 import tempfile 10 import tempfile
11 11
12 from pylib import constants 12 from pylib import constants
13 from pylib.base import base_test_result 13 from pylib.base import base_test_result
14 from pylib.base import test_instance 14 from pylib.base import test_instance
15 from pylib.utils import apk_helper
16 15
17 sys.path.append(os.path.join( 16 sys.path.append(os.path.join(
18 constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib', 'common')) 17 constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib', 'common'))
19 import unittest_util 18 import unittest_util
20 19
21 20
22 BROWSER_TEST_SUITES = [ 21 BROWSER_TEST_SUITES = [
23 'components_browsertests', 22 'components_browsertests',
24 'content_browsertests', 23 'content_browsertests',
25 ] 24 ]
26 25
27 26
28 _DEFAULT_ISOLATE_FILE_PATHS = {
29 'base_unittests': 'base/base_unittests.isolate',
30 'blink_heap_unittests':
31 'third_party/WebKit/Source/platform/heap/BlinkHeapUnitTests.isolate',
32 'breakpad_unittests': 'breakpad/breakpad_unittests.isolate',
33 'cc_perftests': 'cc/cc_perftests.isolate',
34 'components_browsertests': 'components/components_browsertests.isolate',
35 'components_unittests': 'components/components_unittests.isolate',
36 'content_browsertests': 'content/content_browsertests.isolate',
37 'content_unittests': 'content/content_unittests.isolate',
38 'media_perftests': 'media/media_perftests.isolate',
39 'media_unittests': 'media/media_unittests.isolate',
40 'midi_unittests': 'media/midi/midi_unittests.isolate',
41 'net_unittests': 'net/net_unittests.isolate',
42 'sql_unittests': 'sql/sql_unittests.isolate',
43 'sync_unit_tests': 'sync/sync_unit_tests.isolate',
44 'ui_base_unittests': 'ui/base/ui_base_tests.isolate',
45 'unit_tests': 'chrome/unit_tests.isolate',
46 'webkit_unit_tests':
47 'third_party/WebKit/Source/web/WebKitUnitTests.isolate',
48 }
49
50
51 # Used for filtering large data deps at a finer grain than what's allowed in 27 # Used for filtering large data deps at a finer grain than what's allowed in
52 # isolate files since pushing deps to devices is expensive. 28 # isolate files since pushing deps to devices is expensive.
53 # Wildcards are allowed. 29 # Wildcards are allowed.
54 _DEPS_EXCLUSION_LIST = [ 30 _DEPS_EXCLUSION_LIST = [
55 'chrome/test/data/extensions/api_test', 31 'chrome/test/data/extensions/api_test',
56 'chrome/test/data/extensions/secure_shell', 32 'chrome/test/data/extensions/secure_shell',
57 'chrome/test/data/firefox*', 33 'chrome/test/data/firefox*',
58 'chrome/test/data/gpu', 34 'chrome/test/data/gpu',
59 'chrome/test/data/image_decoding', 35 'chrome/test/data/image_decoding',
60 'chrome/test/data/import', 36 'chrome/test/data/import',
61 'chrome/test/data/page_cycler', 37 'chrome/test/data/page_cycler',
62 'chrome/test/data/perf', 38 'chrome/test/data/perf',
63 'chrome/test/data/pyauto_private', 39 'chrome/test/data/pyauto_private',
64 'chrome/test/data/safari_import', 40 'chrome/test/data/safari_import',
65 'chrome/test/data/scroll', 41 'chrome/test/data/scroll',
66 'chrome/test/data/third_party', 42 'chrome/test/data/third_party',
67 'third_party/hunspell_dictionaries/*.dic', 43 'third_party/hunspell_dictionaries/*.dic',
68 # crbug.com/258690 44 # crbug.com/258690
69 'webkit/data/bmp_decoder', 45 'webkit/data/bmp_decoder',
70 'webkit/data/ico_decoder', 46 'webkit/data/ico_decoder',
71 ] 47 ]
72 48
73 49
74 _EXTRA_NATIVE_TEST_ACTIVITY = (
75 'org.chromium.native_test.NativeTestInstrumentationTestRunner.'
76 'NativeTestActivity')
77 _EXTRA_SHARD_SIZE_LIMIT =(
78 'org.chromium.native_test.NativeTestInstrumentationTestRunner.'
79 'ShardSizeLimit')
80
81 # TODO(jbudorick): Remove these once we're no longer parsing stdout to generate 50 # TODO(jbudorick): Remove these once we're no longer parsing stdout to generate
82 # results. 51 # results.
83 _RE_TEST_STATUS = re.compile( 52 _RE_TEST_STATUS = re.compile(
84 r'\[ +((?:RUN)|(?:FAILED)|(?:OK)) +\] ?([^ ]+)(?: \((\d+) ms\))?$') 53 r'\[ +((?:RUN)|(?:FAILED)|(?:OK)) +\] ?([^ ]+)(?: \((\d+) ms\))?$')
85 _RE_TEST_RUN_STATUS = re.compile( 54 _RE_TEST_RUN_STATUS = re.compile(
86 r'\[ +(PASSED|RUNNER_FAILED|CRASHED) \] ?[^ ]+') 55 r'\[ +(PASSED|RUNNER_FAILED|CRASHED) \] ?[^ ]+')
87 56
88 57
89 # TODO(jbudorick): Make this a class method of GtestTestInstance once 58 # TODO(jbudorick): Make this a class method of GtestTestInstance once
90 # test_package_apk and test_package_exe are gone. 59 # test_package_apk and test_package_exe are gone.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 raise ValueError('Platform mode currently supports only 1 gtest suite') 99 raise ValueError('Platform mode currently supports only 1 gtest suite')
131 self._suite = args.suite_name[0] 100 self._suite = args.suite_name[0]
132 101
133 self._apk_path = os.path.join( 102 self._apk_path = os.path.join(
134 constants.GetOutDirectory(), '%s_apk' % self._suite, 103 constants.GetOutDirectory(), '%s_apk' % self._suite,
135 '%s-debug.apk' % self._suite) 104 '%s-debug.apk' % self._suite)
136 self._exe_path = os.path.join(constants.GetOutDirectory(), 105 self._exe_path = os.path.join(constants.GetOutDirectory(),
137 self._suite) 106 self._suite)
138 if not os.path.exists(self._apk_path): 107 if not os.path.exists(self._apk_path):
139 self._apk_path = None 108 self._apk_path = None
140 self._activity = None
141 self._package = None
142 self._runner = None
143 else:
144 helper = apk_helper.ApkHelper(self._apk_path)
145 self._activity = helper.GetActivityName()
146 self._package = helper.GetPackageName()
147 self._runner = helper.GetInstrumentationName()
148 self._extras = {
149 _EXTRA_NATIVE_TEST_ACTIVITY: self._activity,
150 }
151 if self._suite in BROWSER_TEST_SUITES:
152 self._extras[_EXTRA_SHARD_SIZE_LIMIT] = 1
153
154 if not os.path.exists(self._exe_path): 109 if not os.path.exists(self._exe_path):
155 self._exe_path = None 110 self._exe_path = None
156 if not self._apk_path and not self._exe_path: 111 if not self._apk_path and not self._exe_path:
157 error_func('Could not find apk or executable for %s' % self._suite) 112 error_func('Could not find apk or executable for %s' % self._suite)
158 113
159 self._data_deps = [] 114 self._data_deps = []
160 if args.test_filter: 115 if args.test_filter:
161 self._gtest_filter = args.test_filter 116 self._gtest_filter = args.test_filter
162 elif args.test_filter_file: 117 elif args.test_filter_file:
163 with open(args.test_filter_file, 'r') as f: 118 with open(args.test_filter_file, 'r') as f:
164 self._gtest_filter = ':'.join(l.strip() for l in f) 119 self._gtest_filter = ':'.join(l.strip() for l in f)
165 else: 120 else:
166 self._gtest_filter = None 121 self._gtest_filter = None
167
168 if not args.isolate_file_path:
169 default_isolate_file_path = _DEFAULT_ISOLATE_FILE_PATHS.get(self._suite)
170 if default_isolate_file_path:
171 args.isolate_file_path = os.path.join(
172 constants.DIR_SOURCE_ROOT, default_isolate_file_path)
173
174 if args.isolate_file_path: 122 if args.isolate_file_path:
175 self._isolate_abs_path = os.path.abspath(args.isolate_file_path) 123 self._isolate_abs_path = os.path.abspath(args.isolate_file_path)
176 self._isolate_delegate = isolate_delegate 124 self._isolate_delegate = isolate_delegate
177 self._isolated_abs_path = os.path.join( 125 self._isolated_abs_path = os.path.join(
178 constants.GetOutDirectory(), '%s.isolated' % self._suite) 126 constants.GetOutDirectory(), '%s.isolated' % self._suite)
179 else: 127 else:
180 logging.warning('No isolate file provided. No data deps will be pushed.'); 128 logging.warning('No isolate file provided. No data deps will be pushed.');
181 self._isolate_delegate = None 129 self._isolate_delegate = None
182 130
183 if args.app_data_files: 131 if args.app_data_files:
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 logging.info(l) 233 logging.info(l)
286 return results 234 return results
287 235
288 #override 236 #override
289 def TearDown(self): 237 def TearDown(self):
290 """Clear the mappings created by SetUp.""" 238 """Clear the mappings created by SetUp."""
291 if self._isolate_delegate: 239 if self._isolate_delegate:
292 self._isolate_delegate.Clear() 240 self._isolate_delegate.Clear()
293 241
294 @property 242 @property
295 def activity(self):
296 return self._activity
297
298 @property
299 def apk(self): 243 def apk(self):
300 return self._apk_path 244 return self._apk_path
301 245
302 @property 246 @property
303 def app_file_dir(self): 247 def app_file_dir(self):
304 return self._app_data_file_dir 248 return self._app_data_file_dir
305 249
306 @property 250 @property
307 def app_files(self): 251 def app_files(self):
308 return self._app_data_files 252 return self._app_data_files
309 253
310 @property 254 @property
311 def exe(self): 255 def exe(self):
312 return self._exe_path 256 return self._exe_path
313 257
314 @property 258 @property
315 def extras(self):
316 return self._extras
317
318 @property
319 def package(self):
320 return self._package
321
322 @property
323 def runner(self):
324 return self._runner
325
326 @property
327 def suite(self): 259 def suite(self):
328 return self._suite 260 return self._suite
329 261
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/gtest/local_device_gtest_run.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698