summaryrefslogtreecommitdiff
path: root/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
diff options
context:
space:
mode:
authorMed Ismail Bennani <medismail.bennani@gmail.com>2021-03-23 16:22:26 +0000
committerMed Ismail Bennani <medismail.bennani@gmail.com>2021-03-23 18:24:47 +0100
commitf3176f5fede202985ab51d215f4d0a58b6c91d83 (patch)
tree1d7db5df37b9528b189951e6552ea94953025f3a /lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
parent1f6a57c1a0fad922e04a2b1f414b092d4b0cd8b0 (diff)
[lldb/bindings] Add Python ScriptedProcess base class to lldb module
In order to facilitate the writting of Scripted Processes, this patch introduces a `ScriptedProcess` python base class in the lldb module. The base class holds the python interface with all the - abstract - methods that need to be implemented by the inherited class but also some methods that can be overwritten. This patch also provides an example of a Scripted Process with the `MyScriptedProcess` class. rdar://65508855 Differential Revision: https://reviews.llvm.org/D95712 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Diffstat (limited to 'lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py')
-rw-r--r--lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
new file mode 100644
index 000000000000..a5da07027aaf
--- /dev/null
+++ b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
@@ -0,0 +1,45 @@
+"""
+Test python scripted process in lldb
+"""
+
+import os
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+from lldbsuite.test import lldbtest
+
+
+class PlatformProcessCrashInfoTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ TestBase.setUp(self)
+ self.source = "main.c"
+
+ def tearDown(self):
+ TestBase.tearDown(self)
+
+ def test_python_plugin_package(self):
+ """Test that the lldb python module has a `plugins.scripted_process`
+ package."""
+ self.expect('script import lldb.plugins',
+ substrs=["ModuleNotFoundError"], matching=False)
+
+ self.expect('script dir(lldb.plugins)',
+ substrs=["scripted_process"])
+
+ self.expect('script import lldb.plugins.scripted_process',
+ substrs=["ModuleNotFoundError"], matching=False)
+
+ self.expect('script dir(lldb.plugins.scripted_process)',
+ substrs=["ScriptedProcess"])
+
+ self.expect('script from lldb.plugins.scripted_process import ScriptedProcess',
+ substrs=["ImportError"], matching=False)
+
+ self.expect('script dir(ScriptedProcess)',
+ substrs=["launch"])
+