Skip to content

[lldb] Fixed the test TestGdbRemoteLaunch #91931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 20 additions & 21 deletions lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ class GdbRemoteLaunchTestCase(gdbremote_testcase.GdbRemoteTestCaseBase):
@add_test_categories(["llgs"])
def test_launch_via_A(self):
self.build()
exe_path = self.getBuildArtifact("a.out")
args = [exe_path, "stderr:arg1", "stderr:arg2", "stderr:arg3"]
hex_args = [seven.hexlify(x) for x in args]

server = self.connect_to_debug_monitor()
self.assertIsNotNone(server)
self.do_handshake()
exe_path = lldbutil.install_to_target(self, self.getBuildArtifact("a.out"))
args = [exe_path, "stderr:arg1", "stderr:arg2", "stderr:arg3"]
hex_args = [seven.hexlify(x) for x in args]

# NB: strictly speaking we should use %x here but this packet
# is deprecated, so no point in changing lldb-server's expectations
self.test_sequence.add_log_lines(
Expand All @@ -38,13 +38,13 @@ def test_launch_via_A(self):
@add_test_categories(["llgs"])
def test_launch_via_vRun(self):
self.build()
exe_path = self.getBuildArtifact("a.out")
args = [exe_path, "stderr:arg1", "stderr:arg2", "stderr:arg3"]
hex_args = [seven.hexlify(x) for x in args]

server = self.connect_to_debug_monitor()
self.assertIsNotNone(server)
self.do_handshake()
exe_path = lldbutil.install_to_target(self, self.getBuildArtifact("a.out"))
args = [exe_path, "stderr:arg1", "stderr:arg2", "stderr:arg3"]
hex_args = [seven.hexlify(x) for x in args]

self.test_sequence.add_log_lines(
[
"read packet: $vRun;%s;%s;%s;%s#00" % tuple(hex_args),
Expand All @@ -60,12 +60,12 @@ def test_launch_via_vRun(self):
@add_test_categories(["llgs"])
def test_launch_via_vRun_no_args(self):
self.build()
exe_path = self.getBuildArtifact("a.out")
hex_path = seven.hexlify(exe_path)

server = self.connect_to_debug_monitor()
self.assertIsNotNone(server)
self.do_handshake()
exe_path = lldbutil.install_to_target(self, self.getBuildArtifact("a.out"))
hex_path = seven.hexlify(exe_path)

self.test_sequence.add_log_lines(
[
"read packet: $vRun;%s#00" % (hex_path,),
Expand All @@ -78,6 +78,7 @@ def test_launch_via_vRun_no_args(self):
self.expect_gdbremote_sequence()

@add_test_categories(["llgs"])
@skipIfRemote
def test_launch_failure_via_vRun(self):
self.build()
exe_path = self.getBuildArtifact("a.out")
Expand Down Expand Up @@ -110,14 +111,13 @@ def test_launch_failure_via_vRun(self):
@add_test_categories(["llgs"])
def test_QEnvironment(self):
self.build()
exe_path = self.getBuildArtifact("a.out")
env = {"FOO": "test", "BAR": "a=z"}
args = [exe_path, "print-env:FOO", "print-env:BAR"]
hex_args = [seven.hexlify(x) for x in args]

server = self.connect_to_debug_monitor()
self.assertIsNotNone(server)
self.do_handshake()
exe_path = lldbutil.install_to_target(self, self.getBuildArtifact("a.out"))
env = {"FOO": "test", "BAR": "a=z"}
args = [exe_path, "print-env:FOO", "print-env:BAR"]
hex_args = [seven.hexlify(x) for x in args]

for key, value in env.items():
self.test_sequence.add_log_lines(
Expand All @@ -143,14 +143,13 @@ def test_QEnvironment(self):
@add_test_categories(["llgs"])
def test_QEnvironmentHexEncoded(self):
self.build()
exe_path = self.getBuildArtifact("a.out")
env = {"FOO": "test", "BAR": "a=z", "BAZ": "a*}#z"}
args = [exe_path, "print-env:FOO", "print-env:BAR", "print-env:BAZ"]
hex_args = [seven.hexlify(x) for x in args]

server = self.connect_to_debug_monitor()
self.assertIsNotNone(server)
self.do_handshake()
exe_path = lldbutil.install_to_target(self, self.getBuildArtifact("a.out"))
env = {"FOO": "test", "BAR": "a=z", "BAZ": "a*}#z"}
args = [exe_path, "print-env:FOO", "print-env:BAR", "print-env:BAZ"]
hex_args = [seven.hexlify(x) for x in args]

for key, value in env.items():
hex_enc = seven.hexlify("%s=%s" % (key, value))
Expand Down
Loading