Making it possible to specify a substring for a category name as long as the match is unique



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@181281 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/dotest.py b/test/dotest.py
index 8e8a2f2..4044551 100755
--- a/test/dotest.py
+++ b/test/dotest.py
@@ -318,6 +318,15 @@
     sys.exit(0)
 
 
+def unique_string_match(yourentry,list):
+	candidate = None
+	for item in list:
+		if item.startswith(yourentry):
+			if candidate:
+				return None
+			candidate = item
+	return candidate
+
 def parseOptionsAndInitTestdirs():
     """Initialize the list of directories containing our unittest scripts.
 
@@ -459,13 +468,18 @@
             archs = [platform_machine]
 
     if args.categoriesList:
+        finalCategoriesList = []
         for category in args.categoriesList:
+            origCategory = category
             if not(category in validCategories):
-                print "fatal error: category '" + category + "' is not a valid category"
+                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)
-        categoriesList = set(args.categoriesList)
+            finalCategoriesList.append(category)
+        categoriesList = set(finalCategoriesList)
         useCategories = True
     else:
         categoriesList = []