[Lldb-commits] [lldb] r219146 - In some cases, the LLDB test suite will be run on a built framework with no sources coming along. In those cases, we want to skip the SB API test case. Add a marker for that, and apply it

Enrico Granata egranata at apple.com
Mon Oct 6 14:37:06 PDT 2014


Author: enrico
Date: Mon Oct  6 16:37:06 2014
New Revision: 219146

URL: http://llvm.org/viewvc/llvm-project?rev=219146&view=rev
Log:
In some cases, the LLDB test suite will be run on a built framework with no sources coming along. In those cases, we want to skip the SB API test case. Add a marker for that, and apply it

Modified:
    lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py
    lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py?rev=219146&r1=219145&r2=219146&view=diff
==============================================================================
--- lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py (original)
+++ lldb/trunk/test/api/check_public_api_headers/TestPublicAPIHeaders.py Mon Oct  6 16:37:06 2014
@@ -19,6 +19,7 @@ class SBDirCheckerCase(TestBase):
         self.source = 'main.cpp'
         self.exe_name = 'a.out'
 
+    @skipIfNoSBHeaders
     def test_sb_api_directory(self):
         """Test the SB API directory and make sure there's no unwanted stuff."""
 

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=219146&r1=219145&r2=219146&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Mon Oct  6 16:37:06 2014
@@ -554,6 +554,22 @@ def skipIfLinux(func):
             func(*args, **kwargs)
     return wrapper
 
+def skipIfNoSBHeaders(func):
+    """Decorate the item to mark tests that should be skipped when LLDB is built with no SB API headers."""
+    if isinstance(func, type) and issubclass(func, unittest2.TestCase):
+        raise Exception("@skipIfLinux can only be used to decorate a test method")
+    @wraps(func)
+    def wrapper(*args, **kwargs):
+        from unittest2 import case
+        self = args[0]
+        platform = sys.platform
+        header = os.path.join(os.environ["LLDB_SRC"], "include", "lldb", "API", "LLDB.h")
+        if not os.path.exists(header):
+            self.skipTest("skip because LLDB.h header not found")
+        else:
+            func(*args, **kwargs)
+    return wrapper
+
 def skipIfWindows(func):
     """Decorate the item to skip tests that should be skipped on Windows."""
     if isinstance(func, type) and issubclass(func, unittest2.TestCase):





More information about the lldb-commits mailing list