[Lldb-commits] [lldb] r239183 - [TestGdbRemoteAbort] Skip on API 16 Android devices

Siva Chandra sivachandra at google.com
Fri Jun 5 12:54:50 PDT 2015


Author: sivachandra
Date: Fri Jun  5 14:54:49 2015
New Revision: 239183

URL: http://llvm.org/viewvc/llvm-project?rev=239183&view=rev
Log:
[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

Modified:
    lldb/trunk/test/functionalities/avoids-fd-leak/TestFdLeak.py
    lldb/trunk/test/functionalities/signal/raise/TestRaise.py
    lldb/trunk/test/lldbtest.py
    lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py

Modified: lldb/trunk/test/functionalities/avoids-fd-leak/TestFdLeak.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/avoids-fd-leak/TestFdLeak.py?rev=239183&r1=239182&r2=239183&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/avoids-fd-leak/TestFdLeak.py (original)
+++ lldb/trunk/test/functionalities/avoids-fd-leak/TestFdLeak.py Fri Jun  5 14:54:49 2015
@@ -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")

Modified: lldb/trunk/test/functionalities/signal/raise/TestRaise.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/signal/raise/TestRaise.py?rev=239183&r1=239182&r2=239183&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/signal/raise/TestRaise.py (original)
+++ lldb/trunk/test/functionalities/signal/raise/TestRaise.py Fri Jun  5 14:54:49 2015
@@ -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)

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=239183&r1=239182&r2=239183&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Fri Jun  5 14:54:49 2015
@@ -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."""

Modified: lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py?rev=239183&r1=239182&r2=239183&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py (original)
+++ lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py Fri Jun  5 14:54:49 2015
@@ -32,6 +32,7 @@ class TestGdbRemoteAbort(gdbremote_testc
 
     @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()





More information about the lldb-commits mailing list