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

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

Issue 19537004: [Android] Converts host driven tests to common test_dispatcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sharding_refactoring
Patch Set: 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
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 TODO(gkanwar): 9 TODO(gkanwar):
10 * Add options to run Monkey tests. 10 * Add options to run Monkey tests.
11 """ 11 """
12 12
13 import collections 13 import collections
14 import optparse 14 import optparse
15 import os 15 import os
16 import shutil 16 import shutil
17 import sys 17 import sys
18 18
19 from pylib import cmd_helper 19 from pylib import cmd_helper
20 from pylib import constants 20 from pylib import constants
21 from pylib import ports 21 from pylib import ports
22 from pylib.base import base_test_result 22 from pylib.base import base_test_result
23 from pylib.base import test_dispatcher 23 from pylib.base import test_dispatcher
24 from pylib.browsertests import setup as browsertests_setup 24 from pylib.browsertests import setup as browsertests_setup
25 from pylib.gtest import setup as gtest_setup 25 from pylib.gtest import setup as gtest_setup
26 from pylib.gtest import gtest_config 26 from pylib.gtest import gtest_config
27 from pylib.host_driven import run_python_tests as python_dispatch 27 from pylib.host_driven import setup as host_driven_setup
bulach 2013/07/23 17:27:52 oh, I see where the setup is coming from... :-/ we
gkanwar1 2013/07/23 18:38:55 See my other comment.
28 from pylib.instrumentation import setup as instrumentation_setup 28 from pylib.instrumentation import setup as instrumentation_setup
29 from pylib.uiautomator import setup as uiautomator_setup 29 from pylib.uiautomator import setup as uiautomator_setup
30 from pylib.utils import report_results 30 from pylib.utils import report_results
31 from pylib.utils import run_tests_helper 31 from pylib.utils import run_tests_helper
32 32
33 33
34 _SDK_OUT_DIR = os.path.join(constants.DIR_SOURCE_ROOT, 'out') 34 _SDK_OUT_DIR = os.path.join(constants.DIR_SOURCE_ROOT, 'out')
35 35
36 36
37 def AddBuildTypeOption(option_parser): 37 def AddBuildTypeOption(option_parser):
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 tests, runner_factory, options.wait_for_debugger, 437 tests, runner_factory, options.wait_for_debugger,
438 options.test_device, 438 options.test_device,
439 shard=True, 439 shard=True,
440 build_type=options.build_type, 440 build_type=options.build_type,
441 test_timeout=None, 441 test_timeout=None,
442 num_retries=options.num_retries) 442 num_retries=options.num_retries)
443 443
444 results.AddTestRunResults(test_results) 444 results.AddTestRunResults(test_results)
445 445
446 if options.run_python_tests: 446 if options.run_python_tests:
447 test_results, test_exit_code = ( 447 runner_factory, tests = host_driven_setup.InstrumentationSetup(
448 python_dispatch.DispatchPythonTests(options)) 448 options.python_test_root, options.official_build, options.annotations,
449 options.exclude_annotations, options.test_filter, options.tool,
450 options.build_type, options.push_deps, options.cleanup_test_files,
451 options.test_apk_path, options.test_apk_jar_path, options.test_data,
452 options.install_apk, options.save_perf_json,
453 options.screenshot_failures, options.wait_for_debugger,
454 options.disable_assertions)
455
456 test_results, test_exit_code = test_dispatcher.RunTests(
457 tests, runner_factory, False,
458 options.test_device,
459 shard=True,
460 build_type=options.build_type,
461 test_timeout=None,
462 num_retries=options.num_retries)
449 463
450 results.AddTestRunResults(test_results) 464 results.AddTestRunResults(test_results)
451 465
452 # Only allow exit code escalation 466 # Only allow exit code escalation
453 if test_exit_code and exit_code != constants.ERROR_EXIT_CODE: 467 if test_exit_code and exit_code != constants.ERROR_EXIT_CODE:
454 exit_code = test_exit_code 468 exit_code = test_exit_code
455 469
456 report_results.LogFull( 470 report_results.LogFull(
457 results=results, 471 results=results,
458 test_type='Instrumentation', 472 test_type='Instrumentation',
(...skipping 24 matching lines...) Expand all
483 test_results, exit_code = test_dispatcher.RunTests( 497 test_results, exit_code = test_dispatcher.RunTests(
484 tests, runner_factory, False, options.test_device, 498 tests, runner_factory, False, options.test_device,
485 shard=True, 499 shard=True,
486 build_type=options.build_type, 500 build_type=options.build_type,
487 test_timeout=None, 501 test_timeout=None,
488 num_retries=options.num_retries) 502 num_retries=options.num_retries)
489 503
490 results.AddTestRunResults(test_results) 504 results.AddTestRunResults(test_results)
491 505
492 if options.run_python_tests: 506 if options.run_python_tests:
493 test_results, test_exit_code = ( 507 # TODO(gkanwar): Fix!
494 python_dispatch.DispatchPythonTests(options)) 508 runner_factory, tests = host_driven_setup.InstrumentationSetup(
509 options.python_test_root, options.official_build, options.annotations,
510 options.exclude_annotations, options.test_filter, options.tool,
511 options.build_type, options.push_deps, options.cleanup_test_files,
512 options.test_apk_path, options.test_apk_jar_path, options.test_data,
513 options.install_apk, options.save_perf_json,
514 options.screenshot_failures, options.wait_for_debugger,
515 options.disable_assertion)
516
517 test_results, test_exit_code = test_dispatcher.RunTests(
518 tests, runner_factory, False,
519 options.test_device,
520 shard=True,
521 build_type=options.build_type,
522 test_timeout=None,
523 num_retries=options.num_retries)
495 524
496 results.AddTestRunResults(test_results) 525 results.AddTestRunResults(test_results)
497 526
498 # Only allow exit code escalation 527 # Only allow exit code escalation
499 if test_exit_code and exit_code != constants.ERROR_EXIT_CODE: 528 if test_exit_code and exit_code != constants.ERROR_EXIT_CODE:
500 exit_code = test_exit_code 529 exit_code = test_exit_code
501 530
502 report_results.LogFull( 531 report_results.LogFull(
503 results=results, 532 results=results,
504 test_type='UIAutomator', 533 test_type='UIAutomator',
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 return 0 673 return 0
645 command = argv[1] 674 command = argv[1]
646 VALID_COMMANDS[command].add_options_func(option_parser) 675 VALID_COMMANDS[command].add_options_func(option_parser)
647 options, args = option_parser.parse_args(argv) 676 options, args = option_parser.parse_args(argv)
648 return VALID_COMMANDS[command].run_command_func( 677 return VALID_COMMANDS[command].run_command_func(
649 command, options, args, option_parser) 678 command, options, args, option_parser)
650 679
651 680
652 if __name__ == '__main__': 681 if __name__ == '__main__':
653 sys.exit(main(sys.argv)) 682 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698