Remove the skipUnlessArch decorator.

Convert everything over to using skipIf.

llvm-svn: 260176
This commit is contained in:
Zachary Turner 2016-02-09 00:36:22 +00:00
parent aa42f29221
commit 779df76c56
3 changed files with 8 additions and 35 deletions

View File

@ -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

View File

@ -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()

View File

@ -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()