diff options
author | Enrico Granata <egranata@apple.com> | 2012-03-03 03:13:03 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2012-03-03 03:13:03 +0000 |
commit | 89fd064582b4d6b6f091b77d7f1bab10b13a0774 (patch) | |
tree | efa5f3b2da617bffdc6b612b8562b6a86917c380 | |
parent | 133e0fb3c639b8d7a4ed39fd8811c374fe249890 (diff) | |
download | bcm5719-llvm-89fd064582b4d6b6f091b77d7f1bab10b13a0774.tar.gz bcm5719-llvm-89fd064582b4d6b6f091b77d7f1bab10b13a0774.zip |
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
llvm-svn: 151966
5 files changed, 182 insertions, 25 deletions
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py b/lldb/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py index 6a8fba19267..936e5bdda6f 100644 --- a/lldb/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py +++ b/lldb/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py @@ -11,16 +11,12 @@ class PythonSynthDataFormatterTestCase(TestBase): 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 @@ class PythonSynthDataFormatterTestCase(TestBase): 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 @@ class PythonSynthDataFormatterTestCase(TestBase): 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 @@ class PythonSynthDataFormatterTestCase(TestBase): 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", diff --git a/lldb/test/functionalities/data-formatter/rdar-10887661/Makefile b/lldb/test/functionalities/data-formatter/rdar-10887661/Makefile new file mode 100644 index 00000000000..314f1cb2f07 --- /dev/null +++ b/lldb/test/functionalities/data-formatter/rdar-10887661/Makefile @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +CXX_SOURCES := main.cpp + +include $(LEVEL)/Makefile.rules diff --git a/lldb/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py b/lldb/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py new file mode 100644 index 00000000000..0e6d1289885 --- /dev/null +++ b/lldb/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py @@ -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() diff --git a/lldb/test/functionalities/data-formatter/rdar-10887661/fooSynthProvider.py b/lldb/test/functionalities/data-formatter/rdar-10887661/fooSynthProvider.py new file mode 100644 index 00000000000..fb95ac2b54d --- /dev/null +++ b/lldb/test/functionalities/data-formatter/rdar-10887661/fooSynthProvider.py @@ -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; diff --git a/lldb/test/functionalities/data-formatter/rdar-10887661/main.cpp b/lldb/test/functionalities/data-formatter/rdar-10887661/main.cpp new file mode 100644 index 00000000000..b921915b91c --- /dev/null +++ b/lldb/test/functionalities/data-formatter/rdar-10887661/main.cpp @@ -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 |