diff options
author | Johnny Chen <johnny.chen@apple.com> | 2010-12-01 22:47:54 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2010-12-01 22:47:54 +0000 |
commit | 75739045d344a6c5df94a1692b9d47d9c5d05dcb (patch) | |
tree | 0798a5cc29f08ed5eeb8c116c28c5485e2be5f0e | |
parent | fc5c522864b9e96a5bf557262ebf3fb01c249a82 (diff) | |
download | bcm5719-llvm-75739045d344a6c5df94a1692b9d47d9c5d05dcb.tar.gz bcm5719-llvm-75739045d344a6c5df94a1692b9d47d9c5d05dcb.zip |
Add a '-b blacklistFile' option to the test driver to take a file specifying the
test classes or test cases to be excludued from the test suite.
Check in an example blacklist file: blacklist.py:
"""
'blacklist' is a Python dictionary, it stores the mapping of a string describing
either a testclass or a testcase, i.e, testclass.testmethod, to the reason (a
string) it is blacklisted.
Following is an example which states that test class IntegerTypesExprTestCase
should be skipped because 'This test class crashed' and the test case
FoundationTestCase.test_data_type_and_expr_with_dsym should be skipped because
it is 'Temporarily disabled'.
blacklist = {'IntegerTypesExprTestCase': 'This test class crashed',
'FoundationTestCase.test_data_type_and_expr_with_dsym': 'Temporarily disabled'
}
"""
blacklist = {}
An example of invoking the test driver and specifying a blacklist file:
./dotest.py -b blacklist.py -v types
This runs the tests under 'types' directory but excludes the tests specified in
balcklist.py.
llvm-svn: 120620
-rw-r--r-- | lldb/test/blacklist.py | 16 | ||||
-rwxr-xr-x | lldb/test/dotest.py | 26 | ||||
-rw-r--r-- | lldb/test/lldbtest.py | 7 |
3 files changed, 49 insertions, 0 deletions
diff --git a/lldb/test/blacklist.py b/lldb/test/blacklist.py new file mode 100644 index 00000000000..5b16dec1449 --- /dev/null +++ b/lldb/test/blacklist.py @@ -0,0 +1,16 @@ +""" +'blacklist' is a Python dictionary, it stores the mapping of a string describing +either a testclass or a testcase, i.e, testclass.testmethod, to the reason (a +string) it is blacklisted. + +Following is an example which states that test class IntegerTypesExprTestCase +should be skipped because 'This test class crashed' and the test case +FoundationTestCase.test_data_type_and_expr_with_dsym should be skipped because +it is 'Temporarily disabled'. + +blacklist = {'IntegerTypesExprTestCase': 'This test class crashed', + 'FoundationTestCase.test_data_type_and_expr_with_dsym': 'Temporarily disabled' + } +""" + +blacklist = {} diff --git a/lldb/test/dotest.py b/lldb/test/dotest.py index c85e2067d5d..cc36ffccb87 100755 --- a/lldb/test/dotest.py +++ b/lldb/test/dotest.py @@ -45,6 +45,13 @@ class _WritelnDecorator(object): # The test suite. suite = unittest2.TestSuite() +# The blacklist is optional (-b blacklistFile) and allows a central place to skip +# testclass's and/or testclass.testmethod's. +blacklist = None + +# The dictionary as a result of sourcing blacklistFile. +blacklistConfig = {} + # The config file is optional. configFile = None @@ -103,6 +110,7 @@ def usage(): Usage: dotest.py [option] [args] where options: -h : print this help message and exit (also --help) +-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) -d : delay startup for 10 seconds (in order for the debugger to attach) @@ -219,6 +227,8 @@ def parseOptionsAndInitTestdirs(): '-h/--help as the first option prints out usage info and exit the program. """ + global blacklist + global blacklistConfig global configFile global count global delay @@ -244,6 +254,19 @@ def parseOptionsAndInitTestdirs(): if sys.argv[index].find('-h') != -1: usage() + elif sys.argv[index].startswith('-b'): + # Increment by 1 to fetch the blacklist file name option argument. + index += 1 + if index >= len(sys.argv) or sys.argv[index].startswith('-'): + usage() + blacklistFile = sys.argv[index] + if not os.path.isfile(blacklistFile): + print "Blacklist file:", blacklistFile, "does not exist!" + usage() + index += 1 + # Now read the blacklist contents and assign it to blacklist. + execfile(blacklistFile, globals(), blacklistConfig) + blacklist = blacklistConfig.get('blacklist') elif sys.argv[index].startswith('-c'): # Increment by 1 to fetch the config file name option argument. index += 1 @@ -593,6 +616,9 @@ atexit.register(lambda: lldb.SBDebugger.Terminate()) # Create a singleton SBDebugger in the lldb namespace. lldb.DBG = lldb.SBDebugger.Create() +# And put the blacklist in the lldb namespace, to be used by lldb.TestBase. +lldb.blacklist = blacklist + # Turn on lldb loggings if necessary. lldbLoggings() diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py index 639e348deb4..beabcd6690b 100644 --- a/lldb/test/lldbtest.py +++ b/lldb/test/lldbtest.py @@ -451,6 +451,13 @@ class TestBase(unittest2.TestCase): #import traceback #traceback.print_stack() + className = self.__class__.__name__ + classAndMethodName = "%s.%s" % (className, self._testMethodName) + if className in lldb.blacklist: + self.skipTest(lldb.blacklist.get(className)) + elif classAndMethodName in lldb.blacklist: + self.skipTest(lldb.blacklist.get(classAndMethodName)) + if ("LLDB_WAIT_BETWEEN_TEST_CASES" in os.environ and os.environ["LLDB_WAIT_BETWEEN_TEST_CASES"] == 'YES'): time.sleep(1.0) |