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

Side by Side Diff: build/android/test_runner.py

Issue 1167693002: remove stale test data on the device (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 | « build/android/pylib/instrumentation/test_options.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2013 The Chromium Authors. All rights reserved. 3 # Copyright 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Runs all types of tests from one unified interface.""" 7 """Runs all types of tests from one unified interface."""
8 8
9 import argparse 9 import argparse
10 import collections 10 import collections
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 '--isolate-file-path', 216 '--isolate-file-path',
217 dest='isolate_file_path', 217 dest='isolate_file_path',
218 help='.isolate file path to override the default ' 218 help='.isolate file path to override the default '
219 'path') 219 'path')
220 group.add_argument('--app-data-file', action='append', dest='app_data_files', 220 group.add_argument('--app-data-file', action='append', dest='app_data_files',
221 help='A file path relative to the app data directory ' 221 help='A file path relative to the app data directory '
222 'that should be saved to the host.') 222 'that should be saved to the host.')
223 group.add_argument('--app-data-file-dir', 223 group.add_argument('--app-data-file-dir',
224 help='Host directory to which app data files will be' 224 help='Host directory to which app data files will be'
225 ' saved. Used with --app-data-file.') 225 ' saved. Used with --app-data-file.')
226 group.add_argument('--delete-stale-data', dest='delete_stale_data',
227 action='store_true',
228 help='Delete stale test data on the device.')
226 229
227 filter_group = group.add_mutually_exclusive_group() 230 filter_group = group.add_mutually_exclusive_group()
228 filter_group.add_argument('-f', '--gtest_filter', '--gtest-filter', 231 filter_group.add_argument('-f', '--gtest_filter', '--gtest-filter',
229 dest='test_filter', 232 dest='test_filter',
230 help='googletest-style filter string.') 233 help='googletest-style filter string.')
231 filter_group.add_argument('--gtest-filter-file', dest='test_filter_file', 234 filter_group.add_argument('--gtest-filter-file', dest='test_filter_file',
232 help='Path to file that contains googletest-style ' 235 help='Path to file that contains googletest-style '
233 'filter strings. (Lines will be joined with ' 236 'filter strings. (Lines will be joined with '
234 '":" to create a single filter string.)') 237 '":" to create a single filter string.)')
235 238
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 help='The relative filepath to a file containing ' 339 help='The relative filepath to a file containing '
337 'command-line flags to set on the device') 340 'command-line flags to set on the device')
338 group.add_argument('--device-flags-file', default='', 341 group.add_argument('--device-flags-file', default='',
339 help='The relative filepath to a file containing ' 342 help='The relative filepath to a file containing '
340 'command-line flags to set on the device') 343 'command-line flags to set on the device')
341 group.add_argument('--isolate_file_path', 344 group.add_argument('--isolate_file_path',
342 '--isolate-file-path', 345 '--isolate-file-path',
343 dest='isolate_file_path', 346 dest='isolate_file_path',
344 help='.isolate file path to override the default ' 347 help='.isolate file path to override the default '
345 'path') 348 'path')
349 group.add_argument('--delete-stale-data', dest='delete_stale_data',
350 action='store_true',
351 help='Delete stale test data on the device.')
346 352
347 AddCommonOptions(parser) 353 AddCommonOptions(parser)
348 AddDeviceOptions(parser) 354 AddDeviceOptions(parser)
349 AddRemoteDeviceOptions(parser) 355 AddRemoteDeviceOptions(parser)
350 356
351 357
352 def ProcessInstrumentationOptions(args): 358 def ProcessInstrumentationOptions(args):
353 """Processes options/arguments and populate |options| with defaults. 359 """Processes options/arguments and populate |options| with defaults.
354 360
355 Args: 361 Args:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 args.screenshot_failures, 395 args.screenshot_failures,
390 args.wait_for_debugger, 396 args.wait_for_debugger,
391 args.coverage_dir, 397 args.coverage_dir,
392 args.test_apk, 398 args.test_apk,
393 args.test_apk_path, 399 args.test_apk_path,
394 args.test_apk_jar_path, 400 args.test_apk_jar_path,
395 args.test_runner, 401 args.test_runner,
396 args.test_support_apk_path, 402 args.test_support_apk_path,
397 args.device_flags, 403 args.device_flags,
398 args.isolate_file_path, 404 args.isolate_file_path,
399 args.set_asserts 405 args.set_asserts,
406 args.delete_stale_data
400 ) 407 )
401 408
402 409
403 def AddUIAutomatorTestOptions(parser): 410 def AddUIAutomatorTestOptions(parser):
404 """Adds UI Automator test options to |parser|.""" 411 """Adds UI Automator test options to |parser|."""
405 412
406 group = parser.add_argument_group('UIAutomator Test Options') 413 group = parser.add_argument_group('UIAutomator Test Options')
407 AddJavaTestOptions(group) 414 AddJavaTestOptions(group)
408 group.add_argument( 415 group.add_argument(
409 '--package', required=True, choices=constants.PACKAGE_INFO.keys(), 416 '--package', required=True, choices=constants.PACKAGE_INFO.keys(),
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 # into the gtest code. 650 # into the gtest code.
644 gtest_options = gtest_test_options.GTestOptions( 651 gtest_options = gtest_test_options.GTestOptions(
645 args.tool, 652 args.tool,
646 args.test_filter, 653 args.test_filter,
647 args.run_disabled, 654 args.run_disabled,
648 args.test_arguments, 655 args.test_arguments,
649 args.timeout, 656 args.timeout,
650 args.isolate_file_path, 657 args.isolate_file_path,
651 suite_name, 658 suite_name,
652 args.app_data_files, 659 args.app_data_files,
653 args.app_data_file_dir) 660 args.app_data_file_dir,
661 args.delete_stale_data)
654 runner_factory, tests = gtest_setup.Setup(gtest_options, devices) 662 runner_factory, tests = gtest_setup.Setup(gtest_options, devices)
655 663
656 results, test_exit_code = test_dispatcher.RunTests( 664 results, test_exit_code = test_dispatcher.RunTests(
657 tests, runner_factory, devices, shard=True, test_timeout=None, 665 tests, runner_factory, devices, shard=True, test_timeout=None,
658 num_retries=args.num_retries) 666 num_retries=args.num_retries)
659 667
660 if test_exit_code and exit_code != constants.ERROR_EXIT_CODE: 668 if test_exit_code and exit_code != constants.ERROR_EXIT_CODE:
661 exit_code = test_exit_code 669 exit_code = test_exit_code
662 670
663 report_results.LogFull( 671 report_results.LogFull(
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 if e.is_infra_error: 1047 if e.is_infra_error:
1040 return constants.INFRA_EXIT_CODE 1048 return constants.INFRA_EXIT_CODE
1041 return constants.ERROR_EXIT_CODE 1049 return constants.ERROR_EXIT_CODE
1042 except: # pylint: disable=W0702 1050 except: # pylint: disable=W0702
1043 logging.exception('Unrecognized error occurred.') 1051 logging.exception('Unrecognized error occurred.')
1044 return constants.ERROR_EXIT_CODE 1052 return constants.ERROR_EXIT_CODE
1045 1053
1046 1054
1047 if __name__ == '__main__': 1055 if __name__ == '__main__':
1048 sys.exit(main()) 1056 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/pylib/instrumentation/test_options.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698