Rollup merge of #129605 - jieyouxu:needs-llvm-components, r=Mark-Simulacrum

Add missing `needs-llvm-components` directives for run-make tests that need target-specific codegen

Without suitable `needs-llvm-components` directives, some run-make tests exercising target-specific codegen can fail if the LLVM used is built without the necessary components. Currently, the list is:

```
tests\run-make\print-target-list
tests\run-make\print-to-output
tests\run-make\print-cfg
tests\run-make\target-without-atomic-cas
```

This PR also skips tidy checks for revisions and `needs-llvm-components` for run-make tests since revisions are not supported.

Fixes #129390.
Fixes #127895.

cc ``@petrochenkov`` who noticed this, thanks! Would be great if you could confirm that this fixes the test errors for you locally.
This commit is contained in:
Matthias Krüger 2024-08-31 20:36:23 +02:00 committed by GitHub
commit d354d4ddd7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 40 additions and 13 deletions

View File

@ -36,8 +36,8 @@ struct RevisionInfo<'a> {
llvm_components: Option<Vec<&'a str>>, llvm_components: Option<Vec<&'a str>>,
} }
pub fn check(path: &Path, bad: &mut bool) { pub fn check(tests_path: &Path, bad: &mut bool) {
crate::walk::walk(path, |path, _is_dir| filter_not_rust(path), &mut |entry, content| { crate::walk::walk(tests_path, |path, _is_dir| filter_not_rust(path), &mut |entry, content| {
let file = entry.path().display(); let file = entry.path().display();
let mut header_map = BTreeMap::new(); let mut header_map = BTreeMap::new();
iter_header(content, &mut |HeaderLine { revision, directive, .. }| { iter_header(content, &mut |HeaderLine { revision, directive, .. }| {
@ -65,6 +65,12 @@ pub fn check(path: &Path, bad: &mut bool) {
} }
} }
}); });
// Skip run-make tests as revisions are not supported.
if entry.path().strip_prefix(tests_path).is_ok_and(|rest| rest.starts_with("run-make")) {
return;
}
for (rev, RevisionInfo { target_arch, llvm_components }) in &header_map { for (rev, RevisionInfo { target_arch, llvm_components }) in &header_map {
let rev = rev.unwrap_or("[unspecified]"); let rev = rev.unwrap_or("[unspecified]");
match (target_arch, llvm_components) { match (target_arch, llvm_components) {

View File

@ -5,6 +5,11 @@
//! //!
//! It also checks that some targets have the correct set cfgs. //! It also checks that some targets have the correct set cfgs.
// ignore-tidy-linelength
//@ needs-llvm-components: arm x86
// Note: without the needs-llvm-components it will fail on LLVM built without the required
// components listed above.
use std::collections::HashSet; use std::collections::HashSet;
use std::iter::FromIterator; use std::iter::FromIterator;
use std::path::PathBuf; use std::path::PathBuf;

View File

@ -1,10 +1,15 @@
// Checks that all the targets returned by `rustc --print target-list` are valid // Checks that all the targets returned by `rustc --print target-list` are valid target
// target specifications // specifications.
// ignore-tidy-linelength
//@ needs-llvm-components: aarch64 arm avr bpf csky hexagon loongarch m68k mips msp430 nvptx powerpc riscv sparc systemz webassembly x86
// FIXME(jieyouxu): there has to be a better way to do this, without the needs-llvm-components it
// will fail on LLVM built without all of the components listed above.
use run_make_support::bare_rustc; use run_make_support::bare_rustc;
// FIXME(127877): certain experimental targets fail with creating a 'LLVM TargetMachine' // FIXME(#127877): certain experimental targets fail with creating a 'LLVM TargetMachine' in CI, so
// in CI, so we skip them // we skip them.
const EXPERIMENTAL_TARGETS: &[&str] = &["avr", "m68k", "csky", "xtensa"]; const EXPERIMENTAL_TARGETS: &[&str] = &["avr", "m68k", "csky", "xtensa"];
fn main() { fn main() {

View File

@ -1,5 +1,11 @@
//! This checks the output of some `--print` options when //! This checks the output of some `--print` options when output to a file (instead of stdout)
//! output to a file (instead of stdout)
// ignore-tidy-linelength
//@ needs-llvm-components: aarch64 arm avr bpf csky hexagon loongarch m68k mips msp430 nvptx powerpc riscv sparc systemz webassembly x86
// FIXME(jieyouxu): there has to be a better way to do this, without the needs-llvm-components it
// will fail on LLVM built without all of the components listed above. If adding a new target that
// relies on a llvm component not listed above, it will need to be added to the required llvm
// components above.
use std::path::PathBuf; use std::path::PathBuf;

View File

@ -1,8 +1,13 @@
// ARM Cortex-M are a class of processors supported by the rust compiler. However, // ARM Cortex-M are a class of processors supported by the rust compiler. However, they cannot
// they cannot support any atomic features, such as Arc. This test simply prints // support any atomic features, such as Arc. This test simply prints the configuration details of
// the configuration details of one Cortex target, and checks that the compiler // one Cortex target, and checks that the compiler does not falsely list atomic support.
// does not falsely list atomic support. // See <https://github.com/rust-lang/rust/pull/36874>.
// See https://github.com/rust-lang/rust/pull/36874
// ignore-tidy-linelength
//@ needs-llvm-components: arm
// Note: without the needs-llvm-components it will fail on LLVM built without all of the components
// listed above. If any new targets are added, please double-check their respective llvm components
// are specified above.
use run_make_support::rustc; use run_make_support::rustc;