[llvm] r304541 - [lit][macOS] Add a utility function to find the platform SDK version

Alex Lorenz via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 2 04:21:38 PDT 2017


Author: arphaman
Date: Fri Jun  2 06:21:37 2017
New Revision: 304541

URL: http://llvm.org/viewvc/llvm-project?rev=304541&view=rev
Log:
[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.

Modified:
    llvm/trunk/utils/lit/lit/util.py

Modified: llvm/trunk/utils/lit/lit/util.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/util.py?rev=304541&r1=304540&r2=304541&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/util.py (original)
+++ llvm/trunk/utils/lit/lit/util.py Fri Jun  2 06:21:37 2017
@@ -267,6 +267,20 @@ def usePlatformSdkOnDarwin(config, lit_c
             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




More information about the llvm-commits mailing list