================
@@ -0,0 +1,108 @@
+"""
+Test python scripted platform in lldb
+"""
+
+import os, shutil
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+from lldbsuite.test import lldbtest
+
+
+class ScriptedPlatformTestCase(TestBase):
+    NO_DEBUG_INFO_TESTCASE = True
+
+    @skipUnlessDarwin
+    def test_python_plugin_package(self):
+        """Test that the lldb python module has a `plugins.scripted_platform`
+        package."""
+        self.expect(
+            "script import lldb.plugins",
+            substrs=["ModuleNotFoundError"],
+            matching=False,
+        )
+
+        self.expect("script dir(lldb.plugins)", substrs=["scripted_platform"])
+
+        self.expect(
+            "script import lldb.plugins.scripted_platform",
+            substrs=["ModuleNotFoundError"],
+            matching=False,
+        )
+
+        self.expect(
+            "script dir(lldb.plugins.scripted_platform)", 
substrs=["ScriptedPlatform"]
+        )
+
+        self.expect(
+            "script from lldb.plugins.scripted_platform import 
ScriptedPlatform",
+            substrs=["ImportError"],
+            matching=False,
+        )
+
+        self.expect(
+            "script dir(ScriptedPlatform)",
+            substrs=[
+                "attach_to_process",
+                "kill_process",
+                "launch_process",
+                "list_processes",
+            ],
+        )
+
+    @skipUnlessDarwin
+    def test_list_processes(self):
+        """Test that we can load and select an lldb scripted platform using the
+        SBAPI, check its process ID, parent, name & triple.
+        """
+        os.environ["SKIP_SCRIPTED_PLATFORM_SELECT"] = "1"
+
+        def cleanup():
+            del os.environ["SKIP_SCRIPTED_PLATFORM_SELECT"]
+
+        self.addTearDownHook(cleanup)
----------------
labath wrote:

Is it important that the HandleCommand thingy happens in __lldb_init_module. 
Could we remove this environment business and move the call to the relevant 
test instead?

https://github.com/llvm/llvm-project/pull/99814
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to