llvm-project/clang/test/Driver/darwin-ld-platform-version-macos-requires-darwin.c
Lucas Duarte Prates 44e4b27aec
[clang] Fix darwin-related tests' REQUIRES annotation (#130138)
The tests updated by this commit were designed to check features in the
clang's driver and index that require clang to be targgeting a darwin
platform while running on a darwin host. For that, their execution is
currently gated by the `REQUIRES: system-darwin` annotation.

This approach becomes a problem when trying to run such tests on a
cross-compiling build of clang on a darwin platform. When the default
target is not darwin (e.g. via `LLVM_DEFAULT_TARGET_TRIPLE `), the
tests will still run on a darwin host and fail spuriously because of the
mismatch with the target detection.

To fix this issue, this patch introduces an extra condition to the
tests' REQUIRES annotation, `target={{.*}}-{{darwin|macos}}{{.*}}`,
ensuring they only run when the relevant target is present.
2025-03-18 09:11:43 +00:00

11 lines
374 B
C

// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: touch %t/f.o
// RUN: mkdir -p %t/MacOSX12.0.sdk
// RUN: %clang -fuse-ld= -arch arm64 -mlinker-version=520 -isysroot %t/MacOSX12.sdk/does-not-exist -### %t/f.o 2>&1 | FileCheck %s
// CHECK: "-platform_version" "macos" "{{[0-9]+}}.0.0" "{{[0-9]+}}.{{[0-9]+}}"
// REQUIRES: system-darwin && target={{.*}}-{{darwin|macos}}{{.*}}