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