[Lldb-commits] [lldb] r181497 - Changing the std::map test case to use source breakpoints instead of relying on the nexting always "getting it right" to stop at the locations of interest

Enrico Granata egranata at apple.com
Wed May 8 18:04:59 PDT 2013


Author: enrico
Date: Wed May  8 20:04:59 2013
New Revision: 181497

URL: http://llvm.org/viewvc/llvm-project?rev=181497&view=rev
Log:
Changing the std::map test case to use source breakpoints instead of relying on the nexting always "getting it right" to stop at the locations of interest
This should make us more robust in the face of changing compiler line tables and other library modifications


Modified:
    lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
    lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/main.cpp

Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py?rev=181497&r1=181496&r2=181497&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py Wed May  8 20:04:59 2013
@@ -29,14 +29,12 @@ class LibcxxMapDataFormatterTestCase(Tes
     def setUp(self):
         # Call super's setUp().
         TestBase.setUp(self)
-        # Find the line number to break at.
-        self.line = line_number('main.cpp', '// Set break point at this line.')
 
     def data_formatter_commands(self):
         """Test that that file and class static variables display correctly."""
         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
 
-        lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
+        lldbutil.run_break_set_by_source_regexp (self, "Set break point at this line.")
 
         self.runCmd("run", RUN_SUCCEEDED)
 
@@ -67,7 +65,7 @@ class LibcxxMapDataFormatterTestCase(Tes
             substrs = ['map has 0 items',
                        '{}'])
 
-        self.runCmd("n");self.runCmd("n");
+        self.runCmd("continue");
 
         self.expect('frame variable ii',
                     substrs = ['map has 2 items',
@@ -78,7 +76,7 @@ class LibcxxMapDataFormatterTestCase(Tes
                                'first = 1',
                                'second = 1'])
 
-        self.runCmd("n");self.runCmd("n");
+        self.runCmd("continue");
 
         self.expect('frame variable ii',
                     substrs = ['map has 4 items',
@@ -89,9 +87,7 @@ class LibcxxMapDataFormatterTestCase(Tes
                                'first = 3',
                                'second = 1'])
 
-        self.runCmd("n");self.runCmd("n");
-        self.runCmd("n");self.runCmd("n");
-        self.runCmd("frame select 0")
+        self.runCmd("continue");
 
         self.expect("frame variable ii",
                     substrs = ['map has 8 items',
@@ -130,7 +126,7 @@ class LibcxxMapDataFormatterTestCase(Tes
         #self.expect("expression ii[8]", matching=False, error=True,
         #            substrs = ['1234567'])
 
-        self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd('frame select 0')
+        self.runCmd("continue");
         
         self.expect('frame variable ii',
                     substrs = ['map has 0 items',
@@ -142,7 +138,7 @@ class LibcxxMapDataFormatterTestCase(Tes
                     substrs = ['map has 0 items',
                                '{}'])
 
-        self.runCmd("n");self.runCmd("n");self.runCmd('frame select 0')
+        self.runCmd("continue");
 
         self.expect('frame variable si',
                     substrs = ['map has 1 items',
@@ -150,9 +146,7 @@ class LibcxxMapDataFormatterTestCase(Tes
                                'first = \"zero\"',
                                'second = 0'])
 
-        self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n");
-        self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n")
-        self.runCmd("n");self.runCmd("n");self.runCmd('frame select 0')
+        self.runCmd("continue");
 
         self.expect("frame variable si",
                     substrs = ['map has 4 items',
@@ -200,20 +194,20 @@ class LibcxxMapDataFormatterTestCase(Tes
         #self.expect("expression si[0]", matching=False, error=True,
         #            substrs = ['first = ', 'zero'])
 
-        self.runCmd("n");self.runCmd("n");
+        self.runCmd("continue");
         
         self.expect('frame variable si',
                     substrs = ['map has 0 items',
                                '{}'])
 
-        self.runCmd("n")
+        self.runCmd("continue");
         self.runCmd("frame variable is --show-types")
         
         self.expect('frame variable is',
                     substrs = ['map has 0 items',
                                '{}'])
 
-        self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n");
+        self.runCmd("continue");
 
         self.expect("frame variable is",
                     substrs = ['map has 4 items',
@@ -261,21 +255,20 @@ class LibcxxMapDataFormatterTestCase(Tes
         #self.expect("expression is[0]", matching=False, error=True,
         #            substrs = ['first = ', 'goofy'])
 
-        self.runCmd("n")
+        self.runCmd("continue");
         
         self.expect('frame variable is',
                     substrs = ['map has 0 items',
                                '{}'])
 
-        self.runCmd("n");self.runCmd("n");
+        self.runCmd("continue");
         self.runCmd("frame variable ss --show-types")
         
         self.expect('frame variable ss',
                     substrs = ['map has 0 items',
                                '{}'])
 
-        self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n");
-        self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd('frame select 0')
+        self.runCmd("continue");
 
         self.expect("frame variable ss",
                     substrs = ['map has 3 items',
@@ -316,7 +309,7 @@ class LibcxxMapDataFormatterTestCase(Tes
         #self.expect("expression ss[3]", matching=False, error=True,
         #            substrs = ['gatto'])
 
-        self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd('frame select 0')
+        self.runCmd("continue");
         
         self.expect('frame variable ss',
                     substrs = ['map has 0 items',

Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/main.cpp?rev=181497&r1=181496&r2=181497&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/main.cpp (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/main.cpp Wed May  8 20:04:59 2013
@@ -10,6 +10,17 @@
 #define intstr_map std::map<int, std::string> 
 #define strstr_map std::map<std::string, std::string> 
 
+int g_the_foo = 0;
+
+int thefoo_rw(int arg = 1)
+{
+	if (arg < 0)
+		arg = 0;
+	if (!arg)
+		arg = 1;
+	g_the_foo += arg;
+	return g_the_foo;
+}
 
 int main()
 {
@@ -17,43 +28,54 @@ int main()
     
     ii[0] = 0; // Set break point at this line.
     ii[1] = 1;
+	thefoo_rw(1);  // Set break point at this line.
     ii[2] = 0;
     ii[3] = 1;
-    ii[4] = 0;
+	thefoo_rw(1);  // Set break point at this line.
+	ii[4] = 0;
     ii[5] = 1;
     ii[6] = 0;
     ii[7] = 1;
+    thefoo_rw(1);  // Set break point at this line.
     ii[85] = 1234567;
-    
+
     ii.clear();
     
     strint_map si;
-    
+    thefoo_rw(1);  // Set break point at this line.
+	
     si["zero"] = 0;
+	thefoo_rw(1);  // Set break point at this line.
     si["one"] = 1;
     si["two"] = 2;
     si["three"] = 3;
+	thefoo_rw(1);  // Set break point at this line.
     si["four"] = 4;
 
     si.clear();
-    
+    thefoo_rw(1);  // Set break point at this line.
+	
     intstr_map is;
-    
+    thefoo_rw(1);  // Set break point at this line.
     is[85] = "goofy";
     is[1] = "is";
     is[2] = "smart";
     is[3] = "!!!";
-    
+    thefoo_rw(1);  // Set break point at this line.
+	
     is.clear();
-    
+    thefoo_rw(1);  // Set break point at this line.
+	
     strstr_map ss;
-    
+    thefoo_rw(1);  // Set break point at this line.
+	
     ss["ciao"] = "hello";
     ss["casa"] = "house";
     ss["gatto"] = "cat";
+    thefoo_rw(1);  // Set break point at this line.
     ss["a Mac.."] = "..is always a Mac!";
     
     ss.clear();
-    
+    thefoo_rw(1);  // Set break point at this line.    
     return 0;
 }
\ No newline at end of file





More information about the lldb-commits mailing list