aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefanus Du Toit <stefanus.du.toit@intel.com>2013-08-01 17:59:20 +0000
committerStefanus Du Toit <stefanus.du.toit@intel.com>2013-08-01 17:59:20 +0000
commit2bf963306acbe20bd3de14ad150c157243cd3844 (patch)
tree97dc574c5799136dc3210dd4cb9d1bb84a89df0f
parenta749646c914e6731cb789bcd0f25e5740c47e722 (diff)
downloadlldb-2bf963306acbe20bd3de14ad150c157243cd3844.tar.gz
Allow test categories to be skipped.
This adds a new parameter, --skip-category, that can be used to list categories that should be skipped. For example, to run all tests except for Objective-C ones, one can now write: ./dotest.py --skip-category objc [...] git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@187590 91177308-0d34-0410-b5e6-96231b3b80d8
-rwxr-xr-xtest/dotest.py46
1 files changed, 34 insertions, 12 deletions
diff --git a/test/dotest.py b/test/dotest.py
index 3b6d87127..d4bb9d913 100755
--- a/test/dotest.py
+++ b/test/dotest.py
@@ -132,6 +132,8 @@ blacklistConfig = {}
categoriesList = None
# set to true if we are going to use categories for cherry-picking test cases
useCategories = False
+# Categories we want to skip
+skipCategories = []
# use this to track per-category failures
failuresPerCategory = {}
@@ -347,6 +349,26 @@ def unique_string_match(yourentry,list):
class ArgParseNamespace(object):
pass
+def validate_categories(categories):
+ """For each category in categories, ensure that it's a valid category (or a prefix thereof).
+ If a category is invalid, print a message and quit.
+ If all categories are valid, return the list of categories. Prefixes are expanded in the
+ returned list.
+ """
+ global validCategories
+ result = []
+ for category in categories:
+ origCategory = category
+ if category not in validCategories:
+ category = unique_string_match(category, validCategories)
+ if (category not in validCategories) or category == None:
+ print "fatal error: category '" + origCategory + "' is not a valid category"
+ print "if you have added a new category, please edit dotest.py, adding your new category to validCategories"
+ print "else, please specify one or more of the following: " + str(validCategories.keys())
+ sys.exit(1)
+ result.append(category)
+ return result
+
def parseOptionsAndInitTestdirs():
"""Initialize the list of directories containing our unittest scripts.
@@ -363,6 +385,7 @@ def parseOptionsAndInitTestdirs():
global categoriesList
global validCategories
global useCategories
+ global skipCategories
global lldbFrameworkPath
global lldbExecutablePath
global configFile
@@ -424,6 +447,7 @@ def parseOptionsAndInitTestdirs():
group.add_argument('-p', metavar='pattern', help='Specify a regexp filename pattern for inclusion in the test suite')
group.add_argument('-X', metavar='directory', help="Exclude a directory from consideration for test discovery. -X types => if 'types' appear in the pathname components of a potential testfile, it will be ignored")
group.add_argument('-G', '--category', metavar='category', action='append', dest='categoriesList', help=textwrap.dedent('''Specify categories of test cases of interest. Can be specified more than once.'''))
+ group.add_argument('--skip-category', metavar='category', action='append', dest='skipCategories', help=textwrap.dedent('''Specify categories of test cases to skip. Takes precedence over -G. Can be specified more than once.'''))
# Configuration options
group = parser.add_argument_group('Configuration options')
@@ -488,22 +512,14 @@ def parseOptionsAndInitTestdirs():
archs = [platform_machine]
if args.categoriesList:
- finalCategoriesList = []
- for category in args.categoriesList:
- origCategory = category
- if not(category in validCategories):
- category = unique_string_match(category,validCategories)
- if not(category in validCategories) or category == None:
- print "fatal error: category '" + origCategory + "' is not a valid category"
- print "if you have added a new category, please edit dotest.py, adding your new category to validCategories"
- print "else, please specify one or more of the following: " + str(validCategories.keys())
- sys.exit(1)
- finalCategoriesList.append(category)
- categoriesList = set(finalCategoriesList)
+ categoriesList = set(validate_categories(args.categoriesList))
useCategories = True
else:
categoriesList = []
+ if args.skipCategories:
+ skipCategories = validate_categories(args.skipCategories)
+
if args.compilers:
compilers = args.compilers
else:
@@ -1467,6 +1483,12 @@ for ia in range(len(archs) if iterArchs else 1):
test_categories = self.getCategoriesForTest(test)
if len(test_categories) == 0 or len(categoriesList & set(test_categories)) == 0:
return True
+
+ global skipCategories
+ for category in skipCategories:
+ if category in self.getCategoriesForTest(test):
+ return True
+
return False
def hardMarkAsSkipped(self,test):