Page MenuHomePhabricator

gmodules-test-support-v2.diff

File Metadata

Author
tfiala
Created
May 24 2016, 11:49 AM

gmodules-test-support-v2.diff

diff --git a/packages/Python/lldbsuite/test/lldbinline.py b/packages/Python/lldbsuite/test/lldbinline.py
index 010298c..d3aa9f1 100644
--- a/packages/Python/lldbsuite/test/lldbinline.py
+++ b/packages/Python/lldbsuite/test/lldbinline.py
@@ -141,6 +141,12 @@ class InlineTest(TestBase):
self.buildDwo()
self.do_test()
+ def __test_with_gmodules(self):
+ self.using_dsym = False
+ self.BuildMakefile()
+ self.buildDwarf()
+ self.do_test()
+
def execute_user_command(self, __command):
exec(__command, globals(), locals())
@@ -211,6 +217,8 @@ def MakeInlineTest(__file, __globals, decorators=None):
test.test_with_dwarf = ApplyDecoratorsToFunction(test._InlineTest__test_with_dwarf, decorators)
if test_categories.is_supported_on_platform("dwo", target_platform):
test.test_with_dwo = ApplyDecoratorsToFunction(test._InlineTest__test_with_dwo, decorators)
+ if test_categories.is_supported_on_platform("gmodules", target_platform):
+ 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})
diff --git a/packages/Python/lldbsuite/test/lldbtest.py b/packages/Python/lldbsuite/test/lldbtest.py
index b9168ec..3fb549a 100644
--- a/packages/Python/lldbsuite/test/lldbtest.py
+++ b/packages/Python/lldbsuite/test/lldbtest.py
@@ -1329,6 +1329,12 @@ class Base(unittest2.TestCase):
if not module.buildDwo(self, architecture, compiler, dictionary, clean):
raise Exception("Don't know how to build binary with dwo")
+ def buildGModules(self, architecture=None, compiler=None, dictionary=None, clean=True):
+ """Platform specific way to build binaries with gmodules info."""
+ module = builder_module()
+ if not module.buildGModules(self, architecture, compiler, dictionary, clean):
+ raise Exception("Don't know how to build binary with gmodules")
+
def buildGo(self):
"""Build the default go binary.
"""
@@ -1478,6 +1484,17 @@ class LLDBTestCaseFactory(type):
dwo_method_name = attrname + "_dwo"
dwo_test_method.__name__ = dwo_method_name
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):
+ self.debug_info = "gmodules"
+ return attrvalue(self)
+ gmodules_method_name = attrname + "_gmodules"
+ gmodules_test_method.__name__ = gmodules_method_name
+ newattrs[gmodules_method_name] = gmodules_test_method
+
else:
newattrs[attrname] = attrvalue
return super(LLDBTestCaseFactory, cls).__new__(cls, name, bases, newattrs)
@@ -1947,6 +1964,8 @@ class TestBase(Base):
return self.buildDwarf(architecture, compiler, dictionary, clean)
elif self.debug_info == "dwo":
return self.buildDwo(architecture, compiler, dictionary, clean)
+ elif self.debug_info == "gmodules":
+ return self.buildGModules(architecture, compiler, dictionary, clean)
else:
self.fail("Can't build for debug info: %s" % self.debug_info)
diff --git a/packages/Python/lldbsuite/test/make/Makefile.rules b/packages/Python/lldbsuite/test/make/Makefile.rules
index 38e3670..c37ef74 100644
--- a/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -212,8 +212,13 @@ ifeq "$(MAKE_DWO)" "YES"
CFLAGS += -gsplit-dwarf
endif
+ifeq "$(MAKE_GMODULES)" "YES"
+ CFLAGS += -fmodules -gmodules
+endif
+
CXXFLAGS += -std=c++11
-CXXFLAGS += $(CFLAGS)
+# FIXME: C++ modules aren't supported on all platforms.
+CXXFLAGS += $(subst -fmodules,, $(CFLAGS))
LD = $(CC)
LDFLAGS ?= $(CFLAGS)
LDFLAGS += $(LD_EXTRAS)
@@ -519,7 +524,7 @@ endif
$(PCH_OUTPUT) : $(PCH_CXX_SOURCE)
$(CXX) $(CXXFLAGS) -x c++-header -o $(PCH_OUTPUT) $(PCH_CXX_SOURCE)
%.o : %.cpp $(PCH_OUTPUT)
- $(CXX) $(PCHFLAGS) $(CXXFLAGS) $(CFLAGS) -c -o $@ $<
+ $(CXX) $(PCHFLAGS) $(CXXFLAGS) -c -o $@ $<
#endif
#----------------------------------------------------------------------
diff --git a/packages/Python/lldbsuite/test/plugins/builder_base.py b/packages/Python/lldbsuite/test/plugins/builder_base.py
index 6b8373b..a467a45 100644
--- a/packages/Python/lldbsuite/test/plugins/builder_base.py
+++ b/packages/Python/lldbsuite/test/plugins/builder_base.py
@@ -143,6 +143,17 @@ def buildDwo(sender=None, architecture=None, compiler=None, dictionary=None, cle
# True signifies that we can handle building dwo.
return True
+def buildGModules(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
+ """Build the binaries with dwarf debug info."""
+ commands = []
+ if clean:
+ commands.append([getMake(), "clean", getCmdLine(dictionary)])
+ commands.append([getMake(), "MAKE_DSYM=NO", "MAKE_GMODULES=YES", getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)])
+
+ lldbtest.system(commands, sender=sender)
+ # True signifies that we can handle building with gmodules.
+ return True
+
def cleanup(sender=None, dictionary=None):
"""Perform a platform-specific cleanup after the test."""
#import traceback
diff --git a/packages/Python/lldbsuite/test/test_categories.py b/packages/Python/lldbsuite/test/test_categories.py
index 72b7afd..6f8d3bb 100644
--- a/packages/Python/lldbsuite/test/test_categories.py
+++ b/packages/Python/lldbsuite/test/test_categories.py
@@ -13,7 +13,7 @@ import sys
# LLDB modules
debug_info_categories = [
- 'dwarf', 'dwo', 'dsym'
+ 'dwarf', 'dwo', 'dsym', 'gmodules'
]
all_categories = {
@@ -21,6 +21,7 @@ all_categories = {
'dwarf' : 'Tests that can be run with DWARF debug information',
'dwo' : 'Tests that can be run with DWO debug information',
'dsym' : 'Tests that can be run with DSYM debug information',
+ 'gmodules' : 'Tests that can be run with -gmodules debug information',
'expression' : 'Tests related to the expression parser',
'objc' : 'Tests related to the Objective-C programming language support',
'pyapi' : 'Tests related to the Python API',
@@ -48,6 +49,8 @@ def is_supported_on_platform(category, platform):
return platform in ["linux", "freebsd"]
elif category == "dsym":
return platform in ["darwin", "macosx", "ios"]
+ elif category == "gmodules":
+ return platform in ["linux", "freebsd", "darwin", "macosx", "ios"]
return True
def validate(categories, exact_match):

Event Timeline