Skip to content

Commit f833f17

Browse files
committed
Improvements to testing blacklist
Summary: This patch is necessary because individual test cases are not required to have unique names. Therefore, test cases must now be specified explicitly in the form <TestCase>.<TestMethod>. Because it works by regex matching, passing just <TestCase> will still disable an entire file. This also allows for multiple exclusion files to be specified. Reviewers: zturner, labath, jingham, tfiala Subscribers: lldb-commits, sas Differential Revision: https://reviews.llvm.org/D24988 llvm-svn: 283238
1 parent fa262c9 commit f833f17

File tree

4 files changed

+20
-41
lines changed

4 files changed

+20
-41
lines changed

lldb/packages/Python/lldbsuite/test/configuration.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,8 @@ def setupCrashInfoHook():
102102
regexp = None
103103

104104
# Sets of tests which are excluded at runtime
105-
skip_files = None
106-
skip_methods = None
107-
xfail_files = None
108-
xfail_methods = None
105+
skip_tests = None
106+
xfail_tests = None
109107

110108
# By default, recorded session info for errored/failed test are dumped into its
111109
# own file under a session directory named after the timestamp of the test suite

lldb/packages/Python/lldbsuite/test/dotest.py

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -216,33 +216,24 @@ def parseExclusion(exclusion_file):
216216
<method name>
217217
"""
218218
excl_type = None
219-
case_type = None
220219

221220
with open(exclusion_file) as f:
222221
for line in f:
222+
line = line.strip()
223223
if not excl_type:
224-
[excl_type, case_type] = line.split()
224+
excl_type = line
225225
continue
226226

227-
line = line.strip()
228227
if not line:
229228
excl_type = None
230-
elif excl_type == 'skip' and case_type == 'files':
231-
if not configuration.skip_files:
232-
configuration.skip_files = []
233-
configuration.skip_files.append(line)
234-
elif excl_type == 'skip' and case_type == 'methods':
235-
if not configuration.skip_methods:
236-
configuration.skip_methods = []
237-
configuration.skip_methods.append(line)
238-
elif excl_type == 'xfail' and case_type == 'files':
239-
if not configuration.xfail_files:
240-
configuration.xfail_files = []
241-
configuration.xfail_files.append(line)
242-
elif excl_type == 'xfail' and case_type == 'methods':
243-
if not configuration.xfail_methods:
244-
configuration.xfail_methods = []
245-
configuration.xfail_methods.append(line)
229+
elif excl_type == 'skip':
230+
if not configuration.skip_tests:
231+
configuration.skip_tests = []
232+
configuration.skip_tests.append(line)
233+
elif excl_type == 'xfail':
234+
if not configuration.xfail_tests:
235+
configuration.xfail_tests = []
236+
configuration.xfail_tests.append(line)
246237

247238

248239
def parseOptionsAndInitTestdirs():
@@ -375,7 +366,8 @@ def parseOptionsAndInitTestdirs():
375366
lldbtest_config.lldbExec = os.path.realpath(args.executable)
376367

377368
if args.excluded:
378-
parseExclusion(args.excluded)
369+
for excl_file in args.excluded:
370+
parseExclusion(excl_file)
379371

380372
if args.p:
381373
if args.p.startswith('-'):
@@ -799,8 +791,8 @@ def visit_file(dir, name):
799791
# We didn't match the regex, we're done.
800792
return
801793

802-
if configuration.skip_files:
803-
for file_regexp in configuration.skip_files:
794+
if configuration.skip_tests:
795+
for file_regexp in configuration.skip_tests:
804796
if re.search(file_regexp, name):
805797
return
806798

lldb/packages/Python/lldbsuite/test/dotest_args.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def create_parser():
9696
'-p',
9797
metavar='pattern',
9898
help='Specify a regexp filename pattern for inclusion in the test suite')
99-
group.add_argument('--excluded', metavar='exclusion-file', help=textwrap.dedent(
99+
group.add_argument('--excluded', metavar='exclusion-file', action='append', help=textwrap.dedent(
100100
'''Specify a file for tests to exclude. File should contain lists of regular expressions for test files or methods,
101101
with each list under a matching header (xfail files, xfail methods, skip files, skip methods)'''))
102102
group.add_argument(

lldb/packages/Python/lldbsuite/test/test_result.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
# Third-party modules
1919
import unittest2
2020

21-
from unittest2.util import strclass
22-
2321
# LLDB Modules
2422
from . import configuration
2523
from lldbsuite.test_event.event_builder import EventBuilder
@@ -139,8 +137,7 @@ def startTest(self, test):
139137
self.getCategoriesForTest(test)):
140138
self.hardMarkAsSkipped(test)
141139
if self.checkExclusion(
142-
configuration.skip_methods,
143-
test._testMethodName):
140+
configuration.skip_tests, test.id()):
144141
self.hardMarkAsSkipped(test)
145142

146143
configuration.setCrashInfoHook(
@@ -161,11 +158,7 @@ def startTest(self, test):
161158

162159
def addSuccess(self, test):
163160
if self.checkExclusion(
164-
configuration.xfail_files,
165-
strclass(
166-
test.__class__)) or self.checkExclusion(
167-
configuration.xfail_methods,
168-
test._testMethodName):
161+
configuration.xfail_tests, test.id()):
169162
self.addUnexpectedSuccess(test, None)
170163
return
171164

@@ -239,11 +232,7 @@ def addCleanupError(self, test, err):
239232

240233
def addFailure(self, test, err):
241234
if self.checkExclusion(
242-
configuration.xfail_files,
243-
strclass(
244-
test.__class__)) or self.checkExclusion(
245-
configuration.xfail_methods,
246-
test._testMethodName):
235+
configuration.xfail_tests, test.id()):
247236
self.addExpectedFailure(test, err, None)
248237
return
249238

0 commit comments

Comments
 (0)