OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 """Helper class for instrumenation test jar.""" | 5 """Helper class for instrumenation test jar.""" |
6 # pylint: disable=W0702 | 6 # pylint: disable=W0702 |
7 | 7 |
8 import collections | 8 import collections |
9 import logging | 9 import logging |
10 import os | 10 import os |
(...skipping 23 matching lines...) Expand all Loading... |
34 _PROGUARD_METHOD_RE = re.compile(r'\s*?- Method:\s*(\S*)[(].*$') | 34 _PROGUARD_METHOD_RE = re.compile(r'\s*?- Method:\s*(\S*)[(].*$') |
35 _PROGUARD_ANNOTATION_RE = re.compile(r'\s*?- Annotation \[L(\S*);\]:$') | 35 _PROGUARD_ANNOTATION_RE = re.compile(r'\s*?- Annotation \[L(\S*);\]:$') |
36 _PROGUARD_ANNOTATION_CONST_RE = ( | 36 _PROGUARD_ANNOTATION_CONST_RE = ( |
37 re.compile(r'\s*?- Constant element value.*$')) | 37 re.compile(r'\s*?- Constant element value.*$')) |
38 _PROGUARD_ANNOTATION_VALUE_RE = re.compile(r'\s*?- \S+? \[(.*)\]$') | 38 _PROGUARD_ANNOTATION_VALUE_RE = re.compile(r'\s*?- \S+? \[(.*)\]$') |
39 | 39 |
40 def __init__(self, jar_path): | 40 def __init__(self, jar_path): |
41 if not os.path.exists(jar_path): | 41 if not os.path.exists(jar_path): |
42 raise Exception('%s not found, please build it' % jar_path) | 42 raise Exception('%s not found, please build it' % jar_path) |
43 | 43 |
44 sdk_root = os.getenv('ANDROID_SDK_ROOT', constants.ANDROID_SDK_ROOT) | 44 self._PROGUARD_PATH = os.path.join(constants.ANDROID_SDK_ROOT, |
45 self._PROGUARD_PATH = os.path.join(sdk_root, | |
46 'tools/proguard/bin/proguard.sh') | 45 'tools/proguard/bin/proguard.sh') |
47 if not os.path.exists(self._PROGUARD_PATH): | 46 if not os.path.exists(self._PROGUARD_PATH): |
48 self._PROGUARD_PATH = os.path.join(os.environ['ANDROID_BUILD_TOP'], | 47 self._PROGUARD_PATH = os.path.join(os.environ['ANDROID_BUILD_TOP'], |
49 'external/proguard/bin/proguard.sh') | 48 'external/proguard/bin/proguard.sh') |
50 self._jar_path = jar_path | 49 self._jar_path = jar_path |
51 self._annotation_map = collections.defaultdict(list) | 50 self._annotation_map = collections.defaultdict(list) |
52 self._pickled_proguard_name = self._jar_path + '-proguard.pickle' | 51 self._pickled_proguard_name = self._jar_path + '-proguard.pickle' |
53 self._test_methods = [] | 52 self._test_methods = [] |
54 if not self._GetCachedProguardData(): | 53 if not self._GetCachedProguardData(): |
55 self._GetProguardData() | 54 self._GetProguardData() |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 sanitized_test_names[t] for t in unittest_util.FilterTestNames( | 225 sanitized_test_names[t] for t in unittest_util.FilterTestNames( |
227 sanitized_test_names.keys(), test_filter.replace('#', '.'))] | 226 sanitized_test_names.keys(), test_filter.replace('#', '.'))] |
228 else: | 227 else: |
229 tests = available_tests | 228 tests = available_tests |
230 | 229 |
231 return tests | 230 return tests |
232 | 231 |
233 @staticmethod | 232 @staticmethod |
234 def IsHostDrivenTest(test): | 233 def IsHostDrivenTest(test): |
235 return 'pythonDrivenTests' in test | 234 return 'pythonDrivenTests' in test |
OLD | NEW |