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

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
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 '--isolate-file-path', 214 '--isolate-file-path',
215 dest='isolate_file_path', 215 dest='isolate_file_path',
216 help='.isolate file path to override the default ' 216 help='.isolate file path to override the default '
217 'path') 217 'path')
218 group.add_argument('--app-data-file', action='append', dest='app_data_files', 218 group.add_argument('--app-data-file', action='append', dest='app_data_files',
219 help='A file path relative to the app data directory ' 219 help='A file path relative to the app data directory '
220 'that should be saved to the host.') 220 'that should be saved to the host.')
221 group.add_argument('--app-data-file-dir', 221 group.add_argument('--app-data-file-dir',
222 help='Host directory to which app data files will be' 222 help='Host directory to which app data files will be'
223 ' saved. Used with --app-data-file.') 223 ' saved. Used with --app-data-file.')
224 group.add_argument('--delete-stale-data', dest='delete_stale_data',
225 action='store_true',
226 help='Delete stale test data on the device.')
224 227
225 filter_group = group.add_mutually_exclusive_group() 228 filter_group = group.add_mutually_exclusive_group()
226 filter_group.add_argument('-f', '--gtest_filter', '--gtest-filter', 229 filter_group.add_argument('-f', '--gtest_filter', '--gtest-filter',
227 dest='test_filter', 230 dest='test_filter',
228 help='googletest-style filter string.') 231 help='googletest-style filter string.')
229 filter_group.add_argument('--gtest-filter-file', dest='test_filter_file', 232 filter_group.add_argument('--gtest-filter-file', dest='test_filter_file',
230 help='Path to file that contains googletest-style ' 233 help='Path to file that contains googletest-style '
231 'filter strings. (Lines will be joined with ' 234 'filter strings. (Lines will be joined with '
232 '":" to create a single filter string.)') 235 '":" to create a single filter string.)')
233 236
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 help='The relative filepath to a file containing ' 337 help='The relative filepath to a file containing '
335 'command-line flags to set on the device') 338 'command-line flags to set on the device')
336 group.add_argument('--device-flags-file', default='', 339 group.add_argument('--device-flags-file', default='',
337 help='The relative filepath to a file containing ' 340 help='The relative filepath to a file containing '
338 'command-line flags to set on the device') 341 'command-line flags to set on the device')
339 group.add_argument('--isolate_file_path', 342 group.add_argument('--isolate_file_path',
340 '--isolate-file-path', 343 '--isolate-file-path',
341 dest='isolate_file_path', 344 dest='isolate_file_path',
342 help='.isolate file path to override the default ' 345 help='.isolate file path to override the default '
343 'path') 346 'path')
347 group.add_argument('--delete-stale-data', dest='delete_stale_data',
348 action='store_true',
349 help='Delete stale test data on the device.')
344 350
345 AddCommonOptions(parser) 351 AddCommonOptions(parser)
346 AddDeviceOptions(parser) 352 AddDeviceOptions(parser)
347 AddRemoteDeviceOptions(parser) 353 AddRemoteDeviceOptions(parser)
348 354
349 355
350 def ProcessInstrumentationOptions(args): 356 def ProcessInstrumentationOptions(args):
351 """Processes options/arguments and populate |options| with defaults. 357 """Processes options/arguments and populate |options| with defaults.
352 358
353 Args: 359 Args:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 args.screenshot_failures, 393 args.screenshot_failures,
388 args.wait_for_debugger, 394 args.wait_for_debugger,
389 args.coverage_dir, 395 args.coverage_dir,
390 args.test_apk, 396 args.test_apk,
391 args.test_apk_path, 397 args.test_apk_path,
392 args.test_apk_jar_path, 398 args.test_apk_jar_path,
393 args.test_runner, 399 args.test_runner,
394 args.test_support_apk_path, 400 args.test_support_apk_path,
395 args.device_flags, 401 args.device_flags,
396 args.isolate_file_path, 402 args.isolate_file_path,
397 args.set_asserts 403 args.set_asserts,
404 args.delete_stale_data
398 ) 405 )
399 406
400 407
401 def AddUIAutomatorTestOptions(parser): 408 def AddUIAutomatorTestOptions(parser):
402 """Adds UI Automator test options to |parser|.""" 409 """Adds UI Automator test options to |parser|."""
403 410
404 group = parser.add_argument_group('UIAutomator Test Options') 411 group = parser.add_argument_group('UIAutomator Test Options')
405 AddJavaTestOptions(group) 412 AddJavaTestOptions(group)
406 group.add_argument( 413 group.add_argument(
407 '--package', required=True, choices=constants.PACKAGE_INFO.keys(), 414 '--package', required=True, choices=constants.PACKAGE_INFO.keys(),
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 # into the gtest code. 648 # into the gtest code.
642 gtest_options = gtest_test_options.GTestOptions( 649 gtest_options = gtest_test_options.GTestOptions(
643 args.tool, 650 args.tool,
644 args.test_filter, 651 args.test_filter,
645 args.run_disabled, 652 args.run_disabled,
646 args.test_arguments, 653 args.test_arguments,
647 args.timeout, 654 args.timeout,
648 args.isolate_file_path, 655 args.isolate_file_path,
649 suite_name, 656 suite_name,
650 args.app_data_files, 657 args.app_data_files,
651 args.app_data_file_dir) 658 args.app_data_file_dir,
659 args.delete_stale_data)
652 runner_factory, tests = gtest_setup.Setup(gtest_options, devices) 660 runner_factory, tests = gtest_setup.Setup(gtest_options, devices)
653 661
654 results, test_exit_code = test_dispatcher.RunTests( 662 results, test_exit_code = test_dispatcher.RunTests(
655 tests, runner_factory, devices, shard=True, test_timeout=None, 663 tests, runner_factory, devices, shard=True, test_timeout=None,
656 num_retries=args.num_retries) 664 num_retries=args.num_retries)
657 665
658 if test_exit_code and exit_code != constants.ERROR_EXIT_CODE: 666 if test_exit_code and exit_code != constants.ERROR_EXIT_CODE:
659 exit_code = test_exit_code 667 exit_code = test_exit_code
660 668
661 report_results.LogFull( 669 report_results.LogFull(
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 if e.is_infra_error: 1043 if e.is_infra_error:
1036 return constants.INFRA_EXIT_CODE 1044 return constants.INFRA_EXIT_CODE
1037 return constants.ERROR_EXIT_CODE 1045 return constants.ERROR_EXIT_CODE
1038 except: # pylint: disable=W0702 1046 except: # pylint: disable=W0702
1039 logging.exception('Unrecognized error occurred.') 1047 logging.exception('Unrecognized error occurred.')
1040 return constants.ERROR_EXIT_CODE 1048 return constants.ERROR_EXIT_CODE
1041 1049
1042 1050
1043 if __name__ == '__main__': 1051 if __name__ == '__main__':
1044 sys.exit(main()) 1052 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698