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),