[Lldb-commits] [lldb] [lldb][test] Don't invoke attach in TestCommandScriptAlias.py (PR #232709)

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 16 05:07:55 PDT 2026


https://github.com/Teemperor created https://github.com/llvm/llvm-project/pull/232709

The TestCommandScriptAlias.py calls `attach noprocessexistswiththisname` which will time out when running the test suite against a remote device.

This patch rewrites the test so call `bt` instead and cleans up some of the related code.

>From 0f7fbf233fb4bfb8ec47f746a4600316f0f419a2 Mon Sep 17 00:00:00 2001
From: Raphael Isemann <rise at apple.com>
Date: Fri, 16 Oct 2026 12:39:55 +0100
Subject: [PATCH] [lldb][test] Don't invoke attach in TestCommandScriptAlias.py

The TestCommandScriptAlias.py calls `attach noprocessexistswiththisname`
which will time out when running the test suite against a remote device.

This patch rewrites the test so call `bt` instead and cleans up some of
the related code.
---
 .../script_alias/TestCommandScriptAlias.py      | 17 +++++++++--------
 .../{tcsacmd.py => custom_command.py}           |  4 ++--
 2 files changed, 11 insertions(+), 10 deletions(-)
 rename lldb/test/API/commands/command/script_alias/{tcsacmd.py => custom_command.py} (52%)

diff --git a/lldb/test/API/commands/command/script_alias/TestCommandScriptAlias.py b/lldb/test/API/commands/command/script_alias/TestCommandScriptAlias.py
index dd1d01e391f3e7..5be5064118e4c9 100644
--- a/lldb/test/API/commands/command/script_alias/TestCommandScriptAlias.py
+++ b/lldb/test/API/commands/command/script_alias/TestCommandScriptAlias.py
@@ -11,15 +11,14 @@
 class CommandScriptAliasTestCase(TestBase):
     NO_DEBUG_INFO_TESTCASE = True
 
-    @skipIf(remote=True, bugnumber="github.com/llvm/llvm-project/issues/232431")
     def test_pycmd(self):
-        self.runCmd("command script import tcsacmd.py")
-        self.runCmd("command script add -f tcsacmd.some_command_here attach")
+        self.runCmd("command script import custom_command.py")
+        self.runCmd("command script add -f custom_command.some_command_here bt")
 
         # This is the function to remove the custom commands in order to have a
         # clean slate for the next test case.
         def cleanup():
-            self.runCmd("command script delete attach", check=False)
+            self.runCmd("command script delete bt", check=False)
 
         # Execute the cleanup function during test case tear down.
         self.addTearDownHook(cleanup)
@@ -28,7 +27,9 @@ def cleanup():
         if not self.TraceOn():
             self.HideStdout()
 
-        self.expect("attach a", substrs=["Victory is mine"])
-        self.runCmd("command script delete attach")
-        # this can't crash but we don't care whether the actual attach works
-        self.runCmd("attach noprocessexistswiththisname", check=False)
+        self.expect("bt a", substrs=["Script command invoked"])
+        self.runCmd("command script delete bt")
+        # The built-in 'bt' must be invoked again now. The 'invalid target'
+        # output is only created by the builtin 'bt' command.
+        self.expect("bt", error=True, substrs=["invalid target"])
+        self.assertNotIn("Script command invoked", self.res.GetOutput())
diff --git a/lldb/test/API/commands/command/script_alias/tcsacmd.py b/lldb/test/API/commands/command/script_alias/custom_command.py
similarity index 52%
rename from lldb/test/API/commands/command/script_alias/tcsacmd.py
rename to lldb/test/API/commands/command/script_alias/custom_command.py
index 00d4dbc5585c94..0e74b52ed26f53 100644
--- a/lldb/test/API/commands/command/script_alias/tcsacmd.py
+++ b/lldb/test/API/commands/command/script_alias/custom_command.py
@@ -3,8 +3,8 @@
 
 def some_command_here(debugger, command, result, d):
     if command == "a":
-        print("Victory is mine", file=result)
+        print("Script command invoked", file=result)
         return True
     else:
-        print("Sadness for all", file=result)
+        print("Script command received unexpected arguments", file=result)
         return False



More information about the lldb-commits mailing list