summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2014-06-10 14:22:00 +0000
committerAlexander Potapenko <glider@google.com>2014-06-10 14:22:00 +0000
commit22471f57311cbee978dd68c7e1b5915f0d86778e (patch)
tree612a362679282eda4443e9488c26b062540e4979 /utils
parent45a31492d5475a1744966a0cd5e631694b29f953 (diff)
downloadllvm-22471f57311cbee978dd68c7e1b5915f0d86778e.tar.gz
llvm-22471f57311cbee978dd68c7e1b5915f0d86778e.tar.bz2
llvm-22471f57311cbee978dd68c7e1b5915f0d86778e.tar.xz
Add detection of OS X relocatable SDK to compiler-rt as a lit.util function
Clang's lit cfg already detects the currently selected SDK via "xcrun --show-sdk-path". The same thing should be done for compiler-rt tests, to make them work on recent OS X versions. Instead of duplicating the detection code, this patch extracts the detection function into a lit.util method. Patch by Kuba Brecka (kuba.brecka@gmail.com), reviewed at http://reviews.llvm.org/D4072 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210534 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/lit/lit/util.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/utils/lit/lit/util.py b/utils/lit/lit/util.py
index 2b1010c187..72a8b4848e 100644
--- a/utils/lit/lit/util.py
+++ b/utils/lit/lit/util.py
@@ -167,3 +167,20 @@ def executeCommand(command, cwd=None, env=None):
err = str(err)
return out, err, exitCode
+
+def usePlatformSdkOnDarwin(config, lit_config):
+ # On Darwin, support relocatable SDKs by providing Clang with a
+ # default system root path.
+ if 'darwin' in config.target_triple:
+ try:
+ cmd = subprocess.Popen(['xcrun', '--show-sdk-path'],
+ 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:
+ sdk_path = out
+ lit_config.note('using SDKROOT: %r' % sdk_path)
+ config.environment['SDKROOT'] = sdk_path