Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate ignore and only compiletest directive, and add human-readable ignore reasons #108905

Merged
merged 28 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
123cc41
include eventual comment in the compiletest ignore reason
pietroalbini Mar 6, 2023
4e2a982
include pretty reason why ignore-FOO matched
pietroalbini Mar 6, 2023
9bc8bb9
validate ignore-FOO/only-FOO directives and output only-FOO reasoning
pietroalbini Mar 8, 2023
0aaf9d5
reduce boilerplate with common enums
pietroalbini Mar 8, 2023
703ba0c
fix ignore-thumbv8m.base
pietroalbini Mar 8, 2023
8dd6c19
split invalid only-x86-windows into only-x86 and only-windows
pietroalbini Mar 8, 2023
64af509
remove invalid ignore-pretty
pietroalbini Mar 8, 2023
e592aaa
remove invalid ignore-powerpc64le
pietroalbini Mar 8, 2023
ef2bf6d
implement --print=all-target-specs-json
pietroalbini Mar 9, 2023
0e6d205
use target specs rather than --print=cfg to discover targets
pietroalbini Mar 9, 2023
c075691
use --print=all-target-specs-json for stage1+
pietroalbini Mar 9, 2023
55121a9
avoid cloning the whole compiletest configuration for every test
pietroalbini Mar 10, 2023
8eb3def
handle "ignore-" and "only-"
pietroalbini Mar 10, 2023
9cb4373
move cfg handling into its own module
pietroalbini Mar 10, 2023
bc991de
reduce allocations when validating cfgs
pietroalbini Mar 10, 2023
e085192
allow some out of tree archs
pietroalbini Mar 10, 2023
4cdb783
migrate existing behavior of matches_arch
pietroalbini Mar 10, 2023
91be8ca
properly match multiple families
pietroalbini Mar 10, 2023
54c4762
fix remaining tests
pietroalbini Mar 10, 2023
60f2761
add support for ignore-llvm-version
pietroalbini Mar 16, 2023
e045598
remove a bunch of unknown archs from the global_asm tests
pietroalbini Mar 16, 2023
3602200
make 32bit ignore more accurate
pietroalbini Mar 16, 2023
8f8873e
remove unknown xcore arch
pietroalbini Mar 16, 2023
5b0a0d8
add support for ignore-gdb-version
pietroalbini Mar 16, 2023
9a2d1b8
restore check for both target os and env
pietroalbini Mar 16, 2023
bf66ddb
fix wrong ignore condition
pietroalbini Mar 16, 2023
48bea63
fix solaris ignore
pietroalbini Mar 16, 2023
bbcbb6f
ignore x86-stdcall on mingw
pietroalbini Mar 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ use rustc_session::{early_error, early_error_no_abort, early_warn};
use rustc_span::source_map::{FileLoader, FileName};
use rustc_span::symbol::sym;
use rustc_target::json::ToJson;
use rustc_target::spec::{Target, TargetTriple};

use std::cmp::max;
use std::collections::BTreeMap;
use std::env;
use std::ffi::OsString;
use std::fs;
Expand Down Expand Up @@ -648,6 +650,15 @@ fn print_crate_info(
TargetSpec => {
println!("{}", serde_json::to_string_pretty(&sess.target.to_json()).unwrap());
}
AllTargetSpecs => {
let mut targets = BTreeMap::new();
for name in rustc_target::spec::TARGETS {
let triple = TargetTriple::from_triple(name);
let target = Target::expect_builtin(&triple);
targets.insert(name, target.to_json());
}
println!("{}", serde_json::to_string_pretty(&targets).unwrap());
}
FileNames | CrateName => {
let Some(attrs) = attrs.as_ref() else {
// no crate attributes, print out an error and exit
Expand Down
19 changes: 16 additions & 3 deletions compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ pub enum PrintRequest {
CodeModels,
TlsModels,
TargetSpec,
AllTargetSpecs,
NativeStaticLibs,
StackProtectorStrategies,
LinkArgs,
Expand Down Expand Up @@ -1439,8 +1440,8 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
"Compiler information to print on stdout",
"[crate-name|file-names|sysroot|target-libdir|cfg|calling-conventions|\
target-list|target-cpus|target-features|relocation-models|code-models|\
tls-models|target-spec-json|native-static-libs|stack-protector-strategies|\
link-args]",
tls-models|target-spec-json|all-target-specs-json|native-static-libs|\
stack-protector-strategies|link-args]",
),
opt::flagmulti_s("g", "", "Equivalent to -C debuginfo=2"),
opt::flagmulti_s("O", "", "Equivalent to -C opt-level=2"),
Expand Down Expand Up @@ -1887,6 +1888,7 @@ fn collect_print_requests(
("native-static-libs", PrintRequest::NativeStaticLibs),
("stack-protector-strategies", PrintRequest::StackProtectorStrategies),
("target-spec-json", PrintRequest::TargetSpec),
("all-target-specs-json", PrintRequest::AllTargetSpecs),
("link-args", PrintRequest::LinkArgs),
("split-debuginfo", PrintRequest::SplitDebuginfo),
];
Expand All @@ -1900,7 +1902,18 @@ fn collect_print_requests(
early_error(
error_format,
"the `-Z unstable-options` flag must also be passed to \
enable the target-spec-json print option",
enable the target-spec-json print option",
);
}
}
Some((_, PrintRequest::AllTargetSpecs)) => {
if unstable_opts.unstable_options {
PrintRequest::AllTargetSpecs
} else {
early_error(
error_format,
"the `-Z unstable-options` flag must also be passed to \
enable the all-target-specs-json print option",
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ impl Step for CompiletestTest {
/// Runs `cargo test` for compiletest.
fn run(self, builder: &Builder<'_>) {
let host = self.host;
let compiler = builder.compiler(0, host);
let compiler = builder.compiler(1, host);

// We need `ToolStd` for the locally-built sysroot because
// compiletest uses unstable features of the `test` crate.
Expand Down
Loading