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

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

Issue 10703165: Android: adds instrumentation test runners. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « build/android/pylib/tests_annotations.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
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 """Runs both the Python and Java tests."""
8
9 import sys
10 import time
11
12 from pylib import apk_info
13 from pylib import test_options_parser
14 from pylib import run_java_tests
15 from pylib import run_python_tests
16 from pylib import run_tests_helper
17 from pylib.test_result import TestResults
18
19
20 def SummarizeResults(java_results, python_results, annotation):
21 """Summarize the results from the various test types.
22
23 Args:
24 java_results: a TestResults object with java test case results.
25 python_results: a TestResults object with python test case results.
26 annotation: the annotation used for these results.
27
28 Returns:
29 A tuple (all_results, summary_string, num_failing)
30 """
31 all_results = TestResults.FromTestResults([java_results, python_results])
32 summary_string = all_results.LogFull('Instrumentation', annotation)
33 num_failing = (len(all_results.failed) + len(all_results.crashed) +
34 len(all_results.unknown))
35 return all_results, summary_string, num_failing
36
37
38 def DispatchInstrumentationTests(options):
39 """Dispatches the Java and Python instrumentation tests, sharding if possible.
40
41 Uses the logging module to print the combined final results and
42 summary of the Java and Python tests. If the java_only option is set, only
43 the Java tests run. If the python_only option is set, only the python tests
44 run. If neither are set, run both Java and Python tests.
45
46 Args:
47 options: command-line options for running the Java and Python tests.
48
49 Returns:
50 An integer representing the number of failing tests.
51 """
52 start_date = int(time.time() * 1000)
53 java_results = TestResults()
54 python_results = TestResults()
55
56 if options.run_java_tests:
57 java_results = run_java_tests.DispatchJavaTests(
58 options,
59 [apk_info.ApkInfo(options.test_apk_path, options.test_apk_jar_path)])
60 if options.run_python_tests:
61 python_results = run_python_tests.DispatchPythonTests(options)
62
63 all_results, summary_string, num_failing = SummarizeResults(
64 java_results, python_results, options.annotation)
65 return num_failing
66
67
68 def main(argv):
69 options = test_options_parser.ParseInstrumentationArgs(argv)
70 run_tests_helper.SetLogLevel(options.verbose_count)
71 return DispatchInstrumentationTests(options)
72
73
74 if __name__ == '__main__':
75 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « build/android/pylib/tests_annotations.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698