Skip to content

Commit d4e7cb3

Browse files
committed
Auto merge of #86272 - nagisa:nagisa/tidy-llvm-components, r=Mark-Simulacrum
tidy: verify that test revisions with --target have associated needs-llvm-components directives This ensures that people who tend to write `--target` `#[no_core]` tests don't miss specifying the `needs-llvm-components` directive. This is necessary for the test suite to pass when LLVM is compiled with a subset of components enabled. While here I also took the opportunity to implement a more fine-grained handling of the ignore directives, so that they are evaluated for each revision, rather than for the entire test. With this even if people have `arm` component disabled, only the revision that depends on the arm component will not run. Fixes #82405
2 parents 7c3872e + cfcb2b6 commit d4e7cb3

39 files changed

+517
-407
lines changed

src/test/assembly/asm/mips-types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
// revisions: mips32 mips64
33
// assembly-output: emit-asm
44
//[mips32] compile-flags: --target mips-unknown-linux-gnu
5+
//[mips32] needs-llvm-components: mips
56
//[mips64] compile-flags: --target mips64-unknown-linux-gnuabi64
6-
// needs-llvm-components: mips
7+
//[mips64] needs-llvm-components: mips
78

89
#![feature(no_core, lang_items, rustc_attrs, repr_simd)]
910
#![crate_type = "rlib"]

src/test/assembly/asm/powerpc-types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
// revisions: powerpc powerpc64
33
// assembly-output: emit-asm
44
//[powerpc] compile-flags: --target powerpc-unknown-linux-gnu
5+
//[powerpc] needs-llvm-components: powerpc
56
//[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu
6-
// needs-llvm-components: powerpc
7+
//[powerpc64] needs-llvm-components: powerpc
78

89
#![feature(no_core, lang_items, rustc_attrs, repr_simd)]
910
#![crate_type = "rlib"]

src/test/assembly/asm/riscv-types.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
// revisions: riscv64 riscv32
33
// assembly-output: emit-asm
44
//[riscv64] compile-flags: --target riscv64imac-unknown-none-elf
5+
//[riscv64] needs-llvm-components: riscv
56
//[riscv32] compile-flags: --target riscv32imac-unknown-none-elf
7+
//[riscv32] needs-llvm-components: riscv
68
// compile-flags: -C target-feature=+d
7-
// needs-llvm-components: riscv
89
// min-system-llvm-version: 12.0
910

1011
#![feature(no_core, lang_items, rustc_attrs)]

src/test/assembly/asm/x86-modifiers.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
// assembly-output: emit-asm
44
// compile-flags: -O
55
//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu
6+
//[x86_64] needs-llvm-components: x86
67
//[i686] compile-flags: --target i686-unknown-linux-gnu
8+
//[i686] needs-llvm-components: x86
79
// compile-flags: -C llvm-args=--x86-asm-syntax=intel
810
// compile-flags: -C target-feature=+avx512bw
911

src/test/assembly/asm/x86-types.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
// revisions: x86_64 i686
33
// assembly-output: emit-asm
44
//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu
5+
//[x86_64] needs-llvm-components: x86
56
//[i686] compile-flags: --target i686-unknown-linux-gnu
7+
//[i686] needs-llvm-components: x86
68
// compile-flags: -C llvm-args=--x86-asm-syntax=intel
79
// compile-flags: -C target-feature=+avx512bw
810

src/test/assembly/static-relocation-model.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// min-llvm-version: 12.0.0
2-
// needs-llvm-components: aarch64 x86 powerpc
32
// revisions: x64 A64 ppc64le
43
// assembly-output: emit-asm
54
// [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=static
5+
// [x64] needs-llvm-components: x86
66
// [A64] compile-flags: --target aarch64-unknown-linux-gnu -Crelocation-model=static
7+
// [A64] needs-llvm-components: aarch64
78
// [ppc64le] compile-flags: --target powerpc64le-unknown-linux-gnu -Crelocation-model=static
9+
// [ppc64le] needs-llvm-components: powerpc
810

911
#![feature(no_core, lang_items)]
1012
#![no_core]

src/test/codegen/abi-efiapi.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
// Checks if the correct annotation for the efiapi ABI is passed to llvm.
22

33
// revisions:x86_64 i686 aarch64 arm riscv
4-
// needs-llvm-components: aarch64 arm riscv
5-
64
//[x86_64] compile-flags: --target x86_64-unknown-uefi
5+
//[x86_64] needs-llvm-components: aarch64 arm riscv
76
//[i686] compile-flags: --target i686-unknown-linux-musl
7+
//[i686] needs-llvm-components: aarch64 arm riscv
88
//[aarch64] compile-flags: --target aarch64-unknown-none
9+
//[aarch64] needs-llvm-components: aarch64 arm riscv
910
//[arm] compile-flags: --target armv7r-none-eabi
11+
//[arm] needs-llvm-components: aarch64 arm riscv
1012
//[riscv] compile-flags: --target riscv64gc-unknown-none-elf
13+
//[riscv] needs-llvm-components: aarch64 arm riscv
1114
// compile-flags: -C no-prepopulate-passes
1215

1316
#![crate_type = "lib"]

src/test/codegen/asm-sanitize-llvm.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// FIXME(nagisa): remove the flags here once all targets support `asm!`.
1+
// FIXME(nagisa): remove the flags below once all targets support `asm!`.
22
// compile-flags: --target x86_64-unknown-linux-gnu
3+
// needs-llvm-components: x86
34

45
// Verify we sanitize the special tokens for the LLVM inline-assembly, ensuring people won't
56
// inadvertently rely on the LLVM-specific syntax and features.

src/test/codegen/default-requires-uwtable.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// revisions: WINDOWS ANDROID
2-
// needs-llvm-components: x86 arm
32
// compile-flags: -C panic=abort
43
// [WINDOWS] compile-flags: --target=x86_64-pc-windows-msvc
4+
// [WINDOWS] needs-llvm-components: x86
55
// [ANDROID] compile-flags: --target=armv7-linux-androideabi
6+
// [ANDROID] needs-llvm-components: arm
67

78
#![feature(no_core, lang_items)]
89
#![crate_type = "lib"]

src/test/codegen/i686-macosx-deployment-target.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// See issue #60235.
44

55
// compile-flags: -O --target=i686-apple-darwin --crate-type=rlib
6+
// needs-llvm-components: x86
67
// rustc-env:MACOSX_DEPLOYMENT_TARGET=10.9
78
#![feature(no_core, lang_items)]
89
#![no_core]

0 commit comments

Comments
 (0)