Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2937)

Unified Diff: build/android/pylib/gtest/gtest_test_instance.py

Issue 2555633002: [Android] Support gtest_filter + gtest_also_run_disabled_tests (Closed)
Patch Set: Replace 'DISABLED_' in same way Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/pylib/gtest/gtest_test_instance_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..3cdf586a48feadeddbcede2b9cda21b1b17197f0 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,19 @@ 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 = dp.sub('', test_name)
+ return test_name
class GtestTestInstance(test_instance.TestInstance):
@@ -429,6 +444,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:
+ 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):
« no previous file with comments | « no previous file | build/android/pylib/gtest/gtest_test_instance_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698