xref: /llvm-project/lldb/test/API/api/multiple-debuggers/TestMultipleDebuggers.py (revision aa07282a25c3d6df04af9a4d34874cc433c9c68a)
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    @skipIfNoSBHeaders
17    @skipIfWindows
18    @skipIfHostIncompatibleWithTarget
19    def test_multiple_debuggers(self):
20        self.driver_exe = self.getBuildArtifact("multi-process-driver")
21        self.buildDriver(
22            "multi-process-driver.cpp",
23            self.driver_exe,
24            defines=[("LLDB_HOST_ARCH", lldbplatformutil.getArchitecture())],
25        )
26        self.addTearDownHook(lambda: os.remove(self.driver_exe))
27
28        self.inferior_exe = self.getBuildArtifact("testprog")
29        self.buildDriver("testprog.cpp", self.inferior_exe)
30        self.addTearDownHook(lambda: os.remove(self.inferior_exe))
31
32        # check_call will raise a CalledProcessError if the executable doesn't
33        # return exit code 0 to indicate success.  We can let this exception go
34        # - the test harness will recognize it as a test failure.
35        subprocess.check_call([self.driver_exe, self.inferior_exe])
36