[Lldb-commits] [lldb] r260176 - Remove the skipUnlessArch decorator.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 8 16:36:22 PST 2016


Author: zturner
Date: Mon Feb  8 18:36:22 2016
New Revision: 260176

URL: http://llvm.org/viewvc/llvm-project?rev=260176&view=rev
Log:
Remove the skipUnlessArch decorator.

Convert everything over to using skipIf.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/decorators.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/TestRegisters.py
    lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/decorators.py?rev=260176&r1=260175&r2=260176&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Mon Feb  8 18:36:22 2016
@@ -291,14 +291,6 @@ def not_remote_testsuite_ready(func):
         return "Not ready for remote testsuite" if lldb.remote_platform else None
     return skipTestIfFn(is_remote)(func)
 
-def _match_architectures(archs, actual_arch):
-    retype = type(re.compile('hello, world'))
-    list_passes = isinstance(archs, list) and actual_arch in archs
-    basestring_passes = isinstance(archs, six.string_types) and actual_arch == archs
-    regex_passes = isinstance(archs, retype) and re.match(archs, actual_arch)
-
-    return (list_passes or basestring_passes or regex_passes)
-
 def expectedFailureDwarf(bugnumber=None):
     return expectedFailureAll(bugnumber=bugnumber, debug_info="dwarf")
 
@@ -559,25 +551,6 @@ def skipUnlessHostPlatform(oslist):
     """Decorate the item to skip tests unless running on one of the listed host platforms."""
     return skipIf(hostoslist=no_match(oslist))
 
-def skipUnlessArch(archs):
-    """Decorate the item to skip tests unless running on one of the listed architectures."""
-    # This decorator cannot be ported to `skipIf` yet because it is uused with regular
-    # expressions, which the common matcher does not yet support.
-    def myImpl(func):
-        if isinstance(func, type) and issubclass(func, unittest2.TestCase):
-            raise Exception("@skipUnlessArch can only be used to decorate a test method")
-
-        @wraps(func)
-        def wrapper(*args, **kwargs):
-            self = args[0]
-            if not _match_architectures(archs, self.getArchitecture()):
-                self.skipTest("skipping for architecture %s" % (self.getArchitecture())) 
-            else:
-                func(*args, **kwargs)
-        return wrapper
-
-    return myImpl
-
 def skipIfPlatform(oslist):
     """Decorate the item to skip tests if running on one of the listed platforms."""
     # This decorator cannot be ported to `skipIf` yet because it is used on entire

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/TestRegisters.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/TestRegisters.py?rev=260176&r1=260175&r2=260176&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/TestRegisters.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/TestRegisters.py Mon Feb  8 18:36:22 2016
@@ -26,7 +26,7 @@ class RegisterCommandsTestCase(TestBase)
         TestBase.tearDown(self)
 
     @skipIfiOSSimulator
-    @skipUnlessArch(['amd64', 'arm', 'i386', 'x86_64'])
+    @skipIf(archs=no_match(['amd64', 'arm', 'i386', 'x86_64']))
     def test_register_commands(self):
         """Test commands related to registers, in particular vector registers."""
         self.build()
@@ -49,7 +49,7 @@ class RegisterCommandsTestCase(TestBase)
 
     @skipIfiOSSimulator
     @skipIfTargetAndroid(archs=["i386"]) # Writing of mxcsr register fails, presumably due to a kernel/hardware problem
-    @skipUnlessArch(['amd64', 'arm', 'i386', 'x86_64'])
+    @skipIf(archs=no_match(['amd64', 'arm', 'i386', 'x86_64']))
     def test_fp_register_write(self):
         """Test commands that write to registers, in particular floating-point registers."""
         self.build()
@@ -58,14 +58,14 @@ class RegisterCommandsTestCase(TestBase)
     @skipIfiOSSimulator
     @expectedFailureAndroid(archs=["i386"]) # "register read fstat" always return 0xffff
     @skipIfFreeBSD    #llvm.org/pr25057
-    @skipUnlessArch(['amd64', 'i386', 'x86_64'])
+    @skipIf(archs=no_match(['amd64', 'i386', 'x86_64']))
     def test_fp_special_purpose_register_read(self):
         """Test commands that read fpu special purpose registers."""
         self.build()
         self.fp_special_purpose_register_read()
 
     @skipIfiOSSimulator
-    @skipUnlessArch(['amd64', 'arm', 'i386', 'x86_64'])
+    @skipIf(archs=no_match(['amd64', 'arm', 'i386', 'x86_64']))
     def test_register_expressions(self):
         """Test expression evaluation with commands related to registers."""
         self.build()
@@ -86,21 +86,21 @@ class RegisterCommandsTestCase(TestBase)
             self.expect("expr -- ($rax & 0xffffffff) == $eax", substrs = ['true'])
 
     @skipIfiOSSimulator
-    @skipUnlessArch(['amd64', 'x86_64'])
+    @skipIf(archs=no_match(['amd64', 'x86_64']))
     def test_convenience_registers(self):
         """Test convenience registers."""
         self.build()
         self.convenience_registers()
 
     @skipIfiOSSimulator
-    @skipUnlessArch(['amd64', 'x86_64'])
+    @skipIf(archs=no_match(['amd64', 'x86_64']))
     def test_convenience_registers_with_process_attach(self):
         """Test convenience registers after a 'process attach'."""
         self.build()
         self.convenience_registers_with_process_attach(test_16bit_regs=False)
 
     @skipIfiOSSimulator
-    @skipUnlessArch(['amd64', 'x86_64'])
+    @skipIf(archs=no_match(['amd64', 'x86_64']))
     def test_convenience_registers_16bit_with_process_attach(self):
         """Test convenience registers after a 'process attach'."""
         self.build()

Modified: lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py?rev=260176&r1=260175&r2=260176&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py Mon Feb  8 18:36:22 2016
@@ -176,7 +176,7 @@ class SettingsCommandTestCase(TestBase):
         self.expect("settings show auto-confirm", SETTING_MSG("auto-confirm"),
             startstr = "auto-confirm (boolean) = false")
 
-    @skipUnlessArch(['x86_64', 'i386', 'i686'])
+    @skipIf(archs=no_match(['x86_64', 'i386', 'i686']))
     def test_disassembler_settings(self):
         """Test that user options for the disassembler take effect."""
         self.build()




More information about the lldb-commits mailing list