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