diff options
author | Alex Lorenz <arphaman@gmail.com> | 2017-06-02 11:21:37 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2017-06-02 11:21:37 +0000 |
commit | 9e390139419ace6e2fc8ae1ea0c97f047917011c (patch) | |
tree | 4619959c1deeb433ba4a12de88b53b2c8365a849 | |
parent | 19092d783c9660c95ac5d532fcb2f45fb131731e (diff) | |
download | bcm5719-llvm-9e390139419ace6e2fc8ae1ea0c97f047917011c.tar.gz bcm5719-llvm-9e390139419ace6e2fc8ae1ea0c97f047917011c.zip |
[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.
llvm-svn: 304541
-rw-r--r-- | llvm/utils/lit/lit/util.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/utils/lit/lit/util.py b/llvm/utils/lit/lit/util.py index 104e9dac464..8991588a868 100644 --- a/llvm/utils/lit/lit/util.py +++ b/llvm/utils/lit/lit/util.py @@ -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 |