[Lldb-commits] [lldb] r249828 - dotest.py: Fail if we detect multiple tests with the same name

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 9 05:48:17 PDT 2015


Author: labath
Date: Fri Oct  9 07:48:17 2015
New Revision: 249828

URL: http://llvm.org/viewvc/llvm-project?rev=249828&view=rev
Log:
dotest.py: Fail if we detect multiple tests with the same name

Summary:
Log files produced by dotest have names derived from the test name, and this produces errors in
case we have multiple tests with the same name. Additionally, it's good if the test name explains
what the test is testing (which it clearly doesn't do well if there are multiple tests with
identical names). This commit makes the presence of such tests a hard error.

Reviewers: tberghammer, zturner

Subscribers: iancottrell, lldb-commits

Differential Revision: http://reviews.llvm.org/D13588

Modified:
    lldb/trunk/test/dotest.py

Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=249828&r1=249827&r2=249828&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Fri Oct  9 07:48:17 2015
@@ -265,6 +265,9 @@ results_formatter_name = None
 results_formatter_object = None
 results_formatter_options = None
 
+# The names of all tests. Used to assert we don't have two tests with the same base name.
+all_tests = set()
+
 def usage(parser):
     parser.print_help()
     if verbose > 0:
@@ -1288,6 +1291,7 @@ def visit(prefix, dir, names):
     global filters
     global fs4all
     global excluded
+    global all_tests
 
     if set(dir.split(os.sep)).intersection(excluded):
         #print "Detected an excluded dir component: %s" % dir
@@ -1298,6 +1302,11 @@ def visit(prefix, dir, names):
             continue
 
         if '.py' == os.path.splitext(name)[1] and name.startswith(prefix):
+
+            if name in all_tests:
+                raise Exception("Found multiple tests with the name %s" % name)
+            all_tests.add(name)
+
             # Try to match the regexp pattern, if specified.
             if regexp:
                 import re




More information about the lldb-commits mailing list