[dotest] Make the set of tests independent of the test configuration

Summary:
In the magic test duplicator, we were making the decision whether to
create a test variant based on the compiler and the target platform.
This meant that the set of known tests was different for each test
configuration.

This patch makes the set of generated test variants static and handles
the skipping via runtime checks instead. This is more consistent with
how we do other test-skipping decision (e.g. for libc++ tests), and
makes it easier to expose the full set of tests to lit, which now does
not need to know anything about what things can potentially cause tests
to appear or disappear.

Reviewers: JDevlieghere, aprantl

Subscribers: eraman, lldb-commits

Differential Revision: https://reviews.llvm.org/D45949

llvm-svn: 330708
This commit is contained in:
Pavel Labath 2018-04-24 10:51:44 +00:00
parent 43acdb35bc
commit fdfeefd6c2
3 changed files with 33 additions and 61 deletions

View File

@ -1104,6 +1104,22 @@ def checkLibcxxSupport():
print("Libc++ tests will not be run because: " + reason)
configuration.skipCategories.append("libc++")
def checkDebugInfoSupport():
import lldb
platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
compiler = configuration.compiler
skipped = []
for cat in test_categories.debug_info_categories:
if cat in configuration.categoriesList:
continue # Category explicitly requested, let it run.
if test_categories.is_supported_on_platform(cat, platform, compiler):
continue
configuration.skipCategories.append(cat)
skipped.append(cat)
if skipped:
print("Skipping following debug info categories:", skipped)
def run_suite():
# On MacOS X, check to make sure that domain for com.apple.DebugSymbols defaults
# does not exist before proceeding to running the test suite.
@ -1212,6 +1228,7 @@ def run_suite():
target_platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
checkLibcxxSupport()
checkDebugInfoSupport()
# Don't do debugserver tests on everything except OS X.
configuration.dont_do_debugserver_test = "linux" in target_platform or "freebsd" in target_platform or "windows" in target_platform

View File

@ -241,23 +241,14 @@ def MakeInlineTest(__file, __globals, decorators=None):
test = type(test_name, (InlineTest,), {'using_dsym': None})
test.name = test_name
target_platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
if test_categories.is_supported_on_platform(
"dsym", target_platform, configuration.compiler):
test.test_with_dsym = ApplyDecoratorsToFunction(
test._InlineTest__test_with_dsym, decorators)
if test_categories.is_supported_on_platform(
"dwarf", target_platform, configuration.compiler):
test.test_with_dwarf = ApplyDecoratorsToFunction(
test._InlineTest__test_with_dwarf, decorators)
if test_categories.is_supported_on_platform(
"dwo", target_platform, configuration.compiler):
test.test_with_dwo = ApplyDecoratorsToFunction(
test._InlineTest__test_with_dwo, decorators)
if test_categories.is_supported_on_platform(
"gmodules", target_platform, configuration.compiler):
test.test_with_gmodules = ApplyDecoratorsToFunction(
test._InlineTest__test_with_gmodules, decorators)
test.test_with_dsym = ApplyDecoratorsToFunction(
test._InlineTest__test_with_dsym, decorators)
test.test_with_dwarf = ApplyDecoratorsToFunction(
test._InlineTest__test_with_dwarf, decorators)
test.test_with_dwo = ApplyDecoratorsToFunction(
test._InlineTest__test_with_dwo, decorators)
test.test_with_gmodules = ApplyDecoratorsToFunction(
test._InlineTest__test_with_gmodules, decorators)
# Add the test case to the globals, and hide InlineTest
__globals.update({test_name: test})

View File

@ -1732,14 +1732,11 @@ class LLDBTestCaseFactory(type):
for attrname, attrvalue in attrs.items():
if attrname.startswith("test") and not getattr(
attrvalue, "__no_debug_info_test__", False):
target_platform = lldb.DBG.GetSelectedPlatform(
).GetTriple().split('-')[2]
# If any debug info categories were explicitly tagged, assume that list to be
# authoritative. If none were specified, try with all debug
# info formats.
all_dbginfo_categories = set(
test_categories.debug_info_categories) - set(configuration.skipCategories)
all_dbginfo_categories = set(test_categories.debug_info_categories)
categories = set(
getattr(
attrvalue,
@ -1748,49 +1745,16 @@ class LLDBTestCaseFactory(type):
if not categories:
categories = all_dbginfo_categories
supported_categories = [
x for x in categories if test_categories.is_supported_on_platform(
x, target_platform, configuration.compiler)]
if "dsym" in supported_categories:
@decorators.add_test_categories(["dsym"])
for cat in categories:
@decorators.add_test_categories([cat])
@wraps(attrvalue)
def dsym_test_method(self, attrvalue=attrvalue):
def test_method(self, attrvalue=attrvalue):
return attrvalue(self)
dsym_method_name = attrname + "_dsym"
dsym_test_method.__name__ = dsym_method_name
dsym_test_method.debug_info = "dsym"
newattrs[dsym_method_name] = dsym_test_method
if "dwarf" in supported_categories:
@decorators.add_test_categories(["dwarf"])
@wraps(attrvalue)
def dwarf_test_method(self, attrvalue=attrvalue):
return attrvalue(self)
dwarf_method_name = attrname + "_dwarf"
dwarf_test_method.__name__ = dwarf_method_name
dwarf_test_method.debug_info = "dwarf"
newattrs[dwarf_method_name] = dwarf_test_method
if "dwo" in supported_categories:
@decorators.add_test_categories(["dwo"])
@wraps(attrvalue)
def dwo_test_method(self, attrvalue=attrvalue):
return attrvalue(self)
dwo_method_name = attrname + "_dwo"
dwo_test_method.__name__ = dwo_method_name
dwo_test_method.debug_info = "dwo"
newattrs[dwo_method_name] = dwo_test_method
if "gmodules" in supported_categories:
@decorators.add_test_categories(["gmodules"])
@wraps(attrvalue)
def gmodules_test_method(self, attrvalue=attrvalue):
return attrvalue(self)
gmodules_method_name = attrname + "_gmodules"
gmodules_test_method.__name__ = gmodules_method_name
gmodules_test_method.debug_info = "gmodules"
newattrs[gmodules_method_name] = gmodules_test_method
method_name = attrname + "_" + cat
test_method.__name__ = method_name
test_method.debug_info = cat
newattrs[method_name] = test_method
else:
newattrs[attrname] = attrvalue