forked from OSchip/llvm-project
[lldb/Test] Fix substrs order in self.expect for more tests (NFC)
Currently the substrs parameter takes a list of strings that need to be found but the ordering isn't checked. D73766 might change that so this changes a several tests so that the order of the strings in the substrs list is in the order in which they appear in the output.
This commit is contained in:
parent
8be30215fe
commit
81b0becaae
|
@ -38,7 +38,7 @@ class TestScriptedResolver(TestBase):
|
|||
"""Make sure we get appropriate errors when we give invalid key/value
|
||||
options"""
|
||||
self.build()
|
||||
self.do_test_bad_options()
|
||||
self.do_test_bad_options()
|
||||
|
||||
def make_target_and_import(self):
|
||||
target = lldbutil.run_to_breakpoint_make_target(self)
|
||||
|
@ -110,7 +110,7 @@ class TestScriptedResolver(TestBase):
|
|||
module_list.Clear()
|
||||
file_list.Append(lldb.SBFileSpec("noFileOfThisName.xxx"))
|
||||
wrong.append(target.BreakpointCreateFromScript("resolver.Resolver", extra_args, module_list, file_list))
|
||||
|
||||
|
||||
# Now make sure the CU level iteration obeys the file filters:
|
||||
file_list.Clear()
|
||||
module_list.Clear()
|
||||
|
@ -142,7 +142,7 @@ class TestScriptedResolver(TestBase):
|
|||
# Now run to main and ensure we hit the breakpoints we should have:
|
||||
|
||||
lldbutil.run_to_breakpoint_do_run(self, target, right[0])
|
||||
|
||||
|
||||
# Test the hit counts:
|
||||
for i in range(0, len(right)):
|
||||
self.assertEqual(right[i].GetHitCount(), 1, "Breakpoint %d has the wrong hit count"%(i))
|
||||
|
@ -167,12 +167,12 @@ class TestScriptedResolver(TestBase):
|
|||
bkpt = target.BreakpointCreateFromScript("resolver.Resolver", extra_args, module_list, file_list)
|
||||
self.assertTrue(bkpt.GetNumLocations() > 0, "Resolver got no locations.")
|
||||
self.expect("script print(resolver.Resolver.got_files)", substrs=["2"], msg="Was only passed modules")
|
||||
|
||||
|
||||
# Make a breakpoint that asks for modules, check that we didn't get any files:
|
||||
bkpt = target.BreakpointCreateFromScript("resolver.ResolverModuleDepth", extra_args, module_list, file_list)
|
||||
self.assertTrue(bkpt.GetNumLocations() > 0, "ResolverModuleDepth got no locations.")
|
||||
self.expect("script print(resolver.Resolver.got_files)", substrs=["2"], msg="Was only passed modules")
|
||||
|
||||
|
||||
# Make a breakpoint that asks for compile units, check that we didn't get any files:
|
||||
bkpt = target.BreakpointCreateFromScript("resolver.ResolverCUDepth", extra_args, module_list, file_list)
|
||||
self.assertTrue(bkpt.GetNumLocations() > 0, "ResolverCUDepth got no locations.")
|
||||
|
@ -187,7 +187,7 @@ class TestScriptedResolver(TestBase):
|
|||
bkpt = target.BreakpointCreateFromScript("resolver.ResolverFuncDepth", extra_args, module_list, file_list)
|
||||
self.assertTrue(bkpt.GetNumLocations() > 0, "ResolverFuncDepth got no locations.")
|
||||
self.expect("script print(resolver.Resolver.got_files)", substrs=["3"], msg="Was only passed modules")
|
||||
self.expect("script print(resolver.Resolver.func_list)", substrs=["break_on_me", "main", "test_func"], msg="Saw all the functions")
|
||||
self.expect("script print(resolver.Resolver.func_list)", substrs=['test_func', 'break_on_me', 'main'], msg="Saw all the functions")
|
||||
|
||||
def do_test_cli(self):
|
||||
target = self.make_target_and_import()
|
||||
|
@ -210,15 +210,15 @@ class TestScriptedResolver(TestBase):
|
|||
bp_se = bp_sc.GetLineEntry()
|
||||
self.assertEqual(bp_se.GetLine(), 12, "Got the right line number")
|
||||
self.assertEqual(bp_se.GetFileSpec().GetFilename(), "main.c", "Got the right filename")
|
||||
|
||||
|
||||
def do_test_bad_options(self):
|
||||
target = self.make_target_and_import()
|
||||
|
||||
self.expect("break set -P resolver.Resolver -k a_key", error = True, msg="Missing value at end",
|
||||
self.expect("break set -P resolver.Resolver -k a_key", error = True, msg="Missing value at end",
|
||||
substrs=['Key: "a_key" missing value'])
|
||||
self.expect("break set -P resolver.Resolver -v a_value", error = True, msg="Missing key at end",
|
||||
self.expect("break set -P resolver.Resolver -v a_value", error = True, msg="Missing key at end",
|
||||
substrs=['Value: "a_value" missing matching key'])
|
||||
self.expect("break set -P resolver.Resolver -v a_value -k a_key -v another_value", error = True, msg="Missing key among args",
|
||||
self.expect("break set -P resolver.Resolver -v a_value -k a_key -v another_value", error = True, msg="Missing key among args",
|
||||
substrs=['Value: "a_value" missing matching key'])
|
||||
self.expect("break set -P resolver.Resolver -k a_key -k a_key -v another_value", error = True, msg="Missing value among args",
|
||||
self.expect("break set -P resolver.Resolver -k a_key -k a_key -v another_value", error = True, msg="Missing value among args",
|
||||
substrs=['Key: "a_key" missing value'])
|
||||
|
|
|
@ -48,13 +48,14 @@ class CompactVectorsFormattingTestCase(TestBase):
|
|||
'frame variable',
|
||||
substrs=[
|
||||
'(vFloat) valueFL = (1.25, 0, 0.25, 0)',
|
||||
'(vDouble) valueDL = (1.25, 2.25)',
|
||||
'(int16_t [8]) valueI16 = (1, 0, 4, 0, 0, 1, 0, 4)',
|
||||
'(int32_t [4]) valueI32 = (1, 0, 4, 0)',
|
||||
'(vDouble) valueDL = (1.25, 2.25)',
|
||||
'(vUInt8) valueU8 = (0x01, 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)',
|
||||
'(vUInt16) valueU16 = (1, 0, 4, 0, 0, 1, 0, 4)',
|
||||
'(vUInt32) valueU32 = (1, 2, 3, 4)',
|
||||
"(vSInt8) valueS8 = (1, 0, 4, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0)",
|
||||
'(vSInt8) valueS8 = (1, 0, 4, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0)',
|
||||
'(vSInt16) valueS16 = (1, 0, 4, 0, 0, 1, 0, 4)',
|
||||
'(vSInt32) valueS32 = (4, 3, 2, 1)',
|
||||
'(vBool32) valueBool32 = (0, 1, 0, 1)'])
|
||||
'(vBool32) valueBool32 = (0, 1, 0, 1)',
|
||||
])
|
||||
|
|
|
@ -72,10 +72,13 @@ class PythonSynthDataFormatterTestCase(TestBase):
|
|||
fake_a_val = 0x00000100
|
||||
|
||||
# check that we get the two real vars and the fake_a variables
|
||||
self.expect("frame variable f00_1",
|
||||
substrs=['r = 34',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'a = 1'])
|
||||
self.expect(
|
||||
"frame variable f00_1",
|
||||
substrs=[
|
||||
'a = 1',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'r = 34',
|
||||
])
|
||||
|
||||
# check that we do not get the extra vars
|
||||
self.expect("frame variable f00_1", matching=False,
|
||||
|
@ -110,10 +113,13 @@ class PythonSynthDataFormatterTestCase(TestBase):
|
|||
else:
|
||||
fake_a_val = 0x00000200
|
||||
|
||||
self.expect("frame variable f00_1",
|
||||
substrs=['r = 34',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'a = 2'])
|
||||
self.expect(
|
||||
"frame variable f00_1",
|
||||
substrs=[
|
||||
'a = 2',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'r = 34',
|
||||
])
|
||||
|
||||
# check that altering the object also alters fake_a
|
||||
self.runCmd("expr f00_1.a = 280")
|
||||
|
@ -123,10 +129,13 @@ class PythonSynthDataFormatterTestCase(TestBase):
|
|||
else:
|
||||
fake_a_val = 0x00011800
|
||||
|
||||
self.expect("frame variable f00_1",
|
||||
substrs=['r = 34',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'a = 280'])
|
||||
self.expect(
|
||||
"frame variable f00_1",
|
||||
substrs=[
|
||||
'a = 280',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'r = 34',
|
||||
])
|
||||
|
||||
# check that expanding a pointer does the right thing
|
||||
if process.GetByteOrder() == lldb.eByteOrderLittle:
|
||||
|
@ -134,14 +143,20 @@ class PythonSynthDataFormatterTestCase(TestBase):
|
|||
else:
|
||||
fake_a_val = 0x00000c00
|
||||
|
||||
self.expect("frame variable --ptr-depth 1 f00_ptr",
|
||||
substrs=['r = 45',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'a = 12'])
|
||||
self.expect("frame variable --ptr-depth 1 wrapper",
|
||||
substrs=['r = 45',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'a = 12'])
|
||||
self.expect(
|
||||
"frame variable --ptr-depth 1 f00_ptr",
|
||||
substrs=[
|
||||
'a = 12',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'r = 45',
|
||||
])
|
||||
self.expect(
|
||||
"frame variable --ptr-depth 1 wrapper",
|
||||
substrs=[
|
||||
'a = 12',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'r = 45',
|
||||
])
|
||||
|
||||
# now add a filter.. it should fail
|
||||
self.expect("type filter add foo --child b --child j", error=True,
|
||||
|
@ -151,14 +166,20 @@ class PythonSynthDataFormatterTestCase(TestBase):
|
|||
self.expect('frame variable f00_1', matching=False,
|
||||
substrs=['b = 1',
|
||||
'j = 17'])
|
||||
self.expect("frame variable --ptr-depth 1 f00_ptr",
|
||||
substrs=['r = 45',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'a = 12'])
|
||||
self.expect("frame variable --ptr-depth 1 wrapper",
|
||||
substrs=['r = 45',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'a = 12'])
|
||||
self.expect(
|
||||
"frame variable --ptr-depth 1 f00_ptr",
|
||||
substrs=[
|
||||
'a = 12',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'r = 45',
|
||||
])
|
||||
self.expect(
|
||||
"frame variable --ptr-depth 1 wrapper",
|
||||
substrs=[
|
||||
'a = 12',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'r = 45',
|
||||
])
|
||||
|
||||
# Test that the custom dereference operator for `wrapfoo` works through
|
||||
# the Python API. The synthetic children provider gets queried at
|
||||
|
@ -207,14 +228,20 @@ class PythonSynthDataFormatterTestCase(TestBase):
|
|||
self.expect('frame variable f00_1', matching=False,
|
||||
substrs=['b = 2',
|
||||
'j = 18'])
|
||||
self.expect("frame variable --ptr-depth 1 f00_ptr",
|
||||
substrs=['r = 45',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'a = 12'])
|
||||
self.expect("frame variable --ptr-depth 1 wrapper",
|
||||
substrs=['r = 45',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'a = 12'])
|
||||
self.expect(
|
||||
"frame variable --ptr-depth 1 f00_ptr",
|
||||
substrs=[
|
||||
'a = 12',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'r = 45',
|
||||
])
|
||||
self.expect(
|
||||
"frame variable --ptr-depth 1 wrapper",
|
||||
substrs=[
|
||||
'a = 12',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'r = 45',
|
||||
])
|
||||
|
||||
# check the listing
|
||||
self.expect('type synth list',
|
||||
|
|
|
@ -56,13 +56,14 @@ class NSSetSyntheticTestCase(TestBase):
|
|||
substrs=[
|
||||
'4 elements',
|
||||
'[0]',
|
||||
'[1]',
|
||||
'[2]',
|
||||
'[3]',
|
||||
'hello',
|
||||
'world',
|
||||
'[1]',
|
||||
'(int)2',
|
||||
'[2]',
|
||||
'(int)1',
|
||||
'(int)2'])
|
||||
'[3]',
|
||||
'world',
|
||||
])
|
||||
self.expect(
|
||||
'frame variable mutable --ptr-depth 1 -d run -T',
|
||||
substrs=[
|
||||
|
@ -86,26 +87,27 @@ class NSSetSyntheticTestCase(TestBase):
|
|||
substrs=[
|
||||
'4 elements',
|
||||
'[0]',
|
||||
'[1]',
|
||||
'[2]',
|
||||
'[3]',
|
||||
'hello',
|
||||
'world',
|
||||
'(int)1',
|
||||
'(int)2'])
|
||||
'[1]',
|
||||
'(int)2',
|
||||
'[2]',
|
||||
'hello',
|
||||
'[3]',
|
||||
'world',
|
||||
])
|
||||
|
||||
self.runCmd("next")
|
||||
self.expect('frame variable mutable',
|
||||
substrs=['4 elements'])
|
||||
self.expect('frame variable mutable', substrs=['4 elements'])
|
||||
self.expect(
|
||||
'frame variable mutable --ptr-depth 1 -d run -T',
|
||||
substrs=[
|
||||
'4 elements',
|
||||
'[0]',
|
||||
'[1]',
|
||||
'[2]',
|
||||
'[3]',
|
||||
'hello',
|
||||
'world',
|
||||
'(int)1',
|
||||
'(int)2'])
|
||||
'[1]',
|
||||
'(int)2',
|
||||
'[2]',
|
||||
'hello',
|
||||
'[3]',
|
||||
'world',
|
||||
])
|
||||
|
|
|
@ -99,10 +99,11 @@ class PrintObjectArrayTestCase(TestBase):
|
|||
'expr --element-count 3 -d run --ptr-depth=1 -- objects',
|
||||
substrs=[
|
||||
'3 elements',
|
||||
'2 elements',
|
||||
'2 key/value pairs',
|
||||
'3735928559',
|
||||
'4276993775',
|
||||
'3203398366',
|
||||
'2 elements',
|
||||
'"Hello"',
|
||||
'"World"'])
|
||||
'"World"',
|
||||
'2 key/value pairs',
|
||||
])
|
||||
|
|
|
@ -63,18 +63,23 @@ class SyntheticCappingTestCase(TestBase):
|
|||
|
||||
# check that the synthetic children work, so we know we are doing the
|
||||
# right thing
|
||||
self.expect("frame variable f00_1",
|
||||
substrs=['r = 34',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'a = 1'])
|
||||
self.expect(
|
||||
"frame variable f00_1",
|
||||
substrs=[
|
||||
'a = 1',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'r = 34',
|
||||
])
|
||||
|
||||
# check that capping works
|
||||
self.runCmd("settings set target.max-children-count 2", check=False)
|
||||
|
||||
self.expect("frame variable f00_1",
|
||||
substrs=['...',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'a = 1'])
|
||||
substrs=[
|
||||
'a = 1',
|
||||
'fake_a = %d' % fake_a_val,
|
||||
'...',
|
||||
])
|
||||
|
||||
self.expect("frame variable f00_1", matching=False,
|
||||
substrs=['r = 34'])
|
||||
|
|
|
@ -78,10 +78,11 @@ class CrashingRecursiveInferiorTestCase(TestBase):
|
|||
"thread backtrace all",
|
||||
substrs=[
|
||||
stop_reason,
|
||||
'recursive_function',
|
||||
'main',
|
||||
'argc',
|
||||
'argv',
|
||||
'recursive_function'])
|
||||
])
|
||||
|
||||
# And it should report the correct line number.
|
||||
self.expect("thread backtrace all",
|
||||
|
@ -138,4 +139,3 @@ class CrashingRecursiveInferiorTestCase(TestBase):
|
|||
# of the inferior after a crash.
|
||||
self.expect("p i",
|
||||
startstr='(int) $0 =')
|
||||
|
||||
|
|
|
@ -46,7 +46,13 @@ class MTCSimpleTestCase(TestBase):
|
|||
|
||||
self.expect(
|
||||
"thread info -s",
|
||||
substrs=["instrumentation_class", "api_name", "class_name", "selector", "description"])
|
||||
substrs=[
|
||||
"api_name",
|
||||
"class_name",
|
||||
"description",
|
||||
"instrumentation_class",
|
||||
"selector"
|
||||
])
|
||||
self.assertEqual(thread.GetStopReason(), lldb.eStopReasonInstrumentation)
|
||||
output_lines = self.res.GetOutput().split('\n')
|
||||
json_line = '\n'.join(output_lines[2:])
|
||||
|
|
Loading…
Reference in New Issue