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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 if os.path.isdir(p): | 155 if os.path.isdir(p): |
156 shutil.rmtree(p) | 156 shutil.rmtree(p) |
157 else: | 157 else: |
158 os.remove(p) | 158 os.remove(p) |
159 finally: | 159 finally: |
160 os.chdir(old_cwd) | 160 os.chdir(old_cwd) |
161 | 161 |
162 # On Android, all pak files need to be in the top-level 'paks' directory. | 162 # On Android, all pak files need to be in the top-level 'paks' directory. |
163 paks_dir = os.path.join(constants.ISOLATE_DEPS_DIR, 'paks') | 163 paks_dir = os.path.join(constants.ISOLATE_DEPS_DIR, 'paks') |
164 os.mkdir(paks_dir) | 164 os.mkdir(paks_dir) |
165 for root, _, filenames in os.walk(os.path.join(constants.ISOLATE_DEPS_DIR, | 165 |
166 'out')): | 166 deps_out_dir = os.path.join( |
167 constants.ISOLATE_DEPS_DIR, os.environ.get('CHROMIUM_OUT_DIR', 'out')) | |
frankf
2014/03/05 01:33:59
You're duplicating constants.GetOutDirectory(). Al
jbudorick
2014/03/07 07:15:28
I tried constants.GetOutDirectory() at first becau
frankf
2014/03/10 17:35:34
Why can't we do os.path.join(constants.GetOutDirec
jbudorick
2014/03/11 14:25:09
We can, and I'm ok with doing so, but how is that
frankf
2014/03/11 16:27:34
It's DRY. Also you're encapsulating how the path i
| |
168 for root, _, filenames in os.walk(deps_out_dir): | |
167 for filename in fnmatch.filter(filenames, '*.pak'): | 169 for filename in fnmatch.filter(filenames, '*.pak'): |
168 shutil.move(os.path.join(root, filename), paks_dir) | 170 shutil.move(os.path.join(root, filename), paks_dir) |
169 | 171 |
170 # Move everything in PRODUCT_DIR to top level. | 172 # Move everything in PRODUCT_DIR to top level. |
171 deps_product_dir = os.path.join(constants.ISOLATE_DEPS_DIR, 'out', | 173 deps_product_dir = os.path.join(deps_out_dir, constants.GetBuildType()) |
172 constants.GetBuildType()) | |
173 if os.path.isdir(deps_product_dir): | 174 if os.path.isdir(deps_product_dir): |
174 for p in os.listdir(deps_product_dir): | 175 for p in os.listdir(deps_product_dir): |
175 shutil.move(os.path.join(deps_product_dir, p), constants.ISOLATE_DEPS_DIR) | 176 shutil.move(os.path.join(deps_product_dir, p), constants.ISOLATE_DEPS_DIR) |
176 os.rmdir(deps_product_dir) | 177 os.rmdir(deps_product_dir) |
177 os.rmdir(os.path.join(constants.ISOLATE_DEPS_DIR, 'out')) | 178 os.rmdir(deps_out_dir) |
178 | 179 |
179 | 180 |
180 def _GetDisabledTestsFilterFromFile(suite_name): | 181 def _GetDisabledTestsFilterFromFile(suite_name): |
181 """Returns a gtest filter based on the *_disabled file. | 182 """Returns a gtest filter based on the *_disabled file. |
182 | 183 |
183 Args: | 184 Args: |
184 suite_name: Name of the test suite (e.g. base_unittests). | 185 suite_name: Name of the test suite (e.g. base_unittests). |
185 | 186 |
186 Returns: | 187 Returns: |
187 A gtest filter which excludes disabled tests. | 188 A gtest filter which excludes disabled tests. |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
316 if test_options.gtest_filter: | 317 if test_options.gtest_filter: |
317 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter) | 318 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter) |
318 | 319 |
319 # Coalesce unit tests into a single test per device | 320 # Coalesce unit tests into a single test per device |
320 if test_options.suite_name != 'content_browsertests': | 321 if test_options.suite_name != 'content_browsertests': |
321 num_devices = len(devices) | 322 num_devices = len(devices) |
322 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)] | 323 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)] |
323 tests = [t for t in tests if t] | 324 tests = [t for t in tests if t] |
324 | 325 |
325 return (TestRunnerFactory, tests) | 326 return (TestRunnerFactory, tests) |
OLD | NEW |