[lit][macOS] Add a utility function to find the platform SDK version

on macOS

This function will be used to tie Clang's Integeration tests to a particular
SDK version. See https://reviews.llvm.org/D32178 for more context.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304541 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Alex Lorenz 2017-06-02 11:21:37 +00:00
parent f4cc8004bc
commit c9c72aa1f6

View File

@ -267,6 +267,20 @@ def usePlatformSdkOnDarwin(config, lit_config):
lit_config.note('using SDKROOT: %r' % sdk_path)
config.environment['SDKROOT'] = sdk_path
def findPlatformSdkVersionOnMacOS(config, lit_config):
if 'darwin' in config.target_triple:
try:
cmd = subprocess.Popen(['xcrun', '--show-sdk-version', '--sdk', 'macosx'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = cmd.communicate()
out = out.strip()
res = cmd.wait()
except OSError:
res = -1
if res == 0 and out:
return out
return None
def killProcessAndChildren(pid):
"""
This function kills a process with ``pid`` and all its