[Lldb-commits] [lldb] 5d1c43f - [lldb] Use the compiler from the SDK in simulator tests

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 21 13:23:04 PDT 2021


Author: Jonas Devlieghere
Date: 2021-04-21T13:22:58-07:00
New Revision: 5d1c43f333c2327be61604dc90ea675f0d1e6913

URL: https://github.com/llvm/llvm-project/commit/5d1c43f333c2327be61604dc90ea675f0d1e6913
DIFF: https://github.com/llvm/llvm-project/commit/5d1c43f333c2327be61604dc90ea675f0d1e6913.diff

LOG: [lldb] Use the compiler from the SDK in simulator tests

Use the clang compiler from the SDK to build the simulator test programs
to ensure we pick up the correct libc++.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py
index 06a84c2554000..5fff3726a65e6 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -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
 # ===================================================

diff  --git a/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py b/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py
index 8a68f8e410968..3deb37742b18d 100644
--- a/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py
+++ b/lldb/test/API/macosx/simulator/TestSimulatorPlatform.py
@@ -57,10 +57,12 @@ def run_with(self, arch, os, vers, env, expected_load_command):
             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
             })

diff  --git a/lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py b/lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py
index dc5785fd49a9e..01942344e0e10 100644
--- a/lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py
+++ b/lldb/test/API/tools/lldb-server/TestAppleSimulatorOSType.py
@@ -51,6 +51,7 @@ def check_simulator_ostype(self, sdk, platform_name, arch=platform.machine()):
         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 @@ def check_simulator_ostype(self, sdk, platform_name, arch=platform.machine()):
         self.build(
             dictionary={
                 'EXE': exe_name,
+                'CC': clang,
                 'SDKROOT': sdkroot.strip(),
                 'ARCH': arch,
                 'ARCH_CFLAGS': '-target {} {}'.format(triple, version_min),


        


More information about the lldb-commits mailing list