[Lldb-commits] [lldb] r237454 - Improve the MiVarTestCase.test_lldbmi_var_list_children test (MI)

Ilia K ki.stfu at gmail.com
Fri May 15 09:13:51 PDT 2015


Author: ki.stfu
Date: Fri May 15 11:13:51 2015
New Revision: 237454

URL: http://llvm.org/viewvc/llvm-project?rev=237454&view=rev
Log:
Improve the MiVarTestCase.test_lldbmi_var_list_children test (MI)

Modified:
    lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py
    lldb/trunk/test/tools/lldb-mi/variable/main.cpp

Modified: lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py?rev=237454&r1=237453&r2=237454&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py (original)
+++ lldb/trunk/test/tools/lldb-mi/variable/TestMiVar.py Fri May 15 11:13:51 2015
@@ -239,8 +239,8 @@ class MiVarTestCase(lldbmi_testcase.MiTe
         self.runCmd("-file-exec-and-symbols %s" % self.myexe)
         self.expect("\^done")
 
-        # Run to BP_var_list_children
-        line = line_number('main.cpp', '// BP_var_list_children')
+        # Run to BP_var_list_children_test
+        line = line_number('main.cpp', '// BP_var_list_children_test')
         self.runCmd("-break-insert main.cpp:%d" % line)
         self.expect("\^done,bkpt={number=\"1\"")
         self.runCmd("-exec-run")
@@ -252,6 +252,8 @@ class MiVarTestCase(lldbmi_testcase.MiTe
         self.expect("\^done,name=\"var_complx\",numchild=\"3\",value=\"\{\.\.\.\}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
         self.runCmd("-var-create var_complx_array * complx_array")
         self.expect("\^done,name=\"var_complx_array\",numchild=\"2\",value=\"\[2\]\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
+        self.runCmd("-var-create var_pcomplx * pcomplx")
+        self.expect("\^done,name=\"var_pcomplx\",numchild=\"2\",value=\"\{\.\.\.\}\",type=\"pcomplex_type\",thread-id=\"1\",has_more=\"0\"")
 
         # Test that -var-list-children lists empty children if range is empty
         # (and that print-values is optional)
@@ -268,24 +270,38 @@ class MiVarTestCase(lldbmi_testcase.MiTe
         self.expect("\^done,numchild=\"3\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",value=\"3\",has_more=\"0\"\},child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\},child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",value=\"0x[0-9a-f]+\",has_more=\"0\"\}\],has_more=\"0\"")
         self.runCmd("-var-list-children --simple-values var_complx_array")
         self.expect("\^done,numchild=\"2\",children=\[child=\{name=\"var_complx_array\.\[0\]\",exp=\"\[0\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\},child=\{name=\"var_complx_array\.\[1\]\",exp=\"\[1\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
+        self.runCmd("-var-list-children 0 var_pcomplx")
+        self.expect("\^done,numchild=\"2\",children=\[child=\{name=\"var_pcomplx\.complex_type\",exp=\"complex_type\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\},child={name=\"var_pcomplx\.complx\",exp=\"complx\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
 
         # Test that -var-list-children lists children without values
         self.runCmd("-var-list-children 0 var_complx 0 1")
         self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
         self.runCmd("-var-list-children --no-values var_complx 0 1")
         self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
+        self.runCmd("-var-list-children --no-values var_complx_array 0 1")
+        self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx_array\.\[0\]\",exp=\"\[0\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
+        self.runCmd("-var-list-children --no-values var_pcomplx 0 1")
+        self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_pcomplx\.complex_type\",exp=\"complex_type\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
 
         # Test that -var-list-children lists children with all values
         self.runCmd("-var-list-children 1 var_complx 1 2")
         self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"1\"")
         self.runCmd("-var-list-children --all-values var_complx 1 2")
         self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"1\"")
+        self.runCmd("-var-list-children --all-values var_complx_array 1 2")
+        self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx_array\.\[1\]\",exp=\"\[1\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"0\"")
+        self.runCmd("-var-list-children --all-values var_pcomplx 1 2")
+        self.expect("\^done,numchild=\"1\",children=\[child={name=\"var_pcomplx\.complx\",exp=\"complx\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"0\"")
 
         # Test that -var-list-children lists children with simple values
         self.runCmd("-var-list-children 2 var_complx 2 4")
         self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
         self.runCmd("-var-list-children --simple-values var_complx 2 4")
         self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
+        self.runCmd("-var-list-children --simple-values var_complx_array 2 4")
+        self.expect("\^done,numchild=\"0\",has_more=\"0\"")
+        self.runCmd("-var-list-children --simple-values var_pcomplx 2 4")
+        self.expect("\^done,numchild=\"0\",has_more=\"0\"")
 
         # Test that an invalid from is handled
         # FIXME: -1 is treated as unsigned int

Modified: lldb/trunk/test/tools/lldb-mi/variable/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-mi/variable/main.cpp?rev=237454&r1=237453&r2=237454&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-mi/variable/main.cpp (original)
+++ lldb/trunk/test/tools/lldb-mi/variable/main.cpp Fri May 15 11:13:51 2015
@@ -16,6 +16,16 @@ struct complex_type
     complex_type *complex_ptr;
 };
 
+struct pcomplex_type : complex_type
+{
+    pcomplex_type(const complex_type &complx_base, const complex_type &complx_member)
+        : complex_type(complx_base), complx(complx_member) { }
+    complex_type complx;
+    static int si;
+};
+
+int pcomplex_type::si;
+
 void
 var_update_test(void)
 {
@@ -35,15 +45,15 @@ var_update_test(void)
 }
 
 void
-var_list_children(void)
+var_list_children_test(void)
 {
     complex_type complx = { 3, { 3L }, &complx };
     complex_type complx_array[2] = { { 4, { 4L }, &complx_array[1] }, { 5, { 5 }, &complx_array[0] } };
+    pcomplex_type pcomplx({ 6, { 6L }, &pcomplx}, { 7, { 7L }, &pcomplx});
 
-    // BP_var_list_children
+    // BP_var_list_children_test
 }
 
-
 void
 gdb_set_show_print_char_array_as_string_test(void)
 {
@@ -84,7 +94,7 @@ main(int argc, char const *argv[])
     int a = 10, b = 20;
     s_MyVar = a + b;
     var_update_test();
-    var_list_children();
+    var_list_children_test();
     gdb_set_show_print_char_array_as_string_test();
     gdb_set_show_print_expand_aggregates();
     gdb_set_show_print_aggregate_field_names();





More information about the lldb-commits mailing list