[Lldb-commits] [lldb] r220001 - Made multi-line test case actions possible in

Sean Callanan scallanan at apple.com
Thu Oct 16 17:39:38 PDT 2014


Author: spyffe
Date: Thu Oct 16 19:39:37 2014
New Revision: 220001

URL: http://llvm.org/viewvc/llvm-project?rev=220001&view=rev
Log:
Made multi-line test case actions possible in
the inline test cases.  This makes them much
more readable.

Modified:
    lldb/trunk/test/lang/c/struct_types/main.c
    lldb/trunk/test/lldbinline.py

Modified: lldb/trunk/test/lang/c/struct_types/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/struct_types/main.c?rev=220001&r1=220000&r2=220001&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/struct_types/main.c (original)
+++ lldb/trunk/test/lang/c/struct_types/main.c Thu Oct 16 19:39:37 2014
@@ -12,13 +12,16 @@ int main (int argc, char const *argv[])
         int x;
         int y;
         char padding[0];
-    }; //% self.expect("frame variable pt.padding[0]", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["pt.padding[0] = "]); self.expect("frame variable pt.padding[1]", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["pt.padding[1] = "]); self.expect("expression -- (pt.padding[0])", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["(char)", " = "]); self.expect("image lookup -t point_tag", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ['padding[]']) # Once rdar://problem/12566646 is fixed, this should display correctly
+    }; //% self.expect("frame variable pt.padding[0]", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["pt.padding[0] = "])
+       //% self.expect("frame variable pt.padding[1]", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["pt.padding[1] = "])
+       //% self.expect("expression -- (pt.padding[0])", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["(char)", " = "])
+       //% self.expect("image lookup -t point_tag", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ['padding[]']) # Once rdar://problem/12566646 is fixed, this should display correctly
 
     struct rect_tag {
         struct point_tag bottom_left;
         struct point_tag top_right;
     };
-    struct point_tag pt = { 2, 3, {} }; //% self.
+    struct point_tag pt = { 2, 3, {} };
     struct rect_tag rect = {{1, 2, {}}, {3, 4, {}}};
     return 0; //% self.expect("expression -- &pt == (struct point_tag*)0", substrs = ['false'])
 }

Modified: lldb/trunk/test/lldbinline.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbinline.py?rev=220001&r1=220000&r2=220001&view=diff
==============================================================================
--- lldb/trunk/test/lldbinline.py (original)
+++ lldb/trunk/test/lldbinline.py Thu Oct 16 19:39:37 2014
@@ -21,25 +21,39 @@ class CommandParser:
 
     def parse_one_command(self, line):
         parts = line.split('//%')
-        if len(parts) != 2:
-            return None
-        else:
-            return parts[1].strip() # take off trailing whitespace
+
+        command = None
+        new_breakpoint = True
+
+        if len(parts) == 2:
+            command = parts[1].strip() # take off whitespace
+            new_breakpoint = parts[0].strip() != ""
+
+        return (command, new_breakpoint)
 
     def parse_source_files(self, source_files):
         for source_file in source_files:
             file_handle = open(source_file)
             lines = file_handle.readlines()
             line_number = 0
+            current_breakpoint = None # non-NULL means we're looking through whitespace to find additional commands
             for line in lines:
                 line_number = line_number + 1 # 1-based, so we do this first
-                command = self.parse_one_command(line)
+                (command, new_breakpoint) = self.parse_one_command(line)
+
+                if new_breakpoint:
+                    current_breakpoint = None
+
                 if command != None:
-                    breakpoint = {}
-                    breakpoint['file_name'] = source_file
-                    breakpoint['line_number'] = line_number
-                    breakpoint['command'] = command
-                    self.breakpoints.append(breakpoint)
+                    if current_breakpoint == None:
+                        current_breakpoint = {}
+                        current_breakpoint['file_name'] = source_file
+                        current_breakpoint['line_number'] = line_number
+                        current_breakpoint['command'] = command
+                        self.breakpoints.append(current_breakpoint)
+                    else:
+                        current_breakpoint['command'] = current_breakpoint['command'] + "\n" + command
+        print self.breakpoints
 
     def set_breakpoints(self, target):
         for breakpoint in self.breakpoints:





More information about the lldb-commits mailing list