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

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

Issue 132463007: Enable presubmit pylint in build/android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase vs tot and only disabling F0401 in specific spots Created 6 years, 10 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 | « build/android/pylib/forwarder.py ('k') | build/android/pylib/gtest/test_package.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 2013 The Chromium Authors. All rights reserved. 1 # Copyright 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 """Generates test runner factory and tests for GTests.""" 5 """Generates test runner factory and tests for GTests."""
6 # pylint: disable=W0212
6 7
7 import fnmatch 8 import fnmatch
8 import glob 9 import glob
9 import logging 10 import logging
10 import os 11 import os
11 import shutil 12 import shutil
12 import sys 13 import sys
13 14
14 from pylib import android_commands 15 from pylib import android_commands
15 from pylib import cmd_helper 16 from pylib import cmd_helper
16 from pylib import constants 17 from pylib import constants
17 from pylib import ports
18 18
19 import test_package_apk 19 from pylib.gtest import test_package_apk
20 import test_package_exe 20 from pylib.gtest import test_package_exe
21 import test_runner 21 from pylib.gtest import test_runner
22 22
23 sys.path.insert(0, 23 sys.path.insert(0,
24 os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib', 24 os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib',
25 'common')) 25 'common'))
26 import unittest_util 26 import unittest_util # pylint: disable=F0401
27 27
28 28
29 _ISOLATE_FILE_PATHS = { 29 _ISOLATE_FILE_PATHS = {
30 'base_unittests': 'base/base_unittests.isolate', 30 'base_unittests': 'base/base_unittests.isolate',
31 'blink_heap_unittests': 31 'blink_heap_unittests':
32 'third_party/WebKit/Source/heap/BlinkHeapUnitTests.isolate', 32 'third_party/WebKit/Source/heap/BlinkHeapUnitTests.isolate',
33 'breakpad_unittests': 'breakpad/breakpad_unittests.isolate', 33 'breakpad_unittests': 'breakpad/breakpad_unittests.isolate',
34 'cc_perftests': 'cc/cc_perftests.isolate', 34 'cc_perftests': 'cc/cc_perftests.isolate',
35 'components_unittests': 'components/components_unittests.isolate', 35 'components_unittests': 'components/components_unittests.isolate',
36 'content_browsertests': 'content/content_browsertests.isolate', 36 'content_browsertests': 'content/content_browsertests.isolate',
(...skipping 19 matching lines...) Expand all
56 'system_wrappers_unittests': 56 'system_wrappers_unittests':
57 'system_wrappers/source/system_wrappers_unittests.isolate', 57 'system_wrappers/source/system_wrappers_unittests.isolate',
58 'test_support_unittests': 'test/test_support_unittests.isolate', 58 'test_support_unittests': 'test/test_support_unittests.isolate',
59 'tools_unittests': 'tools/tools_unittests.isolate', 59 'tools_unittests': 'tools/tools_unittests.isolate',
60 'video_engine_core_unittests': 60 'video_engine_core_unittests':
61 'video_engine/video_engine_core_unittests.isolate', 61 'video_engine/video_engine_core_unittests.isolate',
62 'voice_engine_unittests': 'voice_engine/voice_engine_unittests.isolate', 62 'voice_engine_unittests': 'voice_engine/voice_engine_unittests.isolate',
63 } 63 }
64 64
65 # Append the WebRTC tests with the full path from Chromium's src/ root. 65 # Append the WebRTC tests with the full path from Chromium's src/ root.
66 for test, isolate_path in _WEBRTC_ISOLATE_FILE_PATHS.items(): 66 for webrtc_test, isolate_path in _WEBRTC_ISOLATE_FILE_PATHS.items():
67 _ISOLATE_FILE_PATHS[test] = 'third_party/webrtc/%s' % isolate_path 67 _ISOLATE_FILE_PATHS[webrtc_test] = 'third_party/webrtc/%s' % isolate_path
68 68
69 # Used for filtering large data deps at a finer grain than what's allowed in 69 # Used for filtering large data deps at a finer grain than what's allowed in
70 # isolate files since pushing deps to devices is expensive. 70 # isolate files since pushing deps to devices is expensive.
71 # Wildcards are allowed. 71 # Wildcards are allowed.
72 _DEPS_EXCLUSION_LIST = [ 72 _DEPS_EXCLUSION_LIST = [
73 'chrome/test/data/extensions/api_test', 73 'chrome/test/data/extensions/api_test',
74 'chrome/test/data/extensions/secure_shell', 74 'chrome/test/data/extensions/secure_shell',
75 'chrome/test/data/firefox*', 75 'chrome/test/data/firefox*',
76 'chrome/test/data/gpu', 76 'chrome/test/data/gpu',
77 'chrome/test/data/image_decoding', 77 'chrome/test/data/image_decoding',
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 test_options.suite_name) 293 test_options.suite_name)
294 if not os.path.exists(test_package.suite_path): 294 if not os.path.exists(test_package.suite_path):
295 raise Exception( 295 raise Exception(
296 'Did not find %s target. Ensure it has been built.' 296 'Did not find %s target. Ensure it has been built.'
297 % test_options.suite_name) 297 % test_options.suite_name)
298 logging.warning('Found target %s', test_package.suite_path) 298 logging.warning('Found target %s', test_package.suite_path)
299 299
300 _GenerateDepsDirUsingIsolate(test_options.suite_name) 300 _GenerateDepsDirUsingIsolate(test_options.suite_name)
301 301
302 # Constructs a new TestRunner with the current options. 302 # Constructs a new TestRunner with the current options.
303 def TestRunnerFactory(device, shard_index): 303 def TestRunnerFactory(device, _shard_index):
304 return test_runner.TestRunner( 304 return test_runner.TestRunner(
305 test_options, 305 test_options,
306 device, 306 device,
307 test_package) 307 test_package)
308 308
309 tests = _GetTestsFromDevice(TestRunnerFactory, devices) 309 tests = _GetTestsFromDevice(TestRunnerFactory, devices)
310 if test_options.run_disabled: 310 if test_options.run_disabled:
311 test_options = test_options._replace( 311 test_options = test_options._replace(
312 test_arguments=('%s --gtest_also_run_disabled_tests' % 312 test_arguments=('%s --gtest_also_run_disabled_tests' %
313 test_options.test_arguments)) 313 test_options.test_arguments))
314 else: 314 else:
315 tests = _FilterDisabledTests(tests, test_options.suite_name, 315 tests = _FilterDisabledTests(tests, test_options.suite_name,
316 bool(test_options.gtest_filter)) 316 bool(test_options.gtest_filter))
317 if test_options.gtest_filter: 317 if test_options.gtest_filter:
318 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter) 318 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter)
319 319
320 # Coalesce unit tests into a single test per device 320 # Coalesce unit tests into a single test per device
321 if test_options.suite_name != 'content_browsertests': 321 if test_options.suite_name != 'content_browsertests':
322 num_devices = len(devices) 322 num_devices = len(devices)
323 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)] 323 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)]
324 tests = [t for t in tests if t] 324 tests = [t for t in tests if t]
325 325
326 return (TestRunnerFactory, tests) 326 return (TestRunnerFactory, tests)
OLDNEW
« no previous file with comments | « build/android/pylib/forwarder.py ('k') | build/android/pylib/gtest/test_package.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698