OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 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 """Generates test runner factory and tests for GTests.""" | 5 """Generates test runner factory and tests for GTests.""" |
6 # pylint: disable=W0212 | 6 # pylint: disable=W0212 |
7 | 7 |
8 import fnmatch | 8 import fnmatch |
9 import glob | 9 import glob |
10 import logging | 10 import logging |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 if os.path.isdir(p): | 157 if os.path.isdir(p): |
158 shutil.rmtree(p) | 158 shutil.rmtree(p) |
159 else: | 159 else: |
160 os.remove(p) | 160 os.remove(p) |
161 finally: | 161 finally: |
162 os.chdir(old_cwd) | 162 os.chdir(old_cwd) |
163 | 163 |
164 # On Android, all pak files need to be in the top-level 'paks' directory. | 164 # On Android, all pak files need to be in the top-level 'paks' directory. |
165 paks_dir = os.path.join(constants.ISOLATE_DEPS_DIR, 'paks') | 165 paks_dir = os.path.join(constants.ISOLATE_DEPS_DIR, 'paks') |
166 os.mkdir(paks_dir) | 166 os.mkdir(paks_dir) |
167 for root, _, filenames in os.walk(os.path.join(constants.ISOLATE_DEPS_DIR, | 167 |
168 'out')): | 168 deps_out_dir = os.path.join( |
| 169 constants.ISOLATE_DEPS_DIR, |
| 170 os.path.relpath(os.path.join(constants.GetOutDirectory(), os.pardir), |
| 171 constants.DIR_SOURCE_ROOT)) |
| 172 for root, _, filenames in os.walk(deps_out_dir): |
169 for filename in fnmatch.filter(filenames, '*.pak'): | 173 for filename in fnmatch.filter(filenames, '*.pak'): |
170 shutil.move(os.path.join(root, filename), paks_dir) | 174 shutil.move(os.path.join(root, filename), paks_dir) |
171 | 175 |
172 # Move everything in PRODUCT_DIR to top level. | 176 # Move everything in PRODUCT_DIR to top level. |
173 deps_product_dir = os.path.join(constants.ISOLATE_DEPS_DIR, 'out', | 177 deps_product_dir = os.path.join(deps_out_dir, constants.GetBuildType()) |
174 constants.GetBuildType()) | |
175 if os.path.isdir(deps_product_dir): | 178 if os.path.isdir(deps_product_dir): |
176 for p in os.listdir(deps_product_dir): | 179 for p in os.listdir(deps_product_dir): |
177 shutil.move(os.path.join(deps_product_dir, p), constants.ISOLATE_DEPS_DIR) | 180 shutil.move(os.path.join(deps_product_dir, p), constants.ISOLATE_DEPS_DIR) |
178 os.rmdir(deps_product_dir) | 181 os.rmdir(deps_product_dir) |
179 os.rmdir(os.path.join(constants.ISOLATE_DEPS_DIR, 'out')) | 182 os.rmdir(deps_out_dir) |
180 | 183 |
181 | 184 |
182 def _GetDisabledTestsFilterFromFile(suite_name): | 185 def _GetDisabledTestsFilterFromFile(suite_name): |
183 """Returns a gtest filter based on the *_disabled file. | 186 """Returns a gtest filter based on the *_disabled file. |
184 | 187 |
185 Args: | 188 Args: |
186 suite_name: Name of the test suite (e.g. base_unittests). | 189 suite_name: Name of the test suite (e.g. base_unittests). |
187 | 190 |
188 Returns: | 191 Returns: |
189 A gtest filter which excludes disabled tests. | 192 A gtest filter which excludes disabled tests. |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 if test_options.gtest_filter: | 331 if test_options.gtest_filter: |
329 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter) | 332 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter) |
330 | 333 |
331 # Coalesce unit tests into a single test per device | 334 # Coalesce unit tests into a single test per device |
332 if test_options.suite_name != 'content_browsertests': | 335 if test_options.suite_name != 'content_browsertests': |
333 num_devices = len(devices) | 336 num_devices = len(devices) |
334 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)] | 337 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)] |
335 tests = [t for t in tests if t] | 338 tests = [t for t in tests if t] |
336 | 339 |
337 return (TestRunnerFactory, tests) | 340 return (TestRunnerFactory, tests) |
OLD | NEW |