Skip to content

Commit 2c19d05

Browse files
committed
[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.
1 parent 84f0a86 commit 2c19d05

File tree

5 files changed

+38
-30
lines changed

5 files changed

+38
-30
lines changed

lldb/packages/Python/lldbsuite/test/commands/expression/issue_11588/Test11588.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ def cleanup():
6060
self.expect("expr --show-types -- *(StgClosure*)$r14",
6161
substrs=["(StgClosure) $",
6262
"(StgClosure *) &$", "0x",
63+
hex(addr)[2:].rstrip("L"),
6364
"addr = ",
65+
str(addr),
6466
"load_address = ",
65-
hex(addr)[2:].rstrip("L"),
6667
str(addr)])

lldb/packages/Python/lldbsuite/test/commands/frame/recognizer/TestFrameRecognizer.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ def test_frame_recognizer_1(self):
3434

3535
self.runCmd("frame recognizer add -l recognizer.MyOtherFrameRecognizer -s a.out -n bar -x")
3636

37-
self.expect("frame recognizer list",
38-
substrs=['0: recognizer.MyFrameRecognizer, module a.out, function foo',
39-
'1: recognizer.MyOtherFrameRecognizer, module a.out, function bar (regexp)'
40-
])
37+
self.expect(
38+
"frame recognizer list",
39+
substrs=[
40+
'1: recognizer.MyOtherFrameRecognizer, module a.out, function bar (regexp)',
41+
'0: recognizer.MyFrameRecognizer, module a.out, function foo'
42+
])
4143

4244
self.runCmd("frame recognizer delete 0")
4345

lldb/packages/Python/lldbsuite/test/commands/settings/TestSettings.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ def test_settings_with_trailing_whitespace(self):
485485

486486
def test_settings_list(self):
487487
# List settings (and optionally test the filter to only show 'target' settings).
488-
self.expect("settings list target", substrs=["language", "arg0", "detach-on-error"])
488+
self.expect("settings list target", substrs=["arg0", "detach-on-error", "language"])
489489
self.expect("settings list target", matching=False, substrs=["packet-timeout"])
490490
self.expect("settings list", substrs=["language", "arg0", "detach-on-error", "packet-timeout"])
491491

@@ -537,33 +537,34 @@ def test_all_settings_exist(self):
537537
"term-width",
538538
"thread-format",
539539
"use-external-editor",
540+
"target.breakpoints-use-platform-avoid-list",
540541
"target.default-arch",
541-
"target.move-to-nearest-code",
542-
"target.expr-prefix",
543-
"target.language",
544-
"target.prefer-dynamic-value",
542+
"target.disable-aslr",
543+
"target.disable-stdio",
544+
"target.x86-disassembly-flavor",
545545
"target.enable-synthetic-value",
546-
"target.skip-prologue",
547-
"target.source-map",
548-
"target.exec-search-paths",
549-
"target.max-children-count",
550-
"target.max-string-summary-length",
551-
"target.breakpoints-use-platform-avoid-list",
552-
"target.run-args",
553546
"target.env-vars",
547+
"target.error-path",
548+
"target.exec-search-paths",
549+
"target.expr-prefix",
550+
"target.hex-immediate-style",
554551
"target.inherit-env",
555552
"target.input-path",
553+
"target.language",
554+
"target.max-children-count",
555+
"target.max-string-summary-length",
556+
"target.move-to-nearest-code",
556557
"target.output-path",
557-
"target.error-path",
558-
"target.disable-aslr",
559-
"target.disable-stdio",
560-
"target.x86-disassembly-flavor",
558+
"target.prefer-dynamic-value",
559+
"target.run-args",
560+
"target.skip-prologue",
561+
"target.source-map",
561562
"target.use-hex-immediates",
562-
"target.hex-immediate-style",
563563
"target.process.disable-memory-cache",
564564
"target.process.extra-startup-command",
565+
"target.process.thread.trace-thread",
565566
"target.process.thread.step-avoid-regexp",
566-
"target.process.thread.trace-thread"])
567+
])
567568

568569
# settings under an ".experimental" domain should have two properties:
569570
# 1. If the name does not exist with "experimental" in the name path,

lldb/packages/Python/lldbsuite/test/commands/target/basic/TestTargetCommand.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ def do_target_command(self):
103103

104104
self.runCmd("target select %d" % (base + 2))
105105
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
106-
substrs=['c.c:%d' % self.line_c,
107-
'stop reason = breakpoint'])
106+
substrs=['stop reason = breakpoint' ,'c.c:%d' % self.line_c
107+
])
108108

109109
self.runCmd("target select %d" % (base + 1))
110110
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
111-
substrs=['b.c:%d' % self.line_b,
112-
'stop reason = breakpoint'])
111+
substrs=['stop reason = breakpoint', 'b.c:%d' % self.line_b
112+
])
113113

114114
self.runCmd("target list")
115115

@@ -246,9 +246,10 @@ def do_target_variable_command_no_fail(self, exe_name):
246246
# compile unit.
247247
self.expect("target variable",
248248
substrs=['my_global_char',
249+
'my_static_int',
249250
'my_global_str',
250251
'my_global_str_ptr',
251-
'my_static_int'])
252+
])
252253

253254
self.expect(
254255
"target variable my_global_str",

lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,13 @@ def break_multi_thread(self, removal_type, check_hw_bp=True):
9393

9494
# We should be stopped in hw_break_function
9595
# The stop reason of the thread should be breakpoint.
96-
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
96+
self.expect(
97+
"thread list",
98+
STOPPED_DUE_TO_BREAKPOINT,
9799
substrs=[
100+
'hw_break_function',
98101
'stop reason = breakpoint',
99-
'hw_break_function'])
102+
])
100103

101104
# Continue the loop and test that we are stopped 4 times.
102105
count += 1

0 commit comments

Comments
 (0)