[TestGdbRemoteAbort] Skip on API 16 Android devices

Summary:
This change also adds the infrastructure required to specify the API
levels for which tests should be skipped.

Reviewers: chying, labath

Reviewed By: labath

Subscribers: tberghammer, lldb-commits

Differential Revision: http://reviews.llvm.org/D10282

llvm-svn: 239183
This commit is contained in:
Siva Chandra
2015-06-05 19:54:49 +00:00
parent db6fd1ac25
commit 77f20fc8d3
4 changed files with 31 additions and 17 deletions

View File

@@ -15,13 +15,13 @@ class AvoidsFdLeakTestCase(TestBase):
@expectedFailure(lambda x: sys.version_info >= (2, 7, 8), "bugs.freebsd.org/197376") # python random leaks fd
@expectedFailureLinux # xfail flakey test to get buildbot green
@skipIfWindows # The check for descriptor leakage needs to be implemented differently here.
@skipIfTargetAndroid # Android have some other file descriptors open by the shell
@skipIfTargetAndroid() # Android have some other file descriptors open by the shell
def test_fd_leak_basic (self):
self.do_test([])
@expectedFailure(lambda x: sys.version_info >= (2, 7, 8), "bugs.freebsd.org/197376") # python random leaks fd
@skipIfWindows # The check for descriptor leakage needs to be implemented differently here.
@skipIfTargetAndroid # Android have some other file descriptors open by the shell
@skipIfTargetAndroid() # Android have some other file descriptors open by the shell
def test_fd_leak_log (self):
self.do_test(["log enable -f '/dev/null' lldb commands"])
@@ -44,7 +44,7 @@ class AvoidsFdLeakTestCase(TestBase):
@expectedFailure(lambda x: sys.version_info >= (2, 7, 8), "bugs.freebsd.org/197376") # python random leaks fd
@expectedFailureLinux # xfail flakey test to get buildbot green
@skipIfWindows # The check for descriptor leakage needs to be implemented differently here.
@skipIfTargetAndroid # Android have some other file descriptors open by the shell
@skipIfTargetAndroid() # Android have some other file descriptors open by the shell
def test_fd_leak_multitarget (self):
self.buildDefault()
exe = os.path.join (os.getcwd(), "a.out")

View File

@@ -32,7 +32,7 @@ class RaiseTestCase(TestBase):
@skipIfWindows # signals do not exist on Windows
@dwarf_test
@skipIfDarwin # darwin does not support real time signals
@skipIfTargetAndroid
@skipIfTargetAndroid()
def test_sigsigrtmin_with_dwarf(self):
self.buildDwarf()
self.signal_test('SIGRTMIN', True)

View File

@@ -930,20 +930,33 @@ def skipIfi386(func):
func(*args, **kwargs)
return wrapper
def skipIfTargetAndroid(func):
"""Decorate the item to skip tests that should be skipped when the target is Android."""
if isinstance(func, type) and issubclass(func, unittest2.TestCase):
raise Exception("@skipIfTargetAndroid can only be used to decorate a test method")
@wraps(func)
def wrapper(*args, **kwargs):
from unittest2 import case
self = args[0]
triple = self.dbg.GetSelectedPlatform().GetTriple()
if re.match(".*-.*-.*-android", triple):
self.skipTest("skip on Android target")
else:
def skipIfTargetAndroid(api_levels=None):
"""Decorator to skip tests when the target is Android.
Arguments:
api_levels - The API levels for which the test should be skipped. If
it is None, then the test will be skipped for all API levels.
"""
def myImpl(func):
if isinstance(func, type) and issubclass(func, unittest2.TestCase):
raise Exception("@skipIfTargetAndroid can only be used to "
"decorate a test method")
@wraps(func)
def wrapper(*args, **kwargs):
from unittest2 import case
self = args[0]
triple = self.dbg.GetSelectedPlatform().GetTriple()
if re.match(".*-.*-.*-android", triple):
if api_levels:
device_api = android_device_api()
if device_api and (device_api in api_levels):
self.skipTest(
"skip on Android target with API %d" % device_api)
else:
self.skipTest("skip on Android target")
func(*args, **kwargs)
return wrapper
return wrapper
return myImpl
def skipUnlessCompilerRt(func):
"""Decorate the item to skip tests if testing remotely."""

View File

@@ -32,6 +32,7 @@ class TestGdbRemoteAbort(gdbremote_testcase.GdbRemoteTestCaseBase):
@llgs_test
@dwarf_test
@skipIfTargetAndroid(api_levels=[16]) # abort() on API 16 raises SIGSEGV!
def test_inferior_abort_received_llgs_dwarf(self):
self.init_llgs_test()
self.buildDwarf()