diff options
| -rw-r--r-- | clang/test/lit.cfg | 16 | ||||
| -rw-r--r-- | compiler-rt/test/lit.common.cfg | 3 | ||||
| -rw-r--r-- | llvm/utils/lit/lit/util.py | 17 |
3 files changed, 21 insertions, 15 deletions
diff --git a/clang/test/lit.cfg b/clang/test/lit.cfg index 5c2b187..11e8e0b 100644 --- a/clang/test/lit.cfg +++ b/clang/test/lit.cfg @@ -471,18 +471,4 @@ gmalloc_path_str = lit_config.params.get('gmalloc_path', if use_gmalloc: config.environment.update({'DYLD_INSERT_LIBRARIES' : gmalloc_path_str}) -# 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 +lit.util.usePlatformSdkOnDarwin(config, lit_config) diff --git a/compiler-rt/test/lit.common.cfg b/compiler-rt/test/lit.common.cfg index 5366073..adf65ee 100644 --- a/compiler-rt/test/lit.common.cfg +++ b/compiler-rt/test/lit.common.cfg @@ -7,6 +7,7 @@ import os import platform import lit.formats +import lit.util # Setup test format execute_external = (platform.system() != 'Windows' @@ -77,3 +78,5 @@ if compiler_rt_arch: compiler_rt_debug = getattr(config, 'compiler_rt_debug', False) if not compiler_rt_debug: config.available_features.add('compiler-rt-optimized') + +lit.util.usePlatformSdkOnDarwin(config, lit_config) diff --git a/llvm/utils/lit/lit/util.py b/llvm/utils/lit/lit/util.py index 2b1010c..72a8b48 100644 --- a/llvm/utils/lit/lit/util.py +++ b/llvm/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 |
