[Lldb-commits] [lldb] r119399 - /lldb/trunk/test/dotest.py

Johnny Chen johnny.chen at apple.com
Tue Nov 16 14:42:58 PST 2010


Author: johnny
Date: Tue Nov 16 16:42:58 2010
New Revision: 119399

URL: http://llvm.org/viewvc/llvm-project?rev=119399&view=rev
Log:
Add an option '-# count' to run the specified test suite for a said number of times.
This is not to be used during normal test suite run, but to be used to stress test
specific test sequences repeatedly.

Example:

./dotest.py -# 3 -v breakpoint_conditions

will repeat the test suite 3 times for tests under the breakpoint_conditions directory.

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=119399&r1=119398&r2=119399&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Tue Nov 16 16:42:58 2010
@@ -48,6 +48,9 @@
 # The config file is optional.
 configFile = None
 
+# Test suite repeat count.  Can be overwritten with '-# count'.
+count = 1
+
 # The dictionary as a result of sourcing configFile.
 config = {}
 
@@ -122,6 +125,7 @@
 -t   : trace lldb command execution and result
 -v   : do verbose mode of unittest framework
 -w   : insert some wait time (currently 0.5 sec) between consecutive test cases
+-#   : Repeat the test suite for a specified number of times
 
 and:
 args : specify a list of directory names to search for test modules named after
@@ -216,6 +220,7 @@
     """
 
     global configFile
+    global count
     global delay
     global filterspec
     global fs4all
@@ -301,6 +306,13 @@
         elif sys.argv[index].startswith('-w'):
             os.environ["LLDB_WAIT_BETWEEN_TEST_CASES"] = 'YES'
             index += 1
+        elif sys.argv[index].startswith('-#'):
+            # Increment by 1 to fetch the repeat count argument.
+            index += 1
+            if index >= len(sys.argv) or sys.argv[index].startswith('-'):
+                usage()
+            count = int(sys.argv[index])
+            index += 1
         else:
             print "Unknown option: ", sys.argv[index]
             usage()
@@ -709,7 +721,7 @@
 
             def __init__(self, *args):
                 if LLDBTestResult.__singleton__:
-                    raise "LLDBTestResult instantiated more than once"
+                    raise Exception("LLDBTestResult instantiated more than once")
                 super(LLDBTestResult, self).__init__(*args)
                 LLDBTestResult.__singleton__ = self
                 # Now put this singleton into the lldb module namespace.
@@ -740,8 +752,12 @@
                     method()
 
         # Invoke the test runner.
-        result = unittest2.TextTestRunner(stream=sys.stderr, verbosity=verbose,
-                                          resultclass=LLDBTestResult).run(suite)
+        if count == 1:
+            result = unittest2.TextTestRunner(stream=sys.stderr, verbosity=verbose,
+                                              resultclass=LLDBTestResult).run(suite)
+        else:
+            for i in range(count):
+                result = unittest2.TextTestRunner(stream=sys.stderr, verbosity=verbose).run(suite)
         
 
 if sdir_has_content:





More information about the lldb-commits mailing list