forked from OSchip/llvm-project
Add a '+a' command line option to the test driver to run only the Python API tests.
Add an attribute __python_api_test__ (set to True) to the @python_api_test decorated test method to distinguish them from the lldb command line tests. llvm-svn: 121500
This commit is contained in:
parent
47ed69e72c
commit
f3e22ac3c7
|
@ -46,11 +46,11 @@ class _WritelnDecorator(object):
|
|||
suite = unittest2.TestSuite()
|
||||
|
||||
# By default, both command line and Python API tests are performed.
|
||||
# See @python_api_test decorator in lldbtest.py.
|
||||
# Use @python_api_test decorator, defined in lldbtest.py, to mark a test as
|
||||
# a Python API test.
|
||||
dont_do_python_api_test = False
|
||||
|
||||
# By default, both command line and Python API tests are performed.
|
||||
# This does not work yet as the @lldb_command_test decorator is needed.
|
||||
just_do_python_api_test = False
|
||||
|
||||
# The blacklist is optional (-b blacklistFile) and allows a central place to skip
|
||||
|
@ -123,6 +123,7 @@ where options:
|
|||
-h : print this help message and exit (also --help)
|
||||
-a : don't do lldb Python API tests
|
||||
use @python_api_test to decorate a test case as lldb Python API test
|
||||
+a : just do lldb Python API tests
|
||||
-b : read a blacklist file specified after this option
|
||||
-c : read a config file specified after this option
|
||||
(see also lldb-trunk/example/test/usage-config)
|
||||
|
|
|
@ -236,6 +236,8 @@ def python_api_test(func):
|
|||
self.skipTest("Skip Python API tests")
|
||||
return func(self, *args, **kwargs)
|
||||
|
||||
# Mark this function as such to separate them from lldb command line tests.
|
||||
wrapper.__python_api_test__ = True
|
||||
return wrapper
|
||||
|
||||
class recording(StringIO.StringIO):
|
||||
|
@ -477,6 +479,16 @@ class TestBase(unittest2.TestCase):
|
|||
elif classAndMethodName in lldb.blacklist:
|
||||
self.skipTest(lldb.blacklist.get(classAndMethodName))
|
||||
|
||||
# Python API only test is decorated with @python_api_test,
|
||||
# which also sets the "__python_api_test__" attribute of the
|
||||
# function object to True.
|
||||
if lldb.just_do_python_api_test:
|
||||
testMethod = getattr(self, self._testMethodName)
|
||||
if getattr(testMethod, "__python_api_test__", False):
|
||||
pass
|
||||
else:
|
||||
self.skipTest("Skip lldb command line test")
|
||||
|
||||
if ("LLDB_WAIT_BETWEEN_TEST_CASES" in os.environ and
|
||||
os.environ["LLDB_WAIT_BETWEEN_TEST_CASES"] == 'YES'):
|
||||
waitTime = 1.0
|
||||
|
|
Loading…
Reference in New Issue