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
This commit is contained in:
parent
133e0fb3c6
commit
89fd064582
|
@ -11,16 +11,12 @@ class PythonSynthDataFormatterTestCase(TestBase):
|
||||||
|
|
||||||
mydir = os.path.join("functionalities", "data-formatter", "data-formatter-python-synth")
|
mydir = os.path.join("functionalities", "data-formatter", "data-formatter-python-synth")
|
||||||
|
|
||||||
# rdar://problem/10887661
|
|
||||||
@unittest2.expectedFailure
|
|
||||||
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
|
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
|
||||||
def test_with_dsym_and_run_command(self):
|
def test_with_dsym_and_run_command(self):
|
||||||
"""Test data formatter commands."""
|
"""Test data formatter commands."""
|
||||||
self.buildDsym()
|
self.buildDsym()
|
||||||
self.data_formatter_commands()
|
self.data_formatter_commands()
|
||||||
|
|
||||||
# rdar://problem/10887661
|
|
||||||
@unittest2.expectedFailure
|
|
||||||
def test_with_dwarf_and_run_command(self):
|
def test_with_dwarf_and_run_command(self):
|
||||||
"""Test data formatter commands."""
|
"""Test data formatter commands."""
|
||||||
self.buildDwarf()
|
self.buildDwarf()
|
||||||
|
@ -55,7 +51,6 @@ class PythonSynthDataFormatterTestCase(TestBase):
|
||||||
self.runCmd('type summary clear', check=False)
|
self.runCmd('type summary clear', check=False)
|
||||||
self.runCmd('type filter clear', check=False)
|
self.runCmd('type filter clear', check=False)
|
||||||
self.runCmd('type synth 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.
|
# Execute the cleanup function during test case tear down.
|
||||||
self.addTearDownHook(cleanup)
|
self.addTearDownHook(cleanup)
|
||||||
|
@ -92,12 +87,6 @@ class PythonSynthDataFormatterTestCase(TestBase):
|
||||||
self.runCmd("type summary add --summary-string \"fake_a=${svar.fake_a}\" foo")
|
self.runCmd("type summary add --summary-string \"fake_a=${svar.fake_a}\" foo")
|
||||||
self.expect('frame variable f00_1',
|
self.expect('frame variable f00_1',
|
||||||
substrs = ['fake_a=16777216'])
|
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.runCmd("type summary add --summary-string \"fake_a=${svar[1]}\" foo")
|
||||||
self.expect('frame variable f00_1',
|
self.expect('frame variable f00_1',
|
||||||
substrs = ['fake_a=16777216'])
|
substrs = ['fake_a=16777216'])
|
||||||
|
@ -120,20 +109,6 @@ class PythonSynthDataFormatterTestCase(TestBase):
|
||||||
'fake_a = 16777217',
|
'fake_a = 16777217',
|
||||||
'a = 280']);
|
'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
|
# check that expanding a pointer does the right thing
|
||||||
self.expect("frame variable -P 1 f00_ptr",
|
self.expect("frame variable -P 1 f00_ptr",
|
||||||
substrs = ['r = 45',
|
substrs = ['r = 45',
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
LEVEL = ../../../make
|
||||||
|
|
||||||
|
CXX_SOURCES := main.cpp
|
||||||
|
|
||||||
|
include $(LEVEL)/Makefile.rules
|
|
@ -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()
|
|
@ -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;
|
|
@ -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;
|
||||||
|
}
|
Loading…
Reference in New Issue