Chromium Code Reviews| Index: build/android/pylib/gtest/gtest_test_instance.py |
| diff --git a/build/android/pylib/gtest/gtest_test_instance.py b/build/android/pylib/gtest/gtest_test_instance.py |
| index e62e43ce31f753b95a2e2223150322cd626dc276..78de5fb22b2c6b5305f09ec28812ada1a3679907 100644 |
| --- a/build/android/pylib/gtest/gtest_test_instance.py |
| +++ b/build/android/pylib/gtest/gtest_test_instance.py |
| @@ -227,6 +227,22 @@ def ConvertTestFilterFileIntoGTestFilterArgument(input_lines): |
| # Join the filter lines into one, big --gtest_filter argument. |
| return positive_patterns + negative_patterns |
| +def TestNameWithoutDisabledPrefix(test_name): |
|
jbudorick
2016/12/06 03:22:05
This should have tests.
shenghuazhang
2016/12/06 23:56:06
Done.
|
| + """Modify the test name without disabled prefix if prefix 'DISABLED_' or |
| + 'FLAKY_' presents. |
| + |
| + Args: |
| + test_name: The name of a test. |
| + Returns: |
| + A test name without prefix 'DISABLED_' or 'FLAKY_'. |
| + """ |
| + disabled_prefixes = ['DISABLED_', 'FLAKY_'] |
|
jbudorick
2016/12/06 03:22:05
compile DISABLED_ and FLAKY_ into regexes at modul
shenghuazhang
2016/12/06 23:56:06
Done.
|
| + for dp in disabled_prefixes: |
| + if re.match(r'%s' % dp, test_name): |
|
jbudorick
2016/12/06 03:22:05
I think you should be able to do this with one or
shenghuazhang
2016/12/06 23:56:06
Done.
|
| + test_name = re.sub(r'%s' % dp, '', test_name, 1) |
| + if test_name.find(r'\.%s' % dp): |
| + test_name = re.sub(r'\.%s' % dp, r'.', test_name) |
| + return test_name |
| class GtestTestInstance(test_instance.TestInstance): |
| @@ -429,6 +445,14 @@ class GtestTestInstance(test_instance.TestInstance): |
| logging.debug('Filtering tests using: %s', gtest_filter_string) |
| filtered_test_list = unittest_util.FilterTestNames( |
| filtered_test_list, gtest_filter_string) |
| + if self._run_disabled: |
| + for test in test_list: |
|
jbudorick
2016/12/06 03:22:05
While this appears to work, it looks like it'll be
shenghuazhang
2016/12/06 23:56:06
Refactor the code by escape the outer gtest_filter
|
| + test_name_no_disabled = [TestNameWithoutDisabledPrefix(test)] |
| + if test_name_no_disabled[0] == test: |
| + continue |
| + if unittest_util.FilterTestNames(test_name_no_disabled, |
| + gtest_filter_string) and test not in filtered_test_list: |
| + filtered_test_list.append(test) |
| return filtered_test_list |
| def _GenerateDisabledFilterString(self, disabled_prefixes): |