[PATCH] D129684: [test] Fix macOS triple check
Ben Langmuir via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 13 12:15:54 PDT 2022
benlangmuir created this revision.
benlangmuir added reviewers: akyrtzi, steven_wu.
Herald added a subscriber: delcypher.
Herald added a project: All.
benlangmuir requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
While the inferred host triple for macOS is something like
<arch>-apple-darwin, it's also valid to have <arch>-apple-macos.
Currently that globally changes whether an SDKROOT is provided in tests,
so make this check more portable.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D129684
Files:
llvm/utils/lit/lit/util.py
Index: llvm/utils/lit/lit/util.py
===================================================================
--- llvm/utils/lit/lit/util.py
+++ llvm/utils/lit/lit/util.py
@@ -385,10 +385,17 @@
return out, err, exitCode
+def isMacOSTriple(target_triple):
+ """Whether the given target triple is for macOS,
+ e.g. x86_64-apple-darwin, arm64-apple-macos
+ """
+ return 'darwin' in target_triple or 'macos' in target_triple
+
+
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:
+ if isMacOSTriple(config.target_triple):
try:
cmd = subprocess.Popen(['xcrun', '--show-sdk-path', '--sdk', 'macosx'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -404,7 +411,7 @@
def findPlatformSdkVersionOnMacOS(config, lit_config):
- if 'darwin' in config.target_triple:
+ if isMacOSTriple(config.target_triple):
try:
cmd = subprocess.Popen(['xcrun', '--show-sdk-version', '--sdk', 'macosx'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129684.444378.patch
Type: text/x-patch
Size: 1215 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220713/d0309a0f/attachment.bin>
More information about the llvm-commits
mailing list