[Lldb-commits] [lldb] r120620 - in /lldb/trunk/test: blacklist.py dotest.py lldbtest.py

Johnny Chen johnny.chen at apple.com
Wed Dec 1 14:47:54 PST 2010


Author: johnny
Date: Wed Dec  1 16:47:54 2010
New Revision: 120620

URL: http://llvm.org/viewvc/llvm-project?rev=120620&view=rev
Log:
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.

Added:
    lldb/trunk/test/blacklist.py
Modified:
    lldb/trunk/test/dotest.py
    lldb/trunk/test/lldbtest.py

Added: lldb/trunk/test/blacklist.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/blacklist.py?rev=120620&view=auto
==============================================================================
--- lldb/trunk/test/blacklist.py (added)
+++ lldb/trunk/test/blacklist.py Wed Dec  1 16:47:54 2010
@@ -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 = {}

Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=120620&r1=120619&r2=120620&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Wed Dec  1 16:47:54 2010
@@ -45,6 +45,13 @@
 # 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 @@
 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 @@
     '-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 @@
 
         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 @@
 # 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()
 

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=120620&r1=120619&r2=120620&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Wed Dec  1 16:47:54 2010
@@ -451,6 +451,13 @@
         #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)





More information about the lldb-commits mailing list