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    @skipIfNoSBHeaders
20    @skipIfHostIncompatibleWithRemote
21    @expectedFailureAll(
22        oslist=["windows"],
23        bugnumber="llvm.org/pr20282")
24    def test_multiple_targets(self):
25        env = {self.dylibPath: self.getLLDBLibraryEnvVal()}
26
27        self.driver_exe = self.getBuildArtifact("multi-target")
28        self.buildDriver('main.cpp', self.driver_exe)
29        self.addTearDownHook(lambda: os.remove(self.driver_exe))
30        self.signBinary(self.driver_exe)
31
32# check_call will raise a CalledProcessError if multi-process-driver doesn't return
33# exit code 0 to indicate success.  We can let this exception go - the test harness
34# will recognize it as a test failure.
35
36        if self.TraceOn():
37            print("Running test %s" % self.driver_exe)
38            check_call([self.driver_exe, self.driver_exe], env=env)
39        else:
40            with open(os.devnull, 'w') as fnull:
41                check_call([self.driver_exe, self.driver_exe],
42                           env=env, stdout=fnull, stderr=fnull)
43