[lldb] Use the compiler from the SDK in simulator tests
authorJonas Devlieghere <jonas@devlieghere.com>
Wed, 21 Apr 2021 20:18:36 +0000 (13:18 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Wed, 21 Apr 2021 20:22:58 +0000 (13:22 -0700)
Use the clang compiler from the SDK to build the simulator test programs
to ensure we pick up the correct libc++.

lldb/packages/Python/lldbsuite/test/lldbutil.py
lldb/test/API/macosx/simulator/TestSimulatorPlatform.py
lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py

index 06a84c2..5fff372 100644 (file)
@@ -95,6 +95,11 @@ def get_xcode_sdk_root(sdk):
                                     ]).rstrip().decode('utf-8')
 
 
+def get_xcode_clang(sdk):
+    return subprocess.check_output(['xcrun', '-sdk', sdk, '-f', 'clang'
+                                    ]).rstrip().decode("utf-8")
+
+
 # ===================================================
 # Disassembly for an SBFunction or an SBSymbol object
 # ===================================================
index 8a68f8e..3deb377 100644 (file)
@@ -57,10 +57,12 @@ class TestSimulatorPlatformLaunching(TestBase):
             version_min = '-m{}-version-min={}'.format(os, vers)
 
         sdk_root = lldbutil.get_xcode_sdk_root(sdk)
+        clang = lldbutil.get_xcode_clang(sdk)
 
         self.build(
             dictionary={
                 'ARCH': arch,
+                'CC': clang,
                 'ARCH_CFLAGS': '-target {} {}'.format(triple, version_min),
                 'SDKROOT': sdk_root
             })
index dc5785f..0194234 100644 (file)
@@ -51,6 +51,7 @@ class TestAppleSimulatorOSType(gdbremote_testcase.GdbRemoteTestCaseBase):
         exe_name = 'test_simulator_platform_{}'.format(platform_name)
         sdkroot = lldbutil.get_xcode_sdk_root(sdk)
         vers = lldbutil.get_xcode_sdk_version(sdk)
+        clang = lldbutil.get_xcode_clang(sdk)
 
         # Older versions of watchOS (<7.0) only support i386
         if platform_name == 'watchos':
@@ -63,6 +64,7 @@ class TestAppleSimulatorOSType(gdbremote_testcase.GdbRemoteTestCaseBase):
         self.build(
             dictionary={
                 'EXE': exe_name,
+                'CC': clang,
                 'SDKROOT': sdkroot.strip(),
                 'ARCH': arch,
                 'ARCH_CFLAGS': '-target {} {}'.format(triple, version_min),