Skip to content

Commit 44e4b27

Browse files
authored
[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.
1 parent bd1be8a commit 44e4b27

6 files changed

+6
-6
lines changed

clang/test/Driver/apple-arm64-arch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: env SDKROOT="/" %clang -arch arm64 -c -### %s 2>&1 | \
22
// RUN: FileCheck %s
33
//
4-
// REQUIRES: system-darwin
4+
// REQUIRES: system-darwin && target={{.*}}-{{darwin|macos}}{{.*}}
55
//
66
// CHECK: "-triple" "arm64-apple-macosx{{[0-9.]+}}"

clang/test/Driver/compilation_database_multiarch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// REQUIRES: system-darwin
1+
// REQUIRES: system-darwin && target={{.*}}-{{darwin|macos}}{{.*}}
22

33
// RUN: rm -rf %t && mkdir -p %t
44
// RUN: %clang -fdriver-only -o %t/out %s -mtargetos=macos12 -arch arm64 -arch x86_64 -MJ %t/compilation_database.json

clang/test/Driver/darwin-ld-platform-version-macos-requires-darwin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77

88
// CHECK: "-platform_version" "macos" "{{[0-9]+}}.0.0" "{{[0-9]+}}.{{[0-9]+}}"
99

10-
// REQUIRES: system-darwin
10+
// REQUIRES: system-darwin && target={{.*}}-{{darwin|macos}}{{.*}}

clang/test/Driver/mtargetos-darwin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
// RUN: not %clang -mtargetos=darwin20 -arch arm64 -c %s -o %t.o -### 2>&1 | FileCheck --check-prefix=INVALIDOS %s
1212
// RUN: not %clang -mtargetos=ios -arch arm64 -c %s -o %t.o -### 2>&1 | FileCheck --check-prefix=NOVERSION %s
1313

14-
// REQUIRES: system-darwin
14+
// REQUIRES: system-darwin && target={{.*}}-{{darwin|macos}}{{.*}}
1515

1616
// MACOS: "-cc1" "-triple" "arm64-apple-macosx11.0.0"
1717
// MACOS-NEXT: "-cc1" "-triple" "x86_64-apple-macosx11.0.0"

clang/test/Driver/xros-driver-requires-darwin-host.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// REQUIRES: system-darwin
1+
// REQUIRES: system-darwin && target={{.*}}-{{darwin|macos}}{{.*}}
22

33
// RUN: env XROS_DEPLOYMENT_TARGET=1.0 %clang -arch arm64 -c -### %s 2>&1 | FileCheck %s
44

clang/test/Index/pch-from-libclang.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// RUN: c-index-test -test-load-source local %s -include %t.clang.h -fmodules -fmodules-cache-path=%t.mcp -Xclang -triple -Xclang x86_64-apple-darwin | FileCheck %s
1919

2020
// FIXME: Still fails on at least some linux boxen.
21-
// REQUIRES: system-darwin
21+
// REQUIRES: system-darwin && target={{.*}}-{{darwin|macos}}{{.*}}
2222

2323
#ifndef HEADER
2424
#define HEADER

0 commit comments

Comments
 (0)