Verify llvm-needs-components are not empty and match the --target value

This commit is contained in:
Daniel Paoliello
2025-07-16 16:16:24 -07:00
parent 7278554d82
commit cffde732ce
30 changed files with 277 additions and 97 deletions

View File

@@ -3,15 +3,15 @@
//@ add-core-stubs
//@ revisions:x86_64 i686 aarch64 arm riscv
//@[x86_64] compile-flags: --target x86_64-unknown-uefi
//@[x86_64] needs-llvm-components: aarch64 arm riscv
//@[x86_64] needs-llvm-components: x86
//@[i686] compile-flags: --target i686-unknown-linux-musl
//@[i686] needs-llvm-components: aarch64 arm riscv
//@[i686] needs-llvm-components: x86
//@[aarch64] compile-flags: --target aarch64-unknown-none
//@[aarch64] needs-llvm-components: aarch64 arm riscv
//@[aarch64] needs-llvm-components: aarch64
//@[arm] compile-flags: --target armv7r-none-eabi
//@[arm] needs-llvm-components: aarch64 arm riscv
//@[arm] needs-llvm-components: arm
//@[riscv] compile-flags: --target riscv64gc-unknown-none-elf
//@[riscv] needs-llvm-components: aarch64 arm riscv
//@[riscv] needs-llvm-components: riscv
//@ compile-flags: -C no-prepopulate-passes
#![crate_type = "lib"]

View File

@@ -4,7 +4,7 @@
//@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes -Zlint-llvm-ir
//@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu
//@[aarch64] needs-llvm-components: arm
//@[aarch64] needs-llvm-components: aarch64
//@[loongarch64] compile-flags: --target loongarch64-unknown-linux-gnu
//@[loongarch64] needs-llvm-components: loongarch
//@[powerpc64] compile-flags: --target powerpc64-unknown-linux-gnu

View File

@@ -3,7 +3,7 @@
//@ add-core-stubs
//@ revisions: undefined none branch return full
//@ needs-llvm-components: x86
//@ [undefined] compile-flags:
// [undefined] no extra compile-flags
//@ [none] compile-flags: -Z cf-protection=none
//@ [branch] compile-flags: -Z cf-protection=branch
//@ [return] compile-flags: -Z cf-protection=return

View File

@@ -1,7 +1,7 @@
//@ only-x86_64
//@ revisions: NOMODEL MODEL-SMALL MODEL-KERNEL MODEL-MEDIUM MODEL-LARGE
//@[NOMODEL] compile-flags:
// [NOMODEL] no compile-flags
//@[MODEL-SMALL] compile-flags: -C code-model=small
//@[MODEL-KERNEL] compile-flags: -C code-model=kernel
//@[MODEL-MEDIUM] compile-flags: -C code-model=medium

View File

@@ -1,5 +1,3 @@
//@ compile-flags:
#![crate_type = "lib"]
// A basic test function.

View File

@@ -8,7 +8,7 @@
//@[win_i686] compile-flags: --target i686-pc-windows-gnu
//@[win_i686] needs-llvm-components: x86
//@[macos] compile-flags: --target aarch64-apple-darwin
//@[macos] needs-llvm-components: arm
//@[macos] needs-llvm-components: aarch64
//@[thumb] compile-flags: --target thumbv7em-none-eabi
//@[thumb] needs-llvm-components: arm

View File

@@ -19,9 +19,9 @@
//@ only-linux
//
//@ revisions:ASAN ASAN-FAT-LTO
//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static
//@[ASAN] compile-flags:
//@[ASAN-FAT-LTO] compile-flags: -Cprefer-dynamic=false -Clto=fat
//@ compile-flags: -Zsanitizer=address -Ctarget-feature=-crt-static
// [ASAN] no extra compile-flags
//@[ASAN-FAT-LTO] compile-flags: -Cprefer-dynamic=false -Clto=fat
#![crate_type = "staticlib"]

View File

@@ -5,7 +5,7 @@
//@ [aarch64] compile-flags: --target aarch64-unknown-none
//@ [aarch64] needs-llvm-components: aarch64
//@ [x86_64] compile-flags: --target x86_64-unknown-none
//@ [x86_64] needs-llvm-components:
//@ [x86_64] needs-llvm-components: x86
//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0
#![crate_type = "lib"]

View File

@@ -5,7 +5,7 @@
//@ [aarch64] compile-flags: --target aarch64-unknown-none
//@ [aarch64] needs-llvm-components: aarch64
//@ [x86_64] compile-flags: --target x86_64-unknown-none
//@ [x86_64] needs-llvm-components:
//@ [x86_64] needs-llvm-components: x86
//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-generalize-pointers
#![crate_type = "lib"]

View File

@@ -5,7 +5,7 @@
//@ [aarch64] compile-flags: --target aarch64-unknown-none
//@ [aarch64] needs-llvm-components: aarch64
//@ [x86_64] compile-flags: --target x86_64-unknown-none
//@ [x86_64] needs-llvm-components:
//@ [x86_64] needs-llvm-components: x86
//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-generalize-pointers
#![crate_type = "lib"]

View File

@@ -5,7 +5,7 @@
//@ [aarch64] compile-flags: --target aarch64-unknown-none
//@ [aarch64] needs-llvm-components: aarch64
//@ [x86_64] compile-flags: --target x86_64-unknown-none
//@ [x86_64] needs-llvm-components:
//@ [x86_64] needs-llvm-components: x86
//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Zsanitizer-cfi-normalize-integers
#![crate_type = "lib"]

View File

@@ -5,7 +5,7 @@
//@ [aarch64] compile-flags: --target aarch64-unknown-none
//@ [aarch64] needs-llvm-components: aarch64
//@ [x86_64] compile-flags: --target x86_64-unknown-none
//@ [x86_64] needs-llvm-components:
//@ [x86_64] needs-llvm-components: x86
//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0
#![crate_type = "lib"]

View File

@@ -5,7 +5,7 @@
//@ [aarch64] compile-flags: --target aarch64-unknown-none
//@ [aarch64] needs-llvm-components: aarch64
//@ [x86_64] compile-flags: --target x86_64-unknown-none
//@ [x86_64] needs-llvm-components:
//@ [x86_64] needs-llvm-components: x86
//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0
#![crate_type = "lib"]

View File

@@ -5,7 +5,7 @@
//@ [aarch64] compile-flags: --target aarch64-unknown-none
//@ [aarch64] needs-llvm-components: aarch64
//@ [x86_64] compile-flags: --target x86_64-unknown-none
//@ [x86_64] needs-llvm-components:
//@ [x86_64] needs-llvm-components: x86
//@ compile-flags: -Cno-prepopulate-passes -Zsanitizer=kcfi -Copt-level=0
#![crate_type = "lib"]

View File

@@ -5,7 +5,7 @@
//@ revisions:MSAN-0 MSAN-1 MSAN-2 MSAN-1-LTO MSAN-2-LTO
//
//@ compile-flags: -Zsanitizer=memory -Ctarget-feature=-crt-static
//@[MSAN-0] compile-flags:
// [MSAN-0] no extra compile-flags
//@[MSAN-1] compile-flags: -Zsanitizer-memory-track-origins=1
//@[MSAN-2] compile-flags: -Zsanitizer-memory-track-origins
//@[MSAN-1-LTO] compile-flags: -Zsanitizer-memory-track-origins=1 -C lto=fat

View File

@@ -6,7 +6,7 @@
// but ub-checks are explicitly disabled.
//@ revisions: DEBUG NOCHECKS
//@ [DEBUG] compile-flags:
// [DEBUG] no extra compile-flags
//@ [NOCHECKS] compile-flags: -Zub-checks=no
//@ compile-flags: -Copt-level=3 -Cdebug-assertions=yes

View File

@@ -37,7 +37,6 @@
// cdb-check: [...] vtable : 0x[...] [Type: unsigned [...]int[...] (*)[4]]
// cdb-command:dx _box
// cdb-check:
// cdb-check:_box [Type: alloc::boxed::Box<unsized::Foo<dyn$<core::fmt::Debug> >,alloc::alloc::Global>]
// cdb-check:[+0x000] pointer : 0x[...] [Type: unsized::Foo<dyn$<core::fmt::Debug> > *]
// cdb-check:[...] vtable : 0x[...] [Type: unsigned [...]int[...] (*)[4]]

View File

@@ -2,7 +2,7 @@
//@ compile-flags: -g -Ztranslate-remapped-path-to-local-path=yes
//@ [with-remap]compile-flags: --remap-path-prefix={{rust-src-base}}=remapped
//@ [with-remap]compile-flags: --remap-path-prefix={{src-base}}=remapped-tests-ui
//@ [without-remap]compile-flags:
// [without-remap] no extra compile-flags
// The $SRC_DIR*.rs:LL:COL normalisation doesn't kick in automatically
// as the remapped revision will not begin with $SRC_DIR_REAL,

View File

@@ -2,6 +2,7 @@
// checks that such invalid target specs are rejected by the compiler.
// See https://github.com/rust-lang/rust/issues/33329
// ignore-tidy-target-specific-tests
//@ needs-llvm-components: x86
//@ compile-flags: --target x86_64_unknown-linux-musl

View File

@@ -4,9 +4,9 @@
//
//@ revisions: bpf ptx
//@ [bpf] compile-flags: --target=bpfel-unknown-none -C linker-flavor=bpf --crate-type=rlib
//@ [bpf] needs-llvm-components:
//@ [bpf] needs-llvm-components: bpf
//@ [ptx] compile-flags: --target=nvptx64-nvidia-cuda -C linker-flavor=ptx --crate-type=rlib
//@ [ptx] needs-llvm-components:
//@ [ptx] needs-llvm-components: nvptx
#![feature(no_core)]
#![no_core]

View File

@@ -6,7 +6,7 @@
//@ needs-llvm-components: x86
//@ revisions: ok ok_explicit error
//@[ok] compile-flags:
// [ok] no extra compile-flags
//@[ok_explicit] compile-flags: -Zreg-struct-return=false
//@[error] compile-flags: -Zreg-struct-return=true
//@[ok] check-pass

View File

@@ -5,7 +5,7 @@
//@ revisions:allow_match allow_mismatch error_generated
//@[allow_match] compile-flags: -Zfixed-x18
//@[allow_mismatch] compile-flags: -Cunsafe-allow-abi-mismatch=fixed-x18
//@[error_generated] compile-flags:
// [error_generated] no extra compile-flags
//@[allow_mismatch] check-pass
//@[allow_match] check-pass

View File

@@ -5,7 +5,7 @@
//@ revisions:allow_regparm_mismatch allow_no_value error_generated
//@[allow_regparm_mismatch] compile-flags: -Cunsafe-allow-abi-mismatch=regparm
//@[allow_no_value] compile-flags: -Cunsafe-allow-abi-mismatch
//@[error_generated] compile-flags:
// [error_generated] no extra compile-flags
//@[allow_regparm_mismatch] check-pass
#![feature(no_core)]

View File

@@ -8,7 +8,7 @@
//@ revisions: ok ok_explicit error error_explicit
//@[ok] compile-flags: -Zreg-struct-return
//@[ok_explicit] compile-flags: -Zreg-struct-return=true
//@[error] compile-flags:
// [error] no extra compile-flags
//@[error_explicit] compile-flags: -Zreg-struct-return=false
//@[ok] check-pass
//@[ok_explicit] check-pass