summaryrefslogtreecommitdiff
path: root/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
diff options
context:
space:
mode:
authorMed Ismail Bennani <medismail.bennani@gmail.com>2021-02-19 00:36:05 +0000
committerMed Ismail Bennani <medismail.bennani@gmail.com>2021-03-01 21:13:32 +0100
commit2cff3dec1171188ce04ab1a4373cc1885ab97be1 (patch)
tree9d95733c162e01debd58f0011e9c160ef01ece3c /lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
parent182f0d1a34419445bb19d67581d6ac1afc98b7fa (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"])
+