xref: /llvm-project/lldb/test/API/api/multiple-debuggers/TestMultipleDebuggers.py (revision 0b2550f8ab77a53f560f6a7a1b401c4803a36d48)
1"""Test the lldb public C++ api when doing multiple debug sessions simultaneously."""
2
3import os
4import subprocess
5
6import lldb
7from lldbsuite.test.decorators import *
8from lldbsuite.test.lldbtest import *
9from lldbsuite.test import lldbutil
10
11
12class TestMultipleSimultaneousDebuggers(TestBase):
13    NO_DEBUG_INFO_TESTCASE = True
14
15    # Sometimes times out on Linux, see https://github.com/llvm/llvm-project/issues/101162.
16    @skipIfLinux
17    @skipIfNoSBHeaders
18    @skipIfWindows
19    @skipIfHostIncompatibleWithTarget
20    def test_multiple_debuggers(self):
21        self.driver_exe = self.getBuildArtifact("multi-process-driver")
22        self.buildDriver(
23            "multi-process-driver.cpp",
24            self.driver_exe,
25            defines=[("LLDB_HOST_ARCH", lldbplatformutil.getArchitecture())],
26        )
27        self.addTearDownHook(lambda: os.remove(self.driver_exe))
28
29        self.inferior_exe = self.getBuildArtifact("testprog")
30        self.buildDriver("testprog.cpp", self.inferior_exe)
31        self.addTearDownHook(lambda: os.remove(self.inferior_exe))
32
33        # check_call will raise a CalledProcessError if the executable doesn't
34        # return exit code 0 to indicate success.  We can let this exception go
35        # - the test harness will recognize it as a test failure.
36        subprocess.check_call([self.driver_exe, self.inferior_exe])
37