Made multi-line test case actions possible in
authorSean Callanan <scallanan@apple.com>
Fri, 17 Oct 2014 00:39:37 +0000 (00:39 +0000)
committerSean Callanan <scallanan@apple.com>
Fri, 17 Oct 2014 00:39:37 +0000 (00:39 +0000)
the inline test cases.  This makes them much
more readable.

llvm-svn: 220001

lldb/test/lang/c/struct_types/main.c
lldb/test/lldbinline.py

index a4051a0..1ea1ba9 100644 (file)
@@ -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'])
 }
index ad397b5..d832bde 100644 (file)
@@ -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: