[Lldb-commits] [PATCH] Skip fdleak tests on android

Tamas Berghammer tberghammer at google.com
Fri Mar 13 03:15:01 PDT 2015


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D8299

Files:
  lldb/trunk/test/functionalities/avoids-fd-leak/TestFdLeak.py
  lldb/trunk/test/lldbtest.py

Index: lldb/trunk/test/functionalities/avoids-fd-leak/TestFdLeak.py
===================================================================
--- lldb/trunk/test/functionalities/avoids-fd-leak/TestFdLeak.py
+++ lldb/trunk/test/functionalities/avoids-fd-leak/TestFdLeak.py
@@ -14,11 +14,13 @@
 
     @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
     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
     def test_fd_leak_log (self):
         self.do_test(["log enable -f '/dev/null' lldb commands"])
 
@@ -40,13 +42,14 @@
 
     @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
     def test_fd_leak_multitarget (self):
         self.buildDefault()
         exe = os.path.join (os.getcwd(), "a.out")
 
         target = self.dbg.CreateTarget(exe)
-	breakpoint = target.BreakpointCreateBySourceRegex ('Set breakpoint here', lldb.SBFileSpec ("main.c", False))
-	self.assertTrue(breakpoint, VALID_BREAKPOINT)
+        breakpoint = target.BreakpointCreateBySourceRegex ('Set breakpoint here', lldb.SBFileSpec ("main.c", False))
+        self.assertTrue(breakpoint, VALID_BREAKPOINT)
 
         process1 = target.LaunchSimple (None, None, self.get_process_working_directory())
         self.assertTrue(process1, PROCESS_IS_VALID)
Index: lldb/trunk/test/lldbtest.py
===================================================================
--- lldb/trunk/test/lldbtest.py
+++ lldb/trunk/test/lldbtest.py
@@ -778,6 +778,21 @@
             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:
+            func(*args, **kwargs)
+    return wrapper
+
 def skipUnlessCompilerRt(func):
     """Decorate the item to skip tests if testing remotely."""
     if isinstance(func, type) and issubclass(func, unittest2.TestCase):

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8299.21909.patch
Type: text/x-patch
Size: 3076 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150313/97d8105e/attachment.bin>


More information about the lldb-commits mailing list