OLD | NEW |
---|---|
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import logging | 5 import logging |
6 import os | 6 import os |
7 import re | 7 import re |
8 import tempfile | 8 import tempfile |
9 | 9 |
10 from devil.android import apk_helper | 10 from devil.android import apk_helper |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 | 137 |
138 def __init__(self, args, isolate_delegate, error_func): | 138 def __init__(self, args, isolate_delegate, error_func): |
139 super(GtestTestInstance, self).__init__() | 139 super(GtestTestInstance, self).__init__() |
140 # TODO(jbudorick): Support multiple test suites. | 140 # TODO(jbudorick): Support multiple test suites. |
141 if len(args.suite_name) > 1: | 141 if len(args.suite_name) > 1: |
142 raise ValueError('Platform mode currently supports only 1 gtest suite') | 142 raise ValueError('Platform mode currently supports only 1 gtest suite') |
143 self._extract_test_list_from_filter = args.extract_test_list_from_filter | 143 self._extract_test_list_from_filter = args.extract_test_list_from_filter |
144 self._shard_timeout = args.shard_timeout | 144 self._shard_timeout = args.shard_timeout |
145 self._skip_clear_data = args.skip_clear_data | 145 self._skip_clear_data = args.skip_clear_data |
146 self._suite = args.suite_name[0] | 146 self._suite = args.suite_name[0] |
147 self._exe_path = args.executable_path | |
147 | 148 |
148 self._exe_path = os.path.join(constants.GetOutDirectory(), | 149 # GYP: |
149 self._suite) | 150 if args.executable_path: |
151 self._exe_path = os.path.abspath(args.executable_path) | |
152 else: | |
153 # TODO(agrieve): Remove hardcoding after recipes are updated. | |
jbudorick
2016/03/30 19:33:38
:( :( :(
I would prefer that we add --executable-
agrieve
2016/03/30 19:52:57
I did add --executable-path, and do use it when pr
jbudorick
2016/03/30 19:55:21
I mean that I'd prefer adding it separately from t
| |
154 if self._suite == 'sandbox_linux_unittests': | |
155 exe_path = os.path.join(constants.GetOutDirectory(), 'obj', 'sandbox', | |
156 'linux', 'sandbox_linux_unittests', | |
157 'sandbox_linux_unittests') | |
158 elif self._suite == 'breakpad_unittests': | |
159 exe_path = os.path.join(constants.GetOutDirectory(), 'obj', 'breakpad', | |
160 'breakpad_unittests', 'breakpad_unittests') | |
161 if os.path.exists(exe_path): | |
162 self._exe_path = exe_path | |
163 else: | |
164 # GYP location: | |
165 exe_path = os.path.join(constants.GetOutDirectory(), self._suite) | |
166 if os.path.exists(exe_path): | |
167 self._exe_path = exe_path | |
150 | 168 |
151 incremental_part = '' | 169 incremental_part = '' |
152 if args.test_apk_incremental_install_script: | 170 if args.test_apk_incremental_install_script: |
153 incremental_part = '_incremental' | 171 incremental_part = '_incremental' |
154 | 172 |
155 apk_path = os.path.join( | 173 apk_path = os.path.join( |
156 constants.GetOutDirectory(), '%s_apk' % self._suite, | 174 constants.GetOutDirectory(), '%s_apk' % self._suite, |
157 '%s-debug%s.apk' % (self._suite, incremental_part)) | 175 '%s-debug%s.apk' % (self._suite, incremental_part)) |
158 self._test_apk_incremental_install_script = ( | 176 self._test_apk_incremental_install_script = ( |
159 args.test_apk_incremental_install_script) | 177 args.test_apk_incremental_install_script) |
160 if not os.path.exists(apk_path): | 178 if not os.path.exists(apk_path): |
161 self._apk_helper = None | 179 self._apk_helper = None |
162 else: | 180 else: |
163 self._apk_helper = apk_helper.ApkHelper(apk_path) | 181 self._apk_helper = apk_helper.ApkHelper(apk_path) |
164 self._extras = { | 182 self._extras = { |
165 _EXTRA_NATIVE_TEST_ACTIVITY: self._apk_helper.GetActivityName(), | 183 _EXTRA_NATIVE_TEST_ACTIVITY: self._apk_helper.GetActivityName(), |
166 } | 184 } |
167 if self._suite in RUN_IN_SUB_THREAD_TEST_SUITES: | 185 if self._suite in RUN_IN_SUB_THREAD_TEST_SUITES: |
168 self._extras[_EXTRA_RUN_IN_SUB_THREAD] = 1 | 186 self._extras[_EXTRA_RUN_IN_SUB_THREAD] = 1 |
169 if self._suite in BROWSER_TEST_SUITES: | 187 if self._suite in BROWSER_TEST_SUITES: |
170 self._extras[_EXTRA_SHARD_SIZE_LIMIT] = 1 | 188 self._extras[_EXTRA_SHARD_SIZE_LIMIT] = 1 |
171 self._extras[EXTRA_SHARD_NANO_TIMEOUT] = int(1e9 * self._shard_timeout) | 189 self._extras[EXTRA_SHARD_NANO_TIMEOUT] = int(1e9 * self._shard_timeout) |
172 self._shard_timeout = 900 | 190 self._shard_timeout = 900 |
173 | 191 |
174 if not os.path.exists(self._exe_path): | |
175 self._exe_path = None | |
176 if not self._apk_helper and not self._exe_path: | 192 if not self._apk_helper and not self._exe_path: |
177 error_func('Could not find apk or executable for %s' % self._suite) | 193 error_func('Could not find apk or executable for %s' % self._suite) |
178 | 194 |
179 self._data_deps = [] | 195 self._data_deps = [] |
180 if args.test_filter: | 196 if args.test_filter: |
181 self._gtest_filter = args.test_filter | 197 self._gtest_filter = args.test_filter |
182 elif args.test_filter_file: | 198 elif args.test_filter_file: |
183 with open(args.test_filter_file, 'r') as f: | 199 with open(args.test_filter_file, 'r') as f: |
184 self._gtest_filter = ':'.join(l.strip() for l in f) | 200 self._gtest_filter = ':'.join(l.strip() for l in f) |
185 else: | 201 else: |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
397 result_type = None | 413 result_type = None |
398 | 414 |
399 return results | 415 return results |
400 | 416 |
401 #override | 417 #override |
402 def TearDown(self): | 418 def TearDown(self): |
403 """Clear the mappings created by SetUp.""" | 419 """Clear the mappings created by SetUp.""" |
404 if self._isolate_delegate: | 420 if self._isolate_delegate: |
405 self._isolate_delegate.Clear() | 421 self._isolate_delegate.Clear() |
406 | 422 |
OLD | NEW |