summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/functionalities/command_script
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/command_script')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py11
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/command_script/decorated.py35
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/command_script/py_import1
3 files changed, 45 insertions, 2 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py
index 103189e9dd5..1698c0d0c35 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/TestCommandScript.py
@@ -49,6 +49,7 @@ class CmdPythonTestCase(TestBase):
self.runCmd('command script delete tell_curr', check=False)
self.runCmd('command script delete bug11569', check=False)
self.runCmd('command script delete takes_exe_ctx', check=False)
+ self.runCmd('command script delete decorated', check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
@@ -67,13 +68,19 @@ class CmdPythonTestCase(TestBase):
substrs=['Just a docstring for welcome_impl',
'A command that says hello to LLDB users'])
+ decorated_commands = ["decorated" + str(n) for n in range(1, 5)]
+ for name in decorated_commands:
+ self.expect(name, substrs=["hello from " + name])
+ self.expect("help " + name,
+ substrs=["Python command defined by @lldb.command"])
+
self.expect("help",
substrs=['For more information run',
- 'welcome'])
+ 'welcome'] + decorated_commands)
self.expect("help -a",
substrs=['For more information run',
- 'welcome'])
+ 'welcome'] + decorated_commands)
self.expect("help -u", matching=False,
substrs=['For more information run'])
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/decorated.py b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/decorated.py
new file mode 100644
index 00000000000..f9707a5706a
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/decorated.py
@@ -0,0 +1,35 @@
+from __future__ import print_function
+
+import lldb
+
+
+@lldb.command()
+def decorated1(debugger, args, exe_ctx, result, dict):
+ """
+ Python command defined by @lldb.command
+ """
+ print("hello from decorated1", file=result)
+
+
+@lldb.command(doc="Python command defined by @lldb.command")
+def decorated2(debugger, args, exe_ctx, result, dict):
+ """
+ This docstring is overridden.
+ """
+ print("hello from decorated2", file=result)
+
+
+@lldb.command()
+def decorated3(debugger, args, result, dict):
+ """
+ Python command defined by @lldb.command
+ """
+ print("hello from decorated3", file=result)
+
+
+@lldb.command("decorated4")
+def _decorated4(debugger, args, exe_ctx, result, dict):
+ """
+ Python command defined by @lldb.command
+ """
+ print("hello from decorated4", file=result)
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/py_import b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/py_import
index 169daacc1a8..6c1f7b8185f 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/command_script/py_import
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/command_script/py_import
@@ -10,3 +10,4 @@ command script add tell_sync --function welcome.check_for_synchro --synchronicit
command script add tell_async --function welcome.check_for_synchro --synchronicity async
command script add tell_curr --function welcome.check_for_synchro --synchronicity curr
command script add takes_exe_ctx --function welcome.takes_exe_ctx
+command script import decorated.py
OpenPOWER on IntegriCloud