[Lldb-commits] [lldb] r249530 - Run tests with dwo symbol files

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 7 03:02:19 PDT 2015


Author: tberghammer
Date: Wed Oct  7 05:02:17 2015
New Revision: 249530

URL: http://llvm.org/viewvc/llvm-project?rev=249530&view=rev
Log:
Run tests with dwo symbol files

dwo symbol files are generated when code compiled with the "-gsplit-dwarf"
command option (https://gcc.gnu.org/wiki/DebugFission). This CL modifies
the test system to run tests with inferiors compile with the "-gsplit-dwarf"

Differential revision: http://reviews.llvm.org/D13300

Modified:
    lldb/trunk/test/dotest.py
    lldb/trunk/test/dotest_args.py
    lldb/trunk/test/functionalities/dead-strip/TestDeadStrip.py
    lldb/trunk/test/lldbtest.py
    lldb/trunk/test/make/Makefile.rules
    lldb/trunk/test/plugins/builder_base.py

Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=249530&r1=249529&r2=249530&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Wed Oct  7 05:02:17 2015
@@ -112,6 +112,7 @@ just_do_benchmarks_test = False
 
 dont_do_dsym_test = False
 dont_do_dwarf_test = False
+dont_do_dwo_test = False
 
 # The blacklist is optional (-b blacklistFile) and allows a central place to skip
 # testclass's and/or testclass.testmethod's.
@@ -469,6 +470,7 @@ def parseOptionsAndInitTestdirs():
     global just_do_benchmarks_test
     global dont_do_dsym_test
     global dont_do_dwarf_test
+    global dont_do_dwo_test
     global blacklist
     global blacklistConfig
     global categoriesList
@@ -599,6 +601,8 @@ def parseOptionsAndInitTestdirs():
     # argparse makes sure we have correct options
     if args.N == 'dwarf':
         dont_do_dwarf_test = True
+    elif args.N == 'dwo':
+        dont_do_dwo_test = True
     elif args.N == 'dsym':
         dont_do_dsym_test = True
 

Modified: lldb/trunk/test/dotest_args.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest_args.py?rev=249530&r1=249529&r2=249530&view=diff
==============================================================================
--- lldb/trunk/test/dotest_args.py (original)
+++ lldb/trunk/test/dotest_args.py Wed Oct  7 05:02:17 2015
@@ -60,7 +60,7 @@ def create_parser():
 
     # Test filtering options
     group = parser.add_argument_group('Test filtering options')
-    group.add_argument('-N', choices=['dwarf', 'dsym'], help="Don't do test cases marked with the @dsym decorator by passing 'dsym' as the option arg, or don't do test cases marked with the @dwarf decorator by passing 'dwarf' as the option arg")
+    group.add_argument('-N', choices=['dwarf', 'dwo', 'dsym'], help="Don't do test cases marked with the @dsym_test/@dwarf_test/@dwo_test decorator by passing dsym/dwarf/dwo as the option arg")
     X('-a', "Don't do lldb Python API tests")
     X('+a', "Just do lldb Python API tests. Do not specify along with '-a'", dest='plus_a')
     X('+b', 'Just do benchmark tests', dest='plus_b')

Modified: lldb/trunk/test/functionalities/dead-strip/TestDeadStrip.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/dead-strip/TestDeadStrip.py?rev=249530&r1=249529&r2=249530&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/dead-strip/TestDeadStrip.py (original)
+++ lldb/trunk/test/functionalities/dead-strip/TestDeadStrip.py Wed Oct  7 05:02:17 2015
@@ -13,6 +13,7 @@ class DeadStripTestCase(TestBase):
     mydir = TestBase.compute_mydir(__file__)
 
     @expectedFailureWindows("llvm.org/pr24778")
+    @expectedFailureDwo("llvm.org/pr25087")
     @skipIfFreeBSD # The -dead_strip linker option isn't supported on FreeBSD versions of ld.
     def test(self):
         """Test breakpoint works correctly with dead-code stripping."""

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=249530&r1=249529&r2=249530&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Wed Oct  7 05:02:17 2015
@@ -567,6 +567,23 @@ def dwarf_test(func):
     wrapper.__dwarf_test__ = True
     return wrapper
 
+def dwo_test(func):
+    """Decorate the item as a dwo test."""
+    if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+        raise Exception("@dwo_test can only be used to decorate a test method")
+    @wraps(func)
+    def wrapper(self, *args, **kwargs):
+        try:
+            if lldb.dont_do_dwo_test:
+                self.skipTest("dwo tests")
+        except AttributeError:
+            pass
+        return func(self, *args, **kwargs)
+
+    # Mark this function as such to separate them from the regular tests.
+    wrapper.__dwo_test__ = True
+    return wrapper
+
 def debugserver_test(func):
     """Decorate the item as a debugserver test."""
     if isinstance(func, type) and issubclass(func, unittest2.TestCase):
@@ -657,10 +674,13 @@ def expectedFailureAll(bugnumber=None, o
     return expectedFailure(fn, bugnumber)
 
 def expectedFailureDwarf(bugnumber=None):
-    return expectedFailureAll(bugnumber==bugnumber, debug_info="dwarf")
+    return expectedFailureAll(bugnumber=bugnumber, debug_info="dwarf")
+
+def expectedFailureDwo(bugnumber=None):
+    return expectedFailureAll(bugnumber=bugnumber, debug_info="dwo")
 
 def expectedFailureDsym(bugnumber=None):
-    return expectedFailureAll(bugnumber==bugnumber, debug_info="dsym")
+    return expectedFailureAll(bugnumber=bugnumber, debug_info="dsym")
 
 def expectedFailureCompiler(compiler, compiler_version=None, bugnumber=None):
     if compiler_version is None:
@@ -2141,6 +2161,16 @@ class Base(unittest2.TestCase):
         if not module.buildDwarf(self, architecture, compiler, dictionary, clean):
             raise Exception("Don't know how to build binary with dwarf")
 
+    def buildDwo(self, architecture=None, compiler=None, dictionary=None, clean=True):
+        """Platform specific way to build binaries with dwarf maps."""
+        if lldb.skip_build_and_cleanup:
+            return
+        module = builder_module()
+        if target_is_android():
+            dictionary = append_android_envs(dictionary)
+        if not module.buildDwo(self, architecture, compiler, dictionary, clean):
+            raise Exception("Don't know how to build binary with dwo")
+
     def buildGo(self):
         """Build the default go binary.
         """
@@ -2258,6 +2288,14 @@ class LLDBTestCaseFactory(type):
                 dwarf_method_name = attrname + "_dwarf"
                 dwarf_test_method.__name__ = dwarf_method_name
                 newattrs[dwarf_method_name] = dwarf_test_method
+                
+                @dwo_test
+                def dwo_test_method(self, attrvalue=attrvalue):
+                    self.debug_info = "dwo"
+                    return attrvalue(self)
+                dwo_method_name = attrname + "_dwo"
+                dwo_test_method.__name__ = dwo_method_name
+                newattrs[dwo_method_name] = dwo_test_method
             else:
                 newattrs[attrname] = attrvalue
         return super(LLDBTestCaseFactory, cls).__new__(cls, name, bases, newattrs)
@@ -2793,6 +2831,10 @@ class TestBase(Base):
             return self.buildDsym(architecture, compiler, dictionary, clean)
         elif self.debug_info == "dwarf":
             return self.buildDwarf(architecture, compiler, dictionary, clean)
+        elif self.debug_info == "dwo":
+            return self.buildDwo(architecture, compiler, dictionary, clean)
+        else:
+            self.fail("Can't build for debug info: %s" % self.debug_info)
 
     # =================================================
     # Misc. helper methods for debugging test execution

Modified: lldb/trunk/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/make/Makefile.rules?rev=249530&r1=249529&r2=249530&view=diff
==============================================================================
--- lldb/trunk/test/make/Makefile.rules (original)
+++ lldb/trunk/test/make/Makefile.rules Wed Oct  7 05:02:17 2015
@@ -185,6 +185,10 @@ else
 	CFLAGS_NO_DEBUG = -O0 $(ARCHFLAG)$(ARCH) $(FRAMEWORK_INCLUDES) $(CFLAGS_EXTRAS) $(TRIPLE_CFLAGS)
 endif
 
+ifeq "$(MAKE_DWO)" "YES"
+	CFLAGS += -gsplit-dwarf
+endif
+
 CXXFLAGS += -std=c++11
 CXXFLAGS += $(CFLAGS)
 LD = $(CC)

Modified: lldb/trunk/test/plugins/builder_base.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/plugins/builder_base.py?rev=249530&r1=249529&r2=249530&view=diff
==============================================================================
--- lldb/trunk/test/plugins/builder_base.py (original)
+++ lldb/trunk/test/plugins/builder_base.py Wed Oct  7 05:02:17 2015
@@ -113,6 +113,17 @@ def buildDwarf(sender=None, architecture
     # True signifies that we can handle building dwarf.
     return True
 
+def buildDwo(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_DWO=YES", getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)])
+
+    lldbtest.system(commands, sender=sender)
+    # True signifies that we can handle building dwo.
+    return True
+
 def cleanup(sender=None, dictionary=None):
     """Perform a platform-specific cleanup after the test."""
     #import traceback




More information about the lldb-commits mailing list