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..9809e515ec6aad48a0e2b884e759a569fed1cbb6 100644 |
| --- a/build/android/pylib/gtest/gtest_test_instance.py |
| +++ b/build/android/pylib/gtest/gtest_test_instance.py |
| @@ -73,6 +73,8 @@ _RE_TEST_ERROR = re.compile(r'FAILURES!!! Tests run: \d+,' |
| r' Failures: \d+, Errors: 1') |
| _RE_TEST_CURRENTLY_RUNNING = re.compile(r'\[ERROR:.*?\]' |
| r' Currently running: (.*)') |
| +_RE_DISABLED = re.compile(r'DISABLED_') |
| +_RE_FLAKY = re.compile(r'FLAKY_') |
| def ParseGTestListTests(raw_list): |
| """Parses a raw test list as provided by --gtest_list_tests. |
| @@ -227,6 +229,20 @@ def ConvertTestFilterFileIntoGTestFilterArgument(input_lines): |
| # Join the filter lines into one, big --gtest_filter argument. |
| return positive_patterns + negative_patterns |
| +def TestNameWithoutDisabledPrefix(test_name): |
| + """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 = [_RE_DISABLED, _RE_FLAKY] |
| + for dp in disabled_prefixes: |
| + test_name = re.sub(dp, '', test_name, 1) |
| + test_name = re.sub(r'\.%s' % dp.pattern, '.', test_name) |
|
jbudorick
2016/12/08 01:32:57
nit: you should be able to replace these two lines
jbudorick
2016/12/08 01:38:01
lgtm w/ this nit
shenghuazhang
2016/12/08 19:37:29
Refactor this by 2 pattern groups.
- _RE_DISABLED
|
| + 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 and self._gtest_filter: |
| + out_filtered_test_list = list(set(test_list)-set(filtered_test_list)) |
| + for test in out_filtered_test_list: |
|
jbudorick
2016/12/08 01:32:57
1) this is much better :)
2) to be consistent w/ t
jbudorick
2016/12/08 01:38:01
spoke offline, this is fine.
|
| + test_name_no_disabled = TestNameWithoutDisabledPrefix(test) |
| + if test_name_no_disabled != test and unittest_util.FilterTestNames( |
| + [test_name_no_disabled], self._gtest_filter): |
| + filtered_test_list.append(test) |
| return filtered_test_list |
| def _GenerateDisabledFilterString(self, disabled_prefixes): |