<div dir="ltr">The previous code was just an unrolled loop as far as I can tell.  Do you mean the loop has different behavior than the unrolled loop?  Because it looks identical to me (although admittedly python has a lot of nuances that I don't understand in great detail)</div><br><div class="gmail_quote"><div dir="ltr">On Mon, Dec 14, 2015 at 1:59 PM Siva Chandra <<a href="mailto:sivachandra@google.com">sivachandra@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Dec 14, 2015 at 10:49 AM, Zachary Turner via lldb-commits<br>
<<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a>> wrote:<br>
> Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=255525&r1=255524&r2=255525&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=255525&r1=255524&r2=255525&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)<br>
> +++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Mon Dec 14 12:49:16 2015<br>
> @@ -549,48 +549,6 @@ def no_debug_info_test(func):<br>
>      wrapper.__no_debug_info_test__ = True<br>
>      return wrapper<br>
><br>
> -def dsym_test(func):<br>
> -    """Decorate the item as a dsym test."""<br>
> -    if isinstance(func, type) and issubclass(func, unittest2.TestCase):<br>
> -        raise Exception("@dsym_test can only be used to decorate a test method")<br>
> -    @wraps(func)<br>
> -    def wrapper(self, *args, **kwargs):<br>
> -        if configuration.dont_do_dsym_test:<br>
> -            self.skipTest("dsym tests")<br>
> -        return func(self, *args, **kwargs)<br>
> -<br>
> -    # Mark this function as such to separate them from the regular tests.<br>
> -    wrapper.__dsym_test__ = True<br>
> -    return wrapper<br>
> -<br>
> -def dwarf_test(func):<br>
> -    """Decorate the item as a dwarf test."""<br>
> -    if isinstance(func, type) and issubclass(func, unittest2.TestCase):<br>
> -        raise Exception("@dwarf_test can only be used to decorate a test method")<br>
> -    @wraps(func)<br>
> -    def wrapper(self, *args, **kwargs):<br>
> -        if configuration.dont_do_dwarf_test:<br>
> -            self.skipTest("dwarf tests")<br>
> -        return func(self, *args, **kwargs)<br>
> -<br>
> -    # Mark this function as such to separate them from the regular tests.<br>
> -    wrapper.__dwarf_test__ = True<br>
> -    return wrapper<br>
> -<br>
> -def dwo_test(func):<br>
> -    """Decorate the item as a dwo test."""<br>
> -    if isinstance(func, type) and issubclass(func, unittest2.TestCase):<br>
> -        raise Exception("@dwo_test can only be used to decorate a test method")<br>
> -    @wraps(func)<br>
> -    def wrapper(self, *args, **kwargs):<br>
> -        if configuration.dont_do_dwo_test:<br>
> -            self.skipTest("dwo tests")<br>
> -        return func(self, *args, **kwargs)<br>
> -<br>
> -    # Mark this function as such to separate them from the regular tests.<br>
> -    wrapper.__dwo_test__ = True<br>
> -    return wrapper<br>
> -<br>
>  def debugserver_test(func):<br>
>      """Decorate the item as a debugserver test."""<br>
>      if isinstance(func, type) and issubclass(func, unittest2.TestCase):<br>
> @@ -2270,32 +2228,26 @@ class LLDBTestCaseFactory(type):<br>
>          newattrs = {}<br>
>          for attrname, attrvalue in attrs.items():<br>
>              if attrname.startswith("test") and not getattr(attrvalue, "__no_debug_info_test__", False):<br>
> -                @dsym_test<br>
> -                @wraps(attrvalue)<br>
> -                def dsym_test_method(self, attrvalue=attrvalue):<br>
> -                    self.debug_info = "dsym"<br>
> -                    return attrvalue(self)<br>
> -                dsym_method_name = attrname + "_dsym"<br>
> -                dsym_test_method.__name__ = dsym_method_name<br>
> -                newattrs[dsym_method_name] = dsym_test_method<br>
> -<br>
> -                @dwarf_test<br>
> -                @wraps(attrvalue)<br>
> -                def dwarf_test_method(self, attrvalue=attrvalue):<br>
> -                    self.debug_info = "dwarf"<br>
> -                    return attrvalue(self)<br>
> -                dwarf_method_name = attrname + "_dwarf"<br>
> -                dwarf_test_method.__name__ = dwarf_method_name<br>
> -                newattrs[dwarf_method_name] = dwarf_test_method<br>
> -<br>
> -                @dwo_test<br>
> -                @wraps(attrvalue)<br>
> -                def dwo_test_method(self, attrvalue=attrvalue):<br>
> -                    self.debug_info = "dwo"<br>
> -                    return attrvalue(self)<br>
> -                dwo_method_name = attrname + "_dwo"<br>
> -                dwo_test_method.__name__ = dwo_method_name<br>
> -                newattrs[dwo_method_name] = dwo_test_method<br>
> +                target_platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]<br>
> +<br>
> +                # If any debug info categories were explicitly tagged, assume that list to be<br>
> +                # authoritative.  If none were specified, try with all debug info formats.<br>
> +                all_dbginfo_categories = set(test_categories.debug_info_categories)<br>
> +                categories = set(getattr(attrvalue, "categories", [])) & all_dbginfo_categories<br>
> +                if not categories:<br>
> +                    categories = all_dbginfo_categories<br>
> +<br>
> +                supported_categories = [x for x in categories<br>
> +                                        if test_categories.is_supported_on_platform(x, target_platform)]<br>
> +                for category in supported_categories:<br>
> +                    @add_test_categories([category])<br>
> +                    @wraps(attrvalue)<br>
> +                    def test_method(self, attrvalue=attrvalue):<br>
> +                        self.debug_info = category<br>
<br>
I believe test methods are added here to the same class. In which<br>
case, self.debug_info is overwritten with each iteration of this for<br>
loop.<br>
<br>
> +                        return attrvalue(self)<br>
> +                    method_name = attrname + "_" + category<br>
> +                    test_method.__name__ = method_name<br>
> +                    newattrs[method_name] = test_method<br>
>              else:<br>
>                  newattrs[attrname] = attrvalue<br>
>          return super(LLDBTestCaseFactory, cls).__new__(cls, name, bases, newattrs)<br>
</blockquote></div>