1"""Test the lldb public C++ api when creating multiple targets simultaneously."""
2
3from __future__ import print_function
4
5
6import os
7
8import lldb
9from lldbsuite.test.decorators import *
10from lldbsuite.test.lldbtest import *
11from lldbsuite.test import lldbutil
12
13
14class TestMultipleTargets(TestBase):
15
16    mydir = TestBase.compute_mydir(__file__)
17    NO_DEBUG_INFO_TESTCASE = True
18
19    @skipIf(oslist=["linux"], archs=["arm", "aarch64"])
20    @skipIfNoSBHeaders
21    @skipIfHostIncompatibleWithRemote
22    @expectedFailureAll(
23        oslist=["windows"],
24        bugnumber="llvm.org/pr20282")
25    @expectedFlakeyNetBSD
26    def test_multiple_targets(self):
27        env = {self.dylibPath: self.getLLDBLibraryEnvVal()}
28
29        self.driver_exe = self.getBuildArtifact("multi-target")
30        self.buildDriver('main.cpp', self.driver_exe)
31        self.addTearDownHook(lambda: os.remove(self.driver_exe))
32        self.signBinary(self.driver_exe)
33
34# check_call will raise a CalledProcessError if multi-process-driver doesn't return
35# exit code 0 to indicate success.  We can let this exception go - the test harness
36# will recognize it as a test failure.
37
38        if self.TraceOn():
39            print("Running test %s" % self.driver_exe)
40            check_call([self.driver_exe, self.driver_exe], env=env)
41        else:
42            with open(os.devnull, 'w') as fnull:
43                check_call([self.driver_exe, self.driver_exe],
44                           env=env, stdout=fnull, stderr=fnull)
45