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

llvm-svn: 219146
This commit is contained in:
Enrico Granata 2014-10-06 21:37:06 +00:00
parent 12792af026
commit b633e43d2b
2 changed files with 17 additions and 0 deletions

View File

@ -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."""

View File

@ -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):