[Lldb-commits] [lldb] r151966 - in /lldb/trunk/test/functionalities/data-formatter: data-formatter-python-synth/TestDataFormatterPythonSynth.py rdar-10887661/ rdar-10887661/Makefile rdar-10887661/TestRdar10887661.py rdar-10887661/fooSynthProvider.py rdar-10887661/main.cpp

Enrico Granata egranata at apple.com
Fri Mar 2 19:13:03 PST 2012


Author: enrico
Date: Fri Mar  2 21:13:03 2012
New Revision: 151966

URL: http://llvm.org/viewvc/llvm-project?rev=151966&view=rev
Log:
Currently TestDataFormatterPythonSynth is failing because of an issue with children capping. Splitting the test case in two so we better isolate the issue and also for better logical separation

Added:
    lldb/trunk/test/functionalities/data-formatter/rdar-10887661/
    lldb/trunk/test/functionalities/data-formatter/rdar-10887661/Makefile
    lldb/trunk/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py
    lldb/trunk/test/functionalities/data-formatter/rdar-10887661/fooSynthProvider.py
    lldb/trunk/test/functionalities/data-formatter/rdar-10887661/main.cpp
Modified:
    lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py

Modified: lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py?rev=151966&r1=151965&r2=151966&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py (original)
+++ lldb/trunk/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py Fri Mar  2 21:13:03 2012
@@ -11,16 +11,12 @@
 
     mydir = os.path.join("functionalities", "data-formatter", "data-formatter-python-synth")
 
-    # rdar://problem/10887661
-    @unittest2.expectedFailure
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     def test_with_dsym_and_run_command(self):
         """Test data formatter commands."""
         self.buildDsym()
         self.data_formatter_commands()
 
-    # rdar://problem/10887661
-    @unittest2.expectedFailure
     def test_with_dwarf_and_run_command(self):
         """Test data formatter commands."""
         self.buildDwarf()
@@ -55,7 +51,6 @@
             self.runCmd('type summary clear', check=False)
             self.runCmd('type filter clear', check=False)
             self.runCmd('type synth clear', check=False)
-            self.runCmd("settings set target.max-children-count 256", check=False)
 
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
@@ -92,12 +87,6 @@
         self.runCmd("type summary add --summary-string \"fake_a=${svar.fake_a}\" foo")
         self.expect('frame variable f00_1',
                     substrs = ['fake_a=16777216'])
-        #self.runCmd("type summary add --summary-string \"fake_a=${var.fake_a}\" foo")
-        #self.expect('frame variable f00_1',
-        #            substrs = ['fake_a=16777216'])
-        #self.runCmd("type summary add --summary-string \"fake_a=${var[1]}\" foo")
-        #self.expect('frame variable f00_1',
-        #            substrs = ['fake_a=16777216'])
         self.runCmd("type summary add --summary-string \"fake_a=${svar[1]}\" foo")
         self.expect('frame variable f00_1',
             substrs = ['fake_a=16777216'])
@@ -119,20 +108,6 @@
                     substrs = ['r = 33',
                                'fake_a = 16777217',
                                'a = 280']);
-        
-        # check that capping works for synthetic children as well
-        self.runCmd("settings set target.max-children-count 2", check=False)
-        
-        self.expect("frame variable f00_1",
-                    substrs = ['...',
-                               'fake_a = 16777217',
-                               'a = 280']);
-        
-        self.expect("frame variable f00_1", matching=False,
-                    substrs = ['r = 33']);
-
-        
-        self.runCmd("settings set target.max-children-count 256", check=False)
 
         # check that expanding a pointer does the right thing
         self.expect("frame variable -P 1 f00_ptr",

Added: lldb/trunk/test/functionalities/data-formatter/rdar-10887661/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/rdar-10887661/Makefile?rev=151966&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/rdar-10887661/Makefile (added)
+++ lldb/trunk/test/functionalities/data-formatter/rdar-10887661/Makefile Fri Mar  2 21:13:03 2012
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: lldb/trunk/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py?rev=151966&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py (added)
+++ lldb/trunk/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py Fri Mar  2 21:13:03 2012
@@ -0,0 +1,94 @@
+"""
+Check for an issue where capping does not work because the Target pointer appears to be changing behind our backs
+"""
+
+import os, time
+import unittest2
+import lldb
+from lldbtest import *
+
+class Rdar10887661TestCase(TestBase):
+
+    mydir = os.path.join("functionalities", "data-formatter", "rdar-10887661")
+
+    # rdar://problem/10887661
+    @unittest2.expectedFailure
+    @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+    def test_with_dsym_and_run_command(self):
+        """Check for an issue where capping does not work because the Target pointer appears to be changing behind our backs."""
+        self.buildDsym()
+        self.capping_test_commands()
+
+    # rdar://problem/10887661
+    @unittest2.expectedFailure
+    def test_with_dwarf_and_run_command(self):
+        """Check for an issue where capping does not work because the Target pointer appears to be changing behind our backs."""
+        self.buildDwarf()
+        self.capping_test_commands()
+
+    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 capping_test_commands(self):
+        """Check for an issue where capping does not work because the Target pointer appears to be changing behind our backs."""
+        self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+        self.expect("breakpoint set -f main.cpp -l %d" % self.line,
+                    BREAKPOINT_CREATED,
+            startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
+                        self.line)
+
+        self.runCmd("run", RUN_SUCCEEDED)
+
+        # The stop reason of the thread should be breakpoint.
+        self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+            substrs = ['stopped',
+                       'stop reason = breakpoint'])
+
+        # This is the function to remove the custom formats in order to have a
+        # clean slate for the next test case.
+        def cleanup():
+            self.runCmd('type format clear', check=False)
+            self.runCmd('type summary clear', check=False)
+            self.runCmd('type filter clear', check=False)
+            self.runCmd('type synth clear', check=False)
+            self.runCmd("settings set target.max-children-count 256", check=False)
+
+        # Execute the cleanup function during test case tear down.
+        self.addTearDownHook(cleanup)
+
+        # set up the synthetic children provider
+        self.runCmd("script from fooSynthProvider import *")
+        self.runCmd("type synth add -l fooSynthProvider foo")
+
+        # check that the synthetic children work, so we know we are doing the right thing
+        self.expect("frame variable f00_1",
+                    substrs = ['r = 33',
+                               'fake_a = 16777216',
+                               'a = 0']);
+
+        # check that capping works
+        self.runCmd("settings set target.max-children-count 2", check=False)
+        
+        self.expect("frame variable f00_1",
+                    substrs = ['...',
+                               'fake_a = 16777217',
+                               'a = 280']);
+        
+        self.expect("frame variable f00_1", matching=False,
+                    substrs = ['r = 33']);
+
+        
+        self.runCmd("settings set target.max-children-count 256", check=False)
+
+        self.expect("frame variable f00_1", matching=True,
+                    substrs = ['r = 33']);
+
+if __name__ == '__main__':
+    import atexit
+    lldb.SBDebugger.Initialize()
+    atexit.register(lambda: lldb.SBDebugger.Terminate())
+    unittest2.main()

Added: lldb/trunk/test/functionalities/data-formatter/rdar-10887661/fooSynthProvider.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/rdar-10887661/fooSynthProvider.py?rev=151966&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/rdar-10887661/fooSynthProvider.py (added)
+++ lldb/trunk/test/functionalities/data-formatter/rdar-10887661/fooSynthProvider.py Fri Mar  2 21:13:03 2012
@@ -0,0 +1,21 @@
+import lldb
+class fooSynthProvider:
+     def __init__(self, valobj, dict):
+         self.valobj = valobj;
+         self.int_type = valobj.GetType().GetBasicType(lldb.eBasicTypeInt)
+     def num_children(self):
+         return 3;
+     def get_child_at_index(self, index):
+         if index == 0:
+             child = self.valobj.GetChildMemberWithName('a');
+         if index == 1:
+             child = self.valobj.CreateChildAtOffset ('fake_a', 1, self.int_type);
+         if index == 2:
+             child = self.valobj.GetChildMemberWithName('r');
+         return child;
+     def get_child_index(self, name):
+         if name == 'a':
+             return 0;
+         if name == 'fake_a':
+             return 1;
+    	 return 2;

Added: lldb/trunk/test/functionalities/data-formatter/rdar-10887661/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/data-formatter/rdar-10887661/main.cpp?rev=151966&view=auto
==============================================================================
--- lldb/trunk/test/functionalities/data-formatter/rdar-10887661/main.cpp (added)
+++ lldb/trunk/test/functionalities/data-formatter/rdar-10887661/main.cpp Fri Mar  2 21:13:03 2012
@@ -0,0 +1,62 @@
+struct foo
+{
+    int a;
+    int b;
+    int c;
+    int d;
+    int e;
+    int f;
+    int g;
+    int h;
+    int i;
+    int j;
+    int k;
+    int l;
+    int m;
+    int n;
+    int o;
+    int p;
+    int q;
+    int r;
+    
+    foo(int X) :
+    a(X),
+    b(X+1),
+    c(X+3),
+    d(X+5),
+    e(X+7),
+    f(X+9),
+    g(X+11),
+    h(X+13),
+    i(X+15),
+    j(X+17),
+    k(X+19),
+    l(X+21),
+    m(X+23),
+    n(X+25),
+    o(X+27),
+    p(X+29),
+    q(X+31),
+    r(X+33) {}
+};
+
+struct wrapint
+{
+    int x;
+    wrapint(int X) : x(X) {}
+};
+
+int main()
+{
+    foo f00_1(0);
+    foo *f00_ptr = new foo(12);
+    
+    f00_1.a++; // Set break point at this line.
+    
+    wrapint test_cast('A' +
+               256*'B' +
+               256*256*'C'+
+               256*256*256*'D');
+    
+    return 0;
+}
\ No newline at end of file





More information about the lldb-commits mailing list