Skip to content

Commit

Permalink
[lldb/Test] Fix substrs order in self.expect for more tests (NFC)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
JDevlieghere committed Jan 31, 2020
1 parent 84f0a86 commit 2c19d05
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 30 deletions.
Expand Up @@ -60,7 +60,8 @@ def cleanup():
self.expect("expr --show-types -- *(StgClosure*)$r14",
substrs=["(StgClosure) $",
"(StgClosure *) &$", "0x",
hex(addr)[2:].rstrip("L"),
"addr = ",
str(addr),
"load_address = ",
hex(addr)[2:].rstrip("L"),
str(addr)])
Expand Up @@ -34,10 +34,12 @@ def test_frame_recognizer_1(self):

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

self.expect("frame recognizer list",
substrs=['0: recognizer.MyFrameRecognizer, module a.out, function foo',
'1: recognizer.MyOtherFrameRecognizer, module a.out, function bar (regexp)'
])
self.expect(
"frame recognizer list",
substrs=[
'1: recognizer.MyOtherFrameRecognizer, module a.out, function bar (regexp)',
'0: recognizer.MyFrameRecognizer, module a.out, function foo'
])

self.runCmd("frame recognizer delete 0")

Expand Down
Expand Up @@ -485,7 +485,7 @@ def test_settings_with_trailing_whitespace(self):

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

Expand Down Expand Up @@ -537,33 +537,34 @@ def test_all_settings_exist(self):
"term-width",
"thread-format",
"use-external-editor",
"target.breakpoints-use-platform-avoid-list",
"target.default-arch",
"target.move-to-nearest-code",
"target.expr-prefix",
"target.language",
"target.prefer-dynamic-value",
"target.disable-aslr",
"target.disable-stdio",
"target.x86-disassembly-flavor",
"target.enable-synthetic-value",
"target.skip-prologue",
"target.source-map",
"target.exec-search-paths",
"target.max-children-count",
"target.max-string-summary-length",
"target.breakpoints-use-platform-avoid-list",
"target.run-args",
"target.env-vars",
"target.error-path",
"target.exec-search-paths",
"target.expr-prefix",
"target.hex-immediate-style",
"target.inherit-env",
"target.input-path",
"target.language",
"target.max-children-count",
"target.max-string-summary-length",
"target.move-to-nearest-code",
"target.output-path",
"target.error-path",
"target.disable-aslr",
"target.disable-stdio",
"target.x86-disassembly-flavor",
"target.prefer-dynamic-value",
"target.run-args",
"target.skip-prologue",
"target.source-map",
"target.use-hex-immediates",
"target.hex-immediate-style",
"target.process.disable-memory-cache",
"target.process.extra-startup-command",
"target.process.thread.trace-thread",
"target.process.thread.step-avoid-regexp",
"target.process.thread.trace-thread"])
])

# settings under an ".experimental" domain should have two properties:
# 1. If the name does not exist with "experimental" in the name path,
Expand Down
Expand Up @@ -103,13 +103,13 @@ def do_target_command(self):

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

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

self.runCmd("target list")

Expand Down Expand Up @@ -246,9 +246,10 @@ def do_target_variable_command_no_fail(self, exe_name):
# compile unit.
self.expect("target variable",
substrs=['my_global_char',
'my_static_int',
'my_global_str',
'my_global_str_ptr',
'my_static_int'])
])

self.expect(
"target variable my_global_str",
Expand Down
Expand Up @@ -93,10 +93,13 @@ def break_multi_thread(self, removal_type, check_hw_bp=True):

# We should be stopped in hw_break_function
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
self.expect(
"thread list",
STOPPED_DUE_TO_BREAKPOINT,
substrs=[
'hw_break_function',
'stop reason = breakpoint',
'hw_break_function'])
])

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

0 comments on commit 2c19d05

Please sign in to comment.