| 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 fnmatch | 5 import fnmatch |
| 6 import logging | 6 import logging |
| 7 import os | 7 import os |
| 8 | 8 |
| 9 from pylib import cmd_helper | 9 from pylib import cmd_helper |
| 10 from pylib import constants |
| 10 from pylib.base import base_test_sharder | 11 from pylib.base import base_test_sharder |
| 11 from pylib.gtest import test_runner | 12 from pylib.gtest import test_runner |
| 12 | 13 |
| 13 class TestSharder(base_test_sharder.BaseTestSharder): | 14 class TestSharder(base_test_sharder.BaseTestSharder): |
| 14 """Responsible for sharding the tests on the connected devices.""" | 15 """Responsible for sharding the tests on the connected devices.""" |
| 15 | 16 |
| 16 def __init__(self, attached_devices, test_suite, gtest_filter, | 17 def __init__(self, attached_devices, test_suite, gtest_filter, |
| 17 test_arguments, timeout, cleanup_test_files, tool, | 18 test_arguments, timeout, cleanup_test_files, tool, |
| 18 build_type, in_webkit_checkout): | 19 build_type, in_webkit_checkout): |
| 19 super(TestSharder, self).__init__(attached_devices, build_type) | 20 super(TestSharder, self).__init__(attached_devices, build_type) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 runner = test_runner.TestRunner( | 62 runner = test_runner.TestRunner( |
| 62 device, | 63 device, |
| 63 self.test_suite, | 64 self.test_suite, |
| 64 self.gtest_filter, | 65 self.gtest_filter, |
| 65 self.test_arguments, | 66 self.test_arguments, |
| 66 self.timeout, | 67 self.timeout, |
| 67 self.cleanup_test_files, | 68 self.cleanup_test_files, |
| 68 self.tool, | 69 self.tool, |
| 69 0, | 70 0, |
| 70 self.build_type, | 71 self.build_type, |
| 71 self.in_webkit_checkout) | 72 self.in_webkit_checkout, |
| 73 'org.chromium.native_test', |
| 74 'org.chromium.native_test.ChromeNativeTestActivity', |
| 75 'chrome-native-tests-command-line') |
| 72 # The executable/apk needs to be copied before we can call GetAllTests. | 76 # The executable/apk needs to be copied before we can call GetAllTests. |
| 73 runner.test_package.StripAndCopyExecutable() | 77 runner.test_package.StripAndCopyExecutable() |
| 74 all_tests = runner.test_package.GetAllTests() | 78 all_tests = runner.test_package.GetAllTests() |
| 75 disabled_list = runner.GetDisabledTests() | 79 disabled_list = runner.GetDisabledTests() |
| 76 # Only includes tests that do not have any match in the disabled list. | 80 # Only includes tests that do not have any match in the disabled list. |
| 77 all_tests = filter(lambda t: | 81 all_tests = filter(lambda t: |
| 78 not any([fnmatch.fnmatch(t, disabled_pattern) | 82 not any([fnmatch.fnmatch(t, disabled_pattern) |
| 79 for disabled_pattern in disabled_list]), | 83 for disabled_pattern in disabled_list]), |
| 80 all_tests) | 84 all_tests) |
| 81 return all_tests | 85 return all_tests |
| (...skipping 12 matching lines...) Expand all Loading... |
| 94 shard_test_list = self.tests[index::device_num] | 98 shard_test_list = self.tests[index::device_num] |
| 95 test_filter = ':'.join(shard_test_list) + self.gtest_filter | 99 test_filter = ':'.join(shard_test_list) + self.gtest_filter |
| 96 return test_runner.TestRunner( | 100 return test_runner.TestRunner( |
| 97 device, | 101 device, |
| 98 self.test_suite, | 102 self.test_suite, |
| 99 test_filter, | 103 test_filter, |
| 100 self.test_arguments, | 104 self.test_arguments, |
| 101 self.timeout, | 105 self.timeout, |
| 102 self.cleanup_test_files, self.tool, index, | 106 self.cleanup_test_files, self.tool, index, |
| 103 self.build_type, | 107 self.build_type, |
| 104 self.in_webkit_checkout) | 108 self.in_webkit_checkout, |
| 109 constants.GTEST_TEST_PACKAGE_NAME, |
| 110 constants.GTEST_TEST_ACTIVITY_NAME, |
| 111 constants.GTEST_COMMAND_LINE_FILE) |
| OLD | NEW |