Author: cbieneman Date: Sun Oct 11 19:49:56 2015 New Revision: 250003 URL: http://llvm.org/viewvc/llvm-project?rev=250003&view=rev Log: [Darwin] Need to add -isysroot on OS X otherwise the tests will fail if you don't have the command line tools package installed.
This mirrors how other LLVM suites are configured for running on OS X. Modified: libcxx/trunk/test/libcxx/test/config.py Modified: libcxx/trunk/test/libcxx/test/config.py URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=250003&r1=250002&r2=250003&view=diff ============================================================================== --- libcxx/trunk/test/libcxx/test/config.py (original) +++ libcxx/trunk/test/libcxx/test/config.py Sun Oct 11 19:49:56 2015 @@ -6,6 +6,7 @@ import pkgutil import re import shlex import sys +import subprocess import lit.Test # pylint: disable=import-error,no-name-in-module import lit.util # pylint: disable=import-error,no-name-in-module @@ -42,6 +43,24 @@ def loadSiteConfig(lit_config, config, p ld_fn(config, site_cfg) lit_config.load_config = ld_fn +def getSysrootFlagsOnDarwin(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) + return ["-isysroot", sdk_path] + return [] + class Configuration(object): # pylint: disable=redefined-outer-name @@ -339,6 +358,8 @@ class Configuration(object): # Configure extra flags compile_flags_str = self.get_lit_conf('compile_flags', '') self.cxx.compile_flags += shlex.split(compile_flags_str) + sysroot_flags = getSysrootFlagsOnDarwin(self.config, self.lit_config) + self.cxx.compile_flags.extend(sysroot_flags) def configure_default_compile_flags(self): # Try and get the std version from the command line. Fall back to _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits