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    NO_DEBUG_INFO_TESTCASE = True
16
17    @skipIf(oslist=["linux"], archs=["arm", "aarch64"])
18    @skipIfNoSBHeaders
19    @skipIfHostIncompatibleWithRemote
20    @expectedFailureAll(
21        oslist=["windows"], archs=["i[3-6]86", "x86_64"],
22        bugnumber="llvm.org/pr20282")
23    @expectedFlakeyNetBSD
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