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

Filipe Cabecinhas me at filcab.net
Wed May 9 12:02:19 PDT 2012


Author: filcab
Date: Wed May  9 14:02:19 2012
New Revision: 156504

URL: http://llvm.org/viewvc/llvm-project?rev=156504&view=rev
Log:
Make redo.py more error-proof

Deal with being passed no parameters
Remove the infinite loop when it's passed something like --help

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=156504&r1=156503&r2=156504&view=diff
==============================================================================
--- lldb/trunk/test/redo.py (original)
+++ lldb/trunk/test/redo.py Wed May  9 14:02:19 2012
@@ -117,6 +117,9 @@
         print "This script expects to reside in lldb's test directory."
         sys.exit(-1)
 
+    if not len(sys.argv) > 1:
+        usage()
+
     index = 1
     while index < len(sys.argv):
         if sys.argv[index].startswith('-h'):
@@ -135,10 +138,10 @@
             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
+
+        index += 1
 
     if index < len(sys.argv):
         # Get the specified session directory.
@@ -147,6 +150,9 @@
         # Use heuristic to find the latest session directory.
         name = datetime.datetime.now().strftime("%Y-%m-%d-")
         dirs = [d for d in os.listdir(os.getcwd()) if d.startswith(name)]
+        if len(dirs) == 0:
+            print "No default session directory found, please specify it explicitly."
+            usage()
         session_dir = max(dirs, key=os.path.getmtime)
         if not session_dir or not os.path.exists(session_dir):
             print "No default session directory found, please specify it explicitly."





More information about the lldb-commits mailing list