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

Side by Side Diff: build/android/pylib/run_java_tests.py

Issue 11741025: Seperate apk_info and jar_info. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added TOO Created 7 years, 11 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/python_test_base.py ('k') | build/android/pylib/run_python_tests.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 (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 """Runs the Java tests. See more information on run_instrumentation_tests.py.""" 5 """Runs the Java tests. See more information on run_instrumentation_tests.py."""
6 6
7 import fnmatch 7 import fnmatch
8 import logging 8 import logging
9 import os 9 import os
10 import re 10 import re
11 import shutil 11 import shutil
12 import sys 12 import sys
13 import time 13 import time
14 14
15 import android_commands 15 import android_commands
16 import apk_info
17 from base_test_runner import BaseTestRunner 16 from base_test_runner import BaseTestRunner
18 from base_test_sharder import BaseTestSharder, SetTestsContainer 17 from base_test_sharder import BaseTestSharder, SetTestsContainer
19 import cmd_helper 18 import cmd_helper
20 import constants 19 import constants
21 import errors 20 import errors
22 from forwarder import Forwarder 21 from forwarder import Forwarder
23 from json_perf_parser import GetAverageRunInfoFromJSONString 22 from json_perf_parser import GetAverageRunInfoFromJSONString
24 from perf_tests_helper import PrintPerfResult 23 from perf_tests_helper import PrintPerfResult
25 import sharded_tests_queue 24 import sharded_tests_queue
26 from test_result import SingleTestResult, TestResults 25 from test_result import SingleTestResult, TestResults
26 from utils import apk_and_jar_info
27 from utils import jar_info
27 import valgrind_tools 28 import valgrind_tools
28 29
29 _PERF_TEST_ANNOTATION = 'PerfTest' 30 _PERF_TEST_ANNOTATION = 'PerfTest'
30 31
31 32
32 class FatalTestException(Exception): 33 class FatalTestException(Exception):
33 """A fatal test exception.""" 34 """A fatal test exception."""
34 pass 35 pass
35 36
36 37
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 The default is ChromeTest.apk. 107 The default is ChromeTest.apk.
107 ports_to_forward: A list of port numbers for which to set up forwarders. 108 ports_to_forward: A list of port numbers for which to set up forwarders.
108 Can be optionally requested by a test case. 109 Can be optionally requested by a test case.
109 Raises: 110 Raises:
110 FatalTestException: if coverage metadata is not available. 111 FatalTestException: if coverage metadata is not available.
111 """ 112 """
112 BaseTestRunner.__init__( 113 BaseTestRunner.__init__(
113 self, device, options.tool, shard_index, options.build_type) 114 self, device, options.tool, shard_index, options.build_type)
114 115
115 if not apks: 116 if not apks:
116 apks = [apk_info.ApkInfo(options.test_apk_path, 117 apks = [apk_and_jar_info.ApkAndJarInfo(options.test_apk_path,
117 options.test_apk_jar_path)] 118 options.test_apk_jar_path)]
118 119
119 self.build_type = options.build_type 120 self.build_type = options.build_type
120 self.install_apk = options.install_apk 121 self.install_apk = options.install_apk
121 self.test_data = options.test_data 122 self.test_data = options.test_data
122 self.save_perf_json = options.save_perf_json 123 self.save_perf_json = options.save_perf_json
123 self.screenshot_failures = options.screenshot_failures 124 self.screenshot_failures = options.screenshot_failures
124 self.wait_for_debugger = options.wait_for_debugger 125 self.wait_for_debugger = options.wait_for_debugger
125 self.disable_assertions = options.disable_assertions 126 self.disable_assertions = options.disable_assertions
126 127
127 self.tests_iter = tests_iter 128 self.tests_iter = tests_iter
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 default_size_annotation = 'SmallTest' 534 default_size_annotation = 'SmallTest'
534 535
535 def _GetTestsMissingAnnotation(test_apk): 536 def _GetTestsMissingAnnotation(test_apk):
536 test_size_annotations = frozenset(['Smoke', 'SmallTest', 'MediumTest', 537 test_size_annotations = frozenset(['Smoke', 'SmallTest', 'MediumTest',
537 'LargeTest', 'EnormousTest', 'FlakyTest', 538 'LargeTest', 'EnormousTest', 'FlakyTest',
538 'DisabledTest', 'Manual', 'PerfTest']) 539 'DisabledTest', 'Manual', 'PerfTest'])
539 tests_missing_annotations = [] 540 tests_missing_annotations = []
540 for test_method in test_apk.GetTestMethods(): 541 for test_method in test_apk.GetTestMethods():
541 annotations = frozenset(test_apk.GetTestAnnotations(test_method)) 542 annotations = frozenset(test_apk.GetTestAnnotations(test_method))
542 if (annotations.isdisjoint(test_size_annotations) and 543 if (annotations.isdisjoint(test_size_annotations) and
543 not apk_info.ApkInfo.IsPythonDrivenTest(test_method)): 544 not jar_info.JarInfo.IsPythonDrivenTest(test_method)):
544 tests_missing_annotations.append(test_method) 545 tests_missing_annotations.append(test_method)
545 return sorted(tests_missing_annotations) 546 return sorted(tests_missing_annotations)
546 547
547 if options.annotation: 548 if options.annotation:
548 available_tests = test_apk.GetAnnotatedTests(options.annotation) 549 available_tests = test_apk.GetAnnotatedTests(options.annotation)
549 if options.annotation.count(default_size_annotation) > 0: 550 if options.annotation.count(default_size_annotation) > 0:
550 tests_missing_annotations = _GetTestsMissingAnnotation(test_apk) 551 tests_missing_annotations = _GetTestsMissingAnnotation(test_apk)
551 if tests_missing_annotations: 552 if tests_missing_annotations:
552 logging.warning('The following tests do not contain any annotation. ' 553 logging.warning('The following tests do not contain any annotation. '
553 'Assuming "%s":\n%s', 554 'Assuming "%s":\n%s',
554 default_size_annotation, 555 default_size_annotation,
555 '\n'.join(tests_missing_annotations)) 556 '\n'.join(tests_missing_annotations))
556 available_tests += tests_missing_annotations 557 available_tests += tests_missing_annotations
557 else: 558 else:
558 available_tests = [m for m in test_apk.GetTestMethods() 559 available_tests = [m for m in test_apk.GetTestMethods()
559 if not apk_info.ApkInfo.IsPythonDrivenTest(m)] 560 if not jar_info.JarInfo.IsPythonDrivenTest(m)]
560 coverage = os.environ.get('EMMA_INSTRUMENT') == 'true' 561 coverage = os.environ.get('EMMA_INSTRUMENT') == 'true'
561 562
562 tests = [] 563 tests = []
563 if options.test_filter: 564 if options.test_filter:
564 # |available_tests| are in adb instrument format: package.path.class#test. 565 # |available_tests| are in adb instrument format: package.path.class#test.
565 filter_without_hash = options.test_filter.replace('#', '.') 566 filter_without_hash = options.test_filter.replace('#', '.')
566 tests = [t for t in available_tests 567 tests = [t for t in available_tests
567 if filter_without_hash in t.replace('#', '.')] 568 if filter_without_hash in t.replace('#', '.')]
568 else: 569 else:
569 tests = available_tests 570 tests = available_tests
(...skipping 14 matching lines...) Expand all
584 585
585 logging.info('Will run: %s', str(tests)) 586 logging.info('Will run: %s', str(tests))
586 587
587 if len(attached_devices) > 1 and (coverage or options.wait_for_debugger): 588 if len(attached_devices) > 1 and (coverage or options.wait_for_debugger):
588 logging.warning('Coverage / debugger can not be sharded, ' 589 logging.warning('Coverage / debugger can not be sharded, '
589 'using first available device') 590 'using first available device')
590 attached_devices = attached_devices[:1] 591 attached_devices = attached_devices[:1]
591 sharder = TestSharder(attached_devices, options, tests, apks) 592 sharder = TestSharder(attached_devices, options, tests, apks)
592 test_results = sharder.RunShardedTests() 593 test_results = sharder.RunShardedTests()
593 return test_results 594 return test_results
OLDNEW
« no previous file with comments | « build/android/pylib/python_test_base.py ('k') | build/android/pylib/run_python_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698