[Lldb-commits] [lldb] r255525 - Make debug info specification use categories system.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 14 13:05:05 PST 2015


Sure, sorry about that

On Mon, Dec 14, 2015 at 11:52 AM Tamas Berghammer <tberghammer at google.com>
wrote:

> Hi Zachary,
>
> This change broke TestLimitDebugInfo with the following error
> message(copied from the Linux buildbot):
> ======================================================================
> ERROR: test_limit_debug_info_dwarf
> (TestWithLimitDebugInfo.TestWithLimitDebugInfo)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File
> "/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/packages/Python/lldbsuite/test/lldbtest.py",
> line 2247, in test_method return attrvalue(self)
> File
> "/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/packages/Python/lldbsuite/test/lldbtest.py",
> line 1134, in wrapper if expected_fn(self):
> File
> "/lldb-buildbot/lldbSlave/buildWorkingDir/llvm/tools/lldb/packages/Python/lldbsuite/test/lldbtest.py",
> line 1096, in fn debug_info_passes = debug_info is None or self.debug_info
> in debug_info
> TypeError: argument of type 'function' is not iterable
> Config=i386-clang-3.5
>
> Can you take a look?
>
> Thanks,
> Tamas
>
>
> On Mon, Dec 14, 2015 at 6:52 PM Zachary Turner via lldb-commits <
> lldb-commits at lists.llvm.org> wrote:
>
>> Author: zturner
>> Date: Mon Dec 14 12:49:16 2015
>> New Revision: 255525
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=255525&view=rev
>> Log:
>> Make debug info specification use categories system.
>>
>> Reviewed By: Tamas Berghammer, Pavel Labath
>> Differential Revision: http://reviews.llvm.org/D15428
>>
>> Modified:
>>     lldb/trunk/packages/Python/lldbsuite/test/configuration.py
>>     lldb/trunk/packages/Python/lldbsuite/test/dotest.py
>>     lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
>>
>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py
>>
>> lldb/trunk/packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py
>>
>> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
>>     lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
>>     lldb/trunk/packages/Python/lldbsuite/test/test_categories.py
>>
>> Modified: lldb/trunk/packages/Python/lldbsuite/test/configuration.py
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/configuration.py?rev=255525&r1=255524&r2=255525&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/packages/Python/lldbsuite/test/configuration.py (original)
>> +++ lldb/trunk/packages/Python/lldbsuite/test/configuration.py Mon Dec 14
>> 12:49:16 2015
>> @@ -56,10 +56,6 @@ def setupCrashInfoHook():
>>  # 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
>>
>> Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=255525&r1=255524&r2=255525&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
>> +++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Mon Dec 14
>> 12:49:16 2015
>> @@ -281,14 +281,6 @@ def parseOptionsAndInitTestdirs():
>>          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()
>> @@ -945,15 +937,6 @@ def run_suite():
>>
>>      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
>>
>>
>> Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py?rev=255525&r1=255524&r2=255525&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py (original)
>> +++ lldb/trunk/packages/Python/lldbsuite/test/dotest_args.py Mon Dec 14
>> 12:49:16 2015
>> @@ -59,7 +59,6 @@ def create_parser():
>>
>>      # 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')
>>
>> Modified:
>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py?rev=255525&r1=255524&r2=255525&view=diff
>>
>> ==============================================================================
>> ---
>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py
>> (original)
>> +++
>> lldb/trunk/packages/Python/lldbsuite/test/functionalities/unwind/standard/TestStandardUnwind.py
>> Mon Dec 14 12:49:16 2015
>> @@ -117,7 +117,7 @@ for d in test_source_dirs:
>>  # 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"):
>>
>> Modified:
>> lldb/trunk/packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py?rev=255525&r1=255524&r2=255525&view=diff
>>
>> ==============================================================================
>> ---
>> lldb/trunk/packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py
>> (original)
>> +++
>> lldb/trunk/packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py Mon
>> Dec 14 12:49:16 2015
>> @@ -13,20 +13,11 @@ class TypedefTestCase(TestBase):
>>
>>      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):
>>
>> Modified:
>> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py?rev=255525&r1=255524&r2=255525&view=diff
>>
>> ==============================================================================
>> ---
>> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
>> (original)
>> +++
>> lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
>> Mon Dec 14 12:49:16 2015
>> @@ -6,9 +6,9 @@ class TestWithLimitDebugInfo(TestBase):
>>
>>      mydir = TestBase.compute_mydir(__file__)
>>
>> -    @dwarf_test
>> -    def test_with_dwarf(self):
>> -        self.buildDwarf()
>> +    @skipIf(debug_info=not_in(["dwarf"]))
>> +    def test_limit_debug_info(self):
>> +        self.build()
>>
>>          cwd = os.getcwd()
>>
>>
>> Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=255525&r1=255524&r2=255525&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
>> +++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Mon Dec 14
>> 12:49:16 2015
>> @@ -549,48 +549,6 @@ def no_debug_info_test(func):
>>      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):
>> @@ -2270,32 +2228,26 @@ class LLDBTestCaseFactory(type):
>>          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
>> -                @wraps(attrvalue)
>> -                def dwarf_test_method(self, attrvalue=attrvalue):
>> -                    self.debug_info = "dwarf"
>> -                    return attrvalue(self)
>> -                dwarf_method_name = attrname + "_dwarf"
>> -                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
>> +                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)
>> +                categories = set(getattr(attrvalue, "categories", [])) &
>> all_dbginfo_categories
>> +                if not categories:
>> +                    categories = all_dbginfo_categories
>> +
>> +                supported_categories = [x for x in categories
>> +                                        if
>> test_categories.is_supported_on_platform(x, target_platform)]
>> +                for category in supported_categories:
>> +                    @add_test_categories([category])
>> +                    @wraps(attrvalue)
>> +                    def test_method(self, attrvalue=attrvalue):
>> +                        self.debug_info = category
>> +                        return attrvalue(self)
>> +                    method_name = attrname + "_" + category
>> +                    test_method.__name__ = method_name
>> +                    newattrs[method_name] = test_method
>>              else:
>>                  newattrs[attrname] = attrvalue
>>          return super(LLDBTestCaseFactory, cls).__new__(cls, name, bases,
>> newattrs)
>>
>> Modified: lldb/trunk/packages/Python/lldbsuite/test/test_categories.py
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/test_categories.py?rev=255525&r1=255524&r2=255525&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/packages/Python/lldbsuite/test/test_categories.py
>> (original)
>> +++ lldb/trunk/packages/Python/lldbsuite/test/test_categories.py Mon Dec
>> 14 12:49:16 2015
>> @@ -12,8 +12,15 @@ import sys
>>
>>  # LLDB modules
>>
>> +debug_info_categories = [
>> +    'dwarf', 'dwo', 'dsym'
>> +]
>> +
>>  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',
>> @@ -35,6 +42,13 @@ def unique_string_match(yourentry, list)
>>          candidate = item
>>      return candidate
>>
>> +def is_supported_on_platform(category, platform):
>> +    if category == "dwo":
>> +        return platform in ["linux", "freebsd", "windows"]
>> +    elif category == "dsym":
>> +        return platform in ["darwin", "macosx", "ios"]
>> +    return True
>> +
>>  def validate(categories, exact_match):
>>      """
>>      For each category in categories, ensure that it's a valid category
>> (if exact_match is false,
>>
>>
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151214/16290969/attachment-0001.html>


More information about the lldb-commits mailing list