[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteLaunch (PR #91931)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/91931 Install `a.out` to the remote target (after handshake) if necessary and use the remote path to call `vRun`. >From cbc183bd78c26ca3777cc4a81797d57ab3fa945d Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Mon, 13 May 2024 11:26:03 +0400 Subject: [PATCH] [lldb] Fixed the test TestGdbRemoteLaunch Install `a.out` to the remote target (after handshake) if necessary and use the remote path to call vRun. --- .../tools/lldb-server/TestGdbRemoteLaunch.py | 56 --- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py index 78a4d326c12d1..530f5aa57ea48 100644 --- a/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py +++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py @@ -8,17 +8,32 @@ class GdbRemoteLaunchTestCase(gdbremote_testcase.GdbRemoteTestCaseBase): +def get_exe_path(self): +exe_path = self.getBuildArtifact("a.out") +if lldb.remote_platform: +remote_path = lldbutil.append_to_process_working_directory(self, "a.out") +err = lldb.remote_platform.Install( +lldb.SBFileSpec(exe_path, True), lldb.SBFileSpec(remote_path, False) +) +if err.Fail(): +raise Exception( +"remote_platform.Install('%s', '%s') failed: %s" +% (exe_path, remote_path, err) +) +exe_path = remote_path +return exe_path + @skipIfWindows # No pty support to test any inferior output @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 = self.get_exe_path() +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( @@ -38,13 +53,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 = self.get_exe_path() +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), @@ -60,12 +75,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 = self.get_exe_path() +hex_path = seven.hexlify(exe_path) + self.test_sequence.add_log_lines( [ "read packet: $vRun;%s#00" % (hex_path,), @@ -78,6 +93,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") @@ -110,14 +126,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 = self.get_exe_path() +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( @@ -143,14 +158,13 @@ def test_QEnvironment(self): @add_test_categories(["llgs"]) def test_QEnvironmentHexEncoded(self): self.build() -exe_path = self.getBuildArtifact("a.out")
[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteLaunch (PR #91931)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Dmitry Vasilyev (slydiman) Changes Install `a.out` to the remote target (after handshake) if necessary and use the remote path to call `vRun`. --- Full diff: https://github.com/llvm/llvm-project/pull/91931.diff 1 Files Affected: - (modified) lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py (+35-21) ``diff diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py index 78a4d326c12d1..530f5aa57ea48 100644 --- a/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py +++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py @@ -8,17 +8,32 @@ class GdbRemoteLaunchTestCase(gdbremote_testcase.GdbRemoteTestCaseBase): +def get_exe_path(self): +exe_path = self.getBuildArtifact("a.out") +if lldb.remote_platform: +remote_path = lldbutil.append_to_process_working_directory(self, "a.out") +err = lldb.remote_platform.Install( +lldb.SBFileSpec(exe_path, True), lldb.SBFileSpec(remote_path, False) +) +if err.Fail(): +raise Exception( +"remote_platform.Install('%s', '%s') failed: %s" +% (exe_path, remote_path, err) +) +exe_path = remote_path +return exe_path + @skipIfWindows # No pty support to test any inferior output @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 = self.get_exe_path() +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( @@ -38,13 +53,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 = self.get_exe_path() +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), @@ -60,12 +75,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 = self.get_exe_path() +hex_path = seven.hexlify(exe_path) + self.test_sequence.add_log_lines( [ "read packet: $vRun;%s#00" % (hex_path,), @@ -78,6 +93,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") @@ -110,14 +126,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 = self.get_exe_path() +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( @@ -143,14 +158,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_moni
[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteLaunch (PR #91931)
@@ -78,6 +93,7 @@ def test_launch_via_vRun_no_args(self): self.expect_gdbremote_sequence() @add_test_categories(["llgs"]) +@skipIfRemote DavidSpickett wrote: Why is only this test skipped? https://github.com/llvm/llvm-project/pull/91931 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteLaunch (PR #91931)
@@ -78,6 +93,7 @@ def test_launch_via_vRun_no_args(self): self.expect_gdbremote_sequence() @add_test_categories(["llgs"]) +@skipIfRemote DavidSpickett wrote: Ah, because we need to open the file while we attempt to run it, and doing that on the remote is difficult. We could run some shell command, but it'd be a different one per remote platform, and failing that, Python. Assuming the remote even has an OS. So yeah, skipIfRemote is logical here :) https://github.com/llvm/llvm-project/pull/91931 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteLaunch (PR #91931)
https://github.com/DavidSpickett approved this pull request. LGTM Surprised we haven't needed this before, but I didn't see any existing function for it. https://github.com/llvm/llvm-project/pull/91931 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteLaunch (PR #91931)
slydiman wrote: @DavidSpickett Please look at #91944. https://github.com/llvm/llvm-project/pull/91931 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteLaunch (PR #91931)
https://github.com/labath approved this pull request. https://github.com/llvm/llvm-project/pull/91931 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteLaunch (PR #91931)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/91931 >From 361cd689e3900c5ab542a5158807eb532879677e Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Mon, 13 May 2024 11:26:03 +0400 Subject: [PATCH] [lldb] Fixed the test TestGdbRemoteLaunch Install `a.out` to the remote target (after handshake) if necessary and use the remote path to call vRun. --- .../tools/lldb-server/TestGdbRemoteLaunch.py | 41 +-- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py index 78a4d326c12d1..ad84a40932c65 100644 --- a/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py +++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py @@ -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( @@ -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), @@ -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,), @@ -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") @@ -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( @@ -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, valu
[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteLaunch (PR #91931)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/91931 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits