Index: packages/Python/lldbsuite/test/configuration.py =================================================================== --- packages/Python/lldbsuite/test/configuration.py +++ packages/Python/lldbsuite/test/configuration.py @@ -56,10 +56,6 @@ # The test suite. suite = unittest2.TestSuite() -dont_do_dsym_test = False -dont_do_dwarf_test = False -dont_do_dwo_test = False - # The list of categories we said we care about categoriesList = None # set to true if we are going to use categories for cherry-picking test cases Index: packages/Python/lldbsuite/test/dotest.py =================================================================== --- packages/Python/lldbsuite/test/dotest.py +++ packages/Python/lldbsuite/test/dotest.py @@ -281,14 +281,6 @@ cflags_extras = args.E os.environ['CFLAGS_EXTRAS'] = cflags_extras - # argparse makes sure we have correct options - if args.N == 'dwarf': - configuration.dont_do_dwarf_test = True - elif args.N == 'dwo': - configuration.dont_do_dwo_test = True - elif args.N == 'dsym': - configuration.dont_do_dsym_test = True - if args.d: sys.stdout.write("Suspending the process %d to wait for debugger to attach...\n" % os.getpid()) sys.stdout.flush() @@ -1013,15 +1005,6 @@ target_platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2] - # By default, both dsym, dwarf and dwo tests are performed. - # Use @dsym_test, @dwarf_test or @dwo_test decorators, defined in lldbtest.py, to mark a test as - # a dsym, dwarf or dwo test. Use '-N dsym', '-N dwarf' or '-N dwo' to exclude dsym, dwarf or - # dwo tests from running. - configuration.dont_do_dsym_test = configuration.dont_do_dsym_test \ - or any(platform in target_platform for platform in ["linux", "freebsd", "windows"]) - configuration.dont_do_dwo_test = configuration.dont_do_dwo_test \ - or any(platform in target_platform for platform in ["darwin", "macosx", "ios"]) - # 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 Index: packages/Python/lldbsuite/test/dotest_args.py =================================================================== --- packages/Python/lldbsuite/test/dotest_args.py +++ packages/Python/lldbsuite/test/dotest_args.py @@ -59,7 +59,6 @@ # Test filtering options group = parser.add_argument_group('Test filtering options') - 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") group.add_argument('-f', metavar='filterspec', action='append', help='Specify a filter, which consists of the test class name, a dot, followed by the test method, to only admit such test into the test suite') # FIXME: Example? X('-l', "Don't skip long running tests") group.add_argument('-p', metavar='pattern', help='Specify a regexp filename pattern for inclusion in the test suite') Index: packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py =================================================================== --- packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py +++ packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py @@ -117,7 +117,7 @@ # Generate test cases based on the collected source files for f in test_source_files: if f.endswith(".cpp") or f.endswith(".c"): - @dwarf_test + @add_test_categories("dwarf") @unittest2.skipIf(TestBase.skipLongRunningTest(), "Skip this long running test") def test_function_dwarf(self, f=f): if f.endswith(".cpp"): Index: packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py =================================================================== --- packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py +++ packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py @@ -13,20 +13,11 @@ mydir = TestBase.compute_mydir(__file__) - @skipUnlessDarwin - @dsym_test - @expectedFailureClang("llvm.org/pr19238") - def test_with_dsym(self): + @expectedFailureAll(bugnumber="llvm.org/pr19238", compiler="clang") + @expectedFailureAll(bugnumber="llvm.org/pr25626 expectedFailureClang fails on FreeBSD", oslist=["freebsd"]) + def test_typedef(self): """Test 'image lookup -t a' and check for correct display at different scopes.""" - self.buildDsym() - self.image_lookup_for_multiple_typedefs() - - @dwarf_test - @expectedFailureClang("llvm.org/pr19238") - @expectedFailureFreeBSD("llvm.org/pr25626 expectedFailureClang fails on FreeBSD") - def test_with_dwarf(self): - """Test 'image lookup -t a' and check for correct display at different scopes.""" - self.buildDwarf() + self.build() self.image_lookup_for_multiple_typedefs() def image_lookup_for_multiple_typedefs(self): Index: packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py =================================================================== --- packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py +++ packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py @@ -6,9 +6,10 @@ mydir = TestBase.compute_mydir(__file__) - @dwarf_test - def test_with_dwarf(self): - self.buildDwarf() + @add_test_categories("dwarf") + @skipIf(debug_info=not_in(["dwarf"])) + def test_limit_debug_info(self): + self.build() cwd = os.getcwd() Index: packages/Python/lldbsuite/test/lldbtest.py =================================================================== --- packages/Python/lldbsuite/test/lldbtest.py +++ packages/Python/lldbsuite/test/lldbtest.py @@ -541,48 +541,6 @@ wrapper.__no_debug_info_test__ = True return wrapper -def dsym_test(func): - """Decorate the item as a dsym test.""" - if isinstance(func, type) and issubclass(func, unittest2.TestCase): - raise Exception("@dsym_test can only be used to decorate a test method") - @wraps(func) - def wrapper(self, *args, **kwargs): - if configuration.dont_do_dsym_test: - self.skipTest("dsym tests") - return func(self, *args, **kwargs) - - # Mark this function as such to separate them from the regular tests. - wrapper.__dsym_test__ = True - return wrapper - -def dwarf_test(func): - """Decorate the item as a dwarf test.""" - if isinstance(func, type) and issubclass(func, unittest2.TestCase): - raise Exception("@dwarf_test can only be used to decorate a test method") - @wraps(func) - def wrapper(self, *args, **kwargs): - if configuration.dont_do_dwarf_test: - self.skipTest("dwarf tests") - return func(self, *args, **kwargs) - - # Mark this function as such to separate them from the regular tests. - 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): - if configuration.dont_do_dwo_test: - self.skipTest("dwo tests") - 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): @@ -2266,16 +2224,22 @@ newattrs = {} for attrname, attrvalue in attrs.items(): if attrname.startswith("test") and not getattr(attrvalue, "__no_debug_info_test__", False): - @dsym_test - @wraps(attrvalue) - def dsym_test_method(self, attrvalue=attrvalue): - self.debug_info = "dsym" - return attrvalue(self) - dsym_method_name = attrname + "_dsym" - dsym_test_method.__name__ = dsym_method_name - newattrs[dsym_method_name] = dsym_test_method - - @dwarf_test + target_platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2] + + dont_do_dsym_test = any(platform in target_platform for platform in ["linux", "freebsd", "windows"]) + dont_do_dwo_test = any(platform in target_platform for platform in ["darwin", "macosx", "ios"]) + + if not dont_do_dsym_test: + @add_test_categories(["dsym"]) + @wraps(attrvalue) + def dsym_test_method(self, attrvalue=attrvalue): + self.debug_info = "dsym" + return attrvalue(self) + dsym_method_name = attrname + "_dsym" + dsym_test_method.__name__ = dsym_method_name + newattrs[dsym_method_name] = dsym_test_method + + @add_test_categories(["dwarf"]) @wraps(attrvalue) def dwarf_test_method(self, attrvalue=attrvalue): self.debug_info = "dwarf" @@ -2284,14 +2248,15 @@ dwarf_test_method.__name__ = dwarf_method_name newattrs[dwarf_method_name] = dwarf_test_method - @dwo_test - @wraps(attrvalue) - 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 + if not dont_do_dwo_test: + @add_test_categories(["dwo"]) + @wraps(attrvalue) + 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) Index: packages/Python/lldbsuite/test/test_categories.py =================================================================== --- packages/Python/lldbsuite/test/test_categories.py +++ packages/Python/lldbsuite/test/test_categories.py @@ -13,6 +13,9 @@ all_categories = { 'dataformatters': 'Tests related to the type command and the data formatters subsystem', + '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', 'expression' : 'Tests related to the expression parser', 'objc' : 'Tests related to the Objective-C programming language support', 'pyapi' : 'Tests related to the Python API',