[Lldb-commits] [lldb] r156335 - /lldb/trunk/test/redo.py

Johnny Chen johnny.chen at apple.com
Mon May 7 15:59:00 PDT 2012


Author: johnny
Date: Mon May  7 17:59:00 2012
New Revision: 156335

URL: http://llvm.org/viewvc/llvm-project?rev=156335&view=rev
Log:
Add an -F option to the redo.py script to selectively re-run only those failed sessions whose filenames contain the component(s)
specified.  For example:

    ./redo.py -F x86_64 -n 2012-05-07-15_28_24

will redo the failed sessions under the 2012-05-07-15_28_24 directory, but only for session names which contain 'x86_64' in it.

Modified:
    lldb/trunk/test/redo.py

Modified: lldb/trunk/test/redo.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/redo.py?rev=156335&r1=156334&r2=156335&view=diff
==============================================================================
--- lldb/trunk/test/redo.py (original)
+++ lldb/trunk/test/redo.py Mon May  7 17:59:00 2012
@@ -24,6 +24,10 @@
 # To be filled with the filterspecs found in the session logs.
 redo_specs = []
 
+# The filename components to match for.  Only files with the contained component names
+# will be considered for re-run.  Examples: ['X86_64', 'clang'].
+filename_components = []
+
 # There is a known bug with respect to comp_specs and arch_specs, in that if we
 # encountered "-C clang" and "-C gcc" when visiting the session files, both
 # compilers will end up in the invocation of the test driver when rerunning.
@@ -36,8 +40,10 @@
 
 def usage():
     print"""\
-Usage: redo.py [-n] [session_dir]
+Usage: redo.py [-F filename_component] [-n] [session_dir]
 where options:
+-F : only consider the test for re-run if the session filename conatins the filename component
+     for example: -F x86_64
 -n : when running the tests, do not turn on trace mode, i.e, no '-t' option
      is passed to the test driver (this will run the tests faster)
 
@@ -74,11 +80,15 @@
     global filter_pattern
     global comp_pattern
     global arch_pattern
+    global filename_components
 
     for name in names:
         if name.endswith(suffix):
             #print "Find a log file:", name
             if name.startswith("Error") or name.startswith("Failure"):
+                if filename_components:
+                    if not all([comp in name for comp in filename_components]):
+                        continue
                 with open(os.path.join(dir, name), 'r') as log:
                     content = log.read()
                     for line in content.splitlines():
@@ -100,15 +110,13 @@
     """Read the session directory and run the failed test cases one by one."""
     global no_trace
     global redo_specs
+    global filename_components
 
     test_dir = sys.path[0]
     if not test_dir.endswith('test'):
         print "This script expects to reside in lldb's test directory."
         sys.exit(-1)
 
-    if len(sys.argv) > 3:
-        usage()
-
     index = 1
     while index < len(sys.argv):
         if sys.argv[index].startswith('-h'):
@@ -121,7 +129,14 @@
             # End of option processing.
             break
 
-        if sys.argv[index] == '-n':
+        if sys.argv[index].startswith('-F'):
+            # Increment by 1 to fetch the filename component spec.
+            index += 1
+            if index >= len(sys.argv) or sys.argv[index].startswith('-'):
+                usage()
+            filename_components.append(sys.argv[index])
+            index += 1
+        elif sys.argv[index] == '-n':
             no_trace = True
             index += 1
 





More information about the lldb-commits mailing list