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 import copy | 5 import copy |
6 import fnmatch | 6 import fnmatch |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 | 9 |
10 from pylib import android_commands | 10 from pylib import android_commands |
(...skipping 17 matching lines...) Expand all Loading... | |
28 build_type: 'Release' or 'Debug'. | 28 build_type: 'Release' or 'Debug'. |
29 | 29 |
30 Returns: | 30 Returns: |
31 A list of tuples containing the suite and absolute path. | 31 A list of tuples containing the suite and absolute path. |
32 Ex. ('content_unittests', | 32 Ex. ('content_unittests', |
33 '/tmp/chrome/src/out/Debug/content_unittests_apk/' | 33 '/tmp/chrome/src/out/Debug/content_unittests_apk/' |
34 'content_unittests-debug.apk') | 34 'content_unittests-debug.apk') |
35 """ | 35 """ |
36 test_suite_dir = os.path.join(cmd_helper.OutDirectory.get(), build_type) | 36 test_suite_dir = os.path.join(cmd_helper.OutDirectory.get(), build_type) |
37 if option_test_suite: | 37 if option_test_suite: |
38 all_test_suites = [option_test_suite] | 38 all_test_suites = [gtest_config.Suite(exe, option_test_suite)] |
39 else: | 39 else: |
40 all_test_suites = gtest_config.STABLE_TEST_SUITES | 40 all_test_suites = gtest_config.STABLE_TEST_SUITES |
41 | 41 |
42 if exe: | 42 def GetQualifiedSuite(suite): |
frankf
2013/03/12 17:46:31
nit: let's move this to the top of the outer metho
Isaac (away)
2013/03/13 03:24:30
Done.
| |
43 qualified_test_suites = [os.path.join(test_suite_dir, t) | 43 if suite.is_exe_suite: |
44 for t in all_test_suites] | 44 relpath = suite.name |
45 else: | 45 else: |
46 # out/(Debug|Release)/$SUITE_apk/$SUITE-debug.apk | 46 # out/(Debug|Release)/$SUITE_apk/$SUITE-debug.apk |
47 qualified_test_suites = [os.path.join(test_suite_dir, | 47 relpath = os.path.join(suite.name + '_apk', suite.name + '-debug.apk') |
48 t + '_apk', | 48 return suite.name, os.path.join(test_suite_dir, relpath) |
49 t + '-debug.apk') | 49 |
50 for t in all_test_suites] | 50 # List of tuples (suite_name, suite_path) |
51 for t, q in zip(all_test_suites, qualified_test_suites): | 51 qualified_test_suites = map(GetQualifiedSuite, all_test_suites) |
52 | |
53 for t, q in qualified_test_suites: | |
52 if not os.path.exists(q): | 54 if not os.path.exists(q): |
53 raise Exception('Test suite %s not found in %s.\n' | 55 raise Exception('Test suite %s not found in %s.\n' |
54 'Supported test suites:\n %s\n' | 56 'Supported test suites:\n %s\n' |
55 'Ensure it has been built.\n' % | 57 'Ensure it has been built.\n' % |
56 (t, q, gtest_config.STABLE_TEST_SUITES)) | 58 (t, q, gtest_config.STABLE_TEST_SUITES)) |
57 return zip(all_test_suites, qualified_test_suites) | 59 return qualified_test_suites |
58 | 60 |
59 | 61 |
60 def GetTestsFromDevice(runner): | 62 def GetTestsFromDevice(runner): |
61 """Get a list of tests from a device, excluding disabled tests. | 63 """Get a list of tests from a device, excluding disabled tests. |
62 | 64 |
63 Args: | 65 Args: |
64 runner: a TestRunner. | 66 runner: a TestRunner. |
65 """ | 67 """ |
66 # The executable/apk needs to be copied before we can call GetAllTests. | 68 # The executable/apk needs to be copied before we can call GetAllTests. |
67 runner.test_package.StripAndCopyExecutable() | 69 runner.test_package.StripAndCopyExecutable() |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
208 failures = 0 | 210 failures = 0 |
209 for suite_name, suite_path in all_test_suites: | 211 for suite_name, suite_path in all_test_suites: |
210 # Give each test suite its own copy of options. | 212 # Give each test suite its own copy of options. |
211 test_options = copy.deepcopy(options) | 213 test_options = copy.deepcopy(options) |
212 test_options.test_suite = suite_path | 214 test_options.test_suite = suite_path |
213 failures += _RunATestSuite(test_options, suite_name) | 215 failures += _RunATestSuite(test_options, suite_name) |
214 | 216 |
215 if options.use_xvfb: | 217 if options.use_xvfb: |
216 framebuffer.Stop() | 218 framebuffer.Stop() |
217 return failures | 219 return failures |
OLD | NEW |