Index: lldb/trunk/test/dotest.py =================================================================== --- lldb/trunk/test/dotest.py +++ lldb/trunk/test/dotest.py @@ -112,6 +112,7 @@ 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 @@ 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 @@ # 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 Index: lldb/trunk/test/dotest_args.py =================================================================== --- lldb/trunk/test/dotest_args.py +++ lldb/trunk/test/dotest_args.py @@ -60,7 +60,7 @@ # 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') Index: lldb/trunk/test/functionalities/dead-strip/TestDeadStrip.py =================================================================== --- lldb/trunk/test/functionalities/dead-strip/TestDeadStrip.py +++ lldb/trunk/test/functionalities/dead-strip/TestDeadStrip.py @@ -13,6 +13,7 @@ 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.""" Index: lldb/trunk/test/lldbtest.py =================================================================== --- lldb/trunk/test/lldbtest.py +++ lldb/trunk/test/lldbtest.py @@ -567,6 +567,23 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 Index: lldb/trunk/test/make/Makefile.rules =================================================================== --- lldb/trunk/test/make/Makefile.rules +++ lldb/trunk/test/make/Makefile.rules @@ -185,6 +185,10 @@ 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) Index: lldb/trunk/test/plugins/builder_base.py =================================================================== --- lldb/trunk/test/plugins/builder_base.py +++ lldb/trunk/test/plugins/builder_base.py @@ -113,6 +113,17 @@ # 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