[libcxx] r250003 - [Darwin] Need to add -isysroot on OS X otherwise the tests will fail if you don't have the command line tools package installed.

Chris Bieneman via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 11 19:49:39 PDT 2015


CMake handles doing it while building. I will update to use lit.util.*

-Chris

> On Oct 11, 2015, at 6:04 PM, Eric Fiselier <eric at efcs.ca> wrote:
> 
> Do we need to do with while building libc++ as well? Also please reuse lit.util.capture or lit.util.executeCommand instead of subprocess.
> 
> /Eric
> 
> On Sun, Oct 11, 2015 at 6:49 PM, Chris Bieneman via cfe-commits <cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>> wrote:
> Author: cbieneman
> Date: Sun Oct 11 19:49:56 2015
> New Revision: 250003
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=250003&view=rev <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 <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 at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits>
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151011/2d327632/attachment-0001.html>


More information about the cfe-commits mailing list