Index: test/functionalities/avoids-fd-leak/TestFdLeak.py =================================================================== --- test/functionalities/avoids-fd-leak/TestFdLeak.py +++ test/functionalities/avoids-fd-leak/TestFdLeak.py @@ -15,13 +15,13 @@ @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 @@ @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") Index: test/functionalities/signal/raise/TestRaise.py =================================================================== --- test/functionalities/signal/raise/TestRaise.py +++ test/functionalities/signal/raise/TestRaise.py @@ -32,7 +32,7 @@ @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) Index: test/lldbtest.py =================================================================== --- test/lldbtest.py +++ test/lldbtest.py @@ -930,20 +930,33 @@ 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.""" Index: test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py =================================================================== --- test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py +++ test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py @@ -32,6 +32,7 @@ @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()