Rollup merge of #139967 - jieyouxu:auxiliary, r=wesleywiser
Introduce and use specialized `//@ ignore-auxiliary` for test support files instead of using `//@ ignore-test` ### Summary Add a semantically meaningful directive for ignoring test *auxiliary* files. This is for auxiliary files that *participate* in actual tests but should not be built by `compiletest` (i.e. these files are involved through `mod xxx;` or `include!()` or `#[path = "xxx"]`, etc.). ### Motivation A specialized directive like `//@ ignore-auxiliary` makes it way easier to audit disabled tests via `//@ ignore-test`. - These support files cannot use the canonical `auxiliary/` dir because they participate in module resolution or are included, or their relative paths can be important for test intention otherwise. Follow-up to: - #139705 - #139783 - #139740 See also discussions in: - [#t-compiler > Directive name for non-test aux files?](512773817
) - [#t-compiler > Handling disabled `//@ ignore-test` tests](512005974
) - [#t-compiler/meetings > [steering] 2025-04-11 Dealing with disabled tests](511717981
) ### Remarks on remaining unconditionally disabled tests under `tests/` After this PR, against commit79a272c640
, only **14** remaining test files are disabled through `//@ ignore-test`: <details> <summary>Remaining `//@ ignore-test` files under `tests/`</summary> ``` tests/debuginfo/drop-locations.rs 4://@ ignore-test (broken, see #128971) tests/rustdoc/macro-document-private-duplicate.rs 1://@ ignore-test (fails spuriously, see issue #89228) tests/rustdoc/inline_cross/assoc-const-equality.rs 3://@ ignore-test (FIXME: #125092) tests/ui/match/issue-27021.rs 7://@ ignore-test (#54987) tests/ui/match/issue-26996.rs 7://@ ignore-test (#54987) tests/ui/issues/issue-49298.rs 9://@ ignore-test (#54987) tests/ui/issues/issue-59756.rs 2://@ ignore-test (rustfix needs multiple suggestions) tests/ui/precondition-checks/write.rs 5://@ ignore-test (unimplemented) tests/ui/precondition-checks/read.rs 5://@ ignore-test (unimplemented) tests/ui/precondition-checks/write_bytes.rs 5://@ ignore-test (unimplemented) tests/ui/explicit-tail-calls/drop-order.rs 2://@ ignore-test: tail calls are not implemented in rustc_codegen_ssa yet, so this causes 🧊 tests/ui/panics/panic-short-backtrace-windows-x86_64.rs 3://@ ignore-test (#92000) tests/ui/json/json-bom-plus-crlf-multifile-aux.rs 3://@ ignore-test Not a test. Used by other tests tests/ui/traits/next-solver/object-soundness-requires-generalization.rs 2://@ ignore-test (see #114196) ``` </details> Of these, most are either **unimplemented**, or **spurious**, or **known-broken**. The outstanding one is `tests/ui/json/json-bom-plus-crlf-multifile-aux.rs` which I did not want to touch in *this* PR -- that aux file has load-bearing BOM and carriage returns and byte offset matters. I think those test files that require special encoding / BOM probably are better off as `run-make` tests. See #139968 for that aux file. ### Review advice - Best reviewed commit-by-commit. - The directive name diverged from the most voted `//@ auxiliary` because I think that's easy to confuse with `//@ aux-{crate,dir}`. r? compiler
This commit is contained in:
commit
026d56b0f6
48 changed files with 56 additions and 60 deletions
|
@ -175,6 +175,8 @@ See [compiletest directives] for a listing of directives.
|
|||
- For `ignore-*`/`needs-*`/`only-*` directives, unless extremely obvious,
|
||||
provide a brief remark on why the directive is needed. E.g. `"//@ ignore-wasi
|
||||
(wasi codegens the main symbol differently)"`.
|
||||
- When using `//@ ignore-auxiliary`, specify the corresponding main test files,
|
||||
e.g. ``//@ ignore-auxiliary (used by `./foo.rs`)``.
|
||||
|
||||
## FileCheck best practices
|
||||
|
||||
|
|
|
@ -124,6 +124,9 @@ means the test won't be compiled or run.
|
|||
* `ignore-X` where `X` is a target detail or other criteria on which to ignore the test (see below)
|
||||
* `only-X` is like `ignore-X`, but will *only* run the test on that target or
|
||||
stage
|
||||
* `ignore-auxiliary` is intended for files that *participate* in one or more other
|
||||
main test files but that `compiletest` should not try to build the file itself.
|
||||
Please backlink to which main test is actually using the auxiliary file.
|
||||
* `ignore-test` always ignores the test. This can be used to temporarily disable
|
||||
a test if it is currently not working, but you want to keep it in tree to
|
||||
re-enable it later.
|
||||
|
|
|
@ -44,6 +44,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
|
|||
"ignore-arm-unknown-linux-gnueabihf",
|
||||
"ignore-arm-unknown-linux-musleabi",
|
||||
"ignore-arm-unknown-linux-musleabihf",
|
||||
"ignore-auxiliary",
|
||||
"ignore-avr",
|
||||
"ignore-beta",
|
||||
"ignore-cdb",
|
||||
|
|
|
@ -100,6 +100,10 @@ fn parse_cfg_name_directive<'a>(
|
|||
name: "test",
|
||||
message: "always"
|
||||
}
|
||||
condition! {
|
||||
name: "auxiliary",
|
||||
message: "used by another main test file"
|
||||
}
|
||||
condition! {
|
||||
name: &config.target,
|
||||
allowed_names: &target_cfgs.all_targets,
|
||||
|
|
|
@ -940,3 +940,9 @@ fn test_supported_crate_types() {
|
|||
"//@ needs-crate-type: bin, cdylib, dylib, lib, proc-macro, rlib, staticlib"
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_ignore_auxiliary() {
|
||||
let config = cfg().build();
|
||||
assert!(check_ignore(&config, "//@ ignore-auxiliary"));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//@ ignore-test: this is not a test
|
||||
//@ ignore-auxiliary (used by `./main.rs`)
|
||||
|
||||
#[inline]
|
||||
pub fn some_aux_mod_function() -> i32 {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
//@ ignore-android
|
||||
//@ ignore-test: #128971
|
||||
|
||||
// FIXME: stepping with "next" in a debugger skips past end-of-scope drops
|
||||
//@ ignore-test (broken, see #128971)
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//@ ignore-test (auxiliary, used by other tests)
|
||||
//@ ignore-auxiliary (used by `./move-error-snippets.rs`)
|
||||
|
||||
macro_rules! aaa {
|
||||
($c:ident) => {{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//@ ignore-test (auxiliary, used by other tests)
|
||||
//@ ignore-auxiliary (used by `./two_files.rs`)
|
||||
|
||||
trait Foo { }
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
//@ ignore-test (auxiliary, used by other tests)
|
||||
//@ ignore-auxiliary (used by `./inner-cfg-non-inline-mod.rs`)
|
||||
|
||||
#![cfg_attr(all(), cfg(false))]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//@ ignore-test (auxiliary, used by other tests)
|
||||
//@ ignore-auxiliary (used by `./main.rs`)
|
||||
#![crate_type = "lib"]
|
||||
|
||||
macro_rules! underscore {
|
||||
|
|
|
@ -1 +1 @@
|
|||
//@ ignore-test not a test, auxiliary
|
||||
//@ ignore-auxiliary (used by `../../macro-expanded-mod.rs`)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
//@ ignore-test not a test, auxiliary
|
||||
//@ ignore-auxiliary (used by `../../macro-expanded-mod.rs`)
|
||||
|
||||
mod_decl!(bar);
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
//@ ignore-test this is not a test
|
||||
|
||||
macro_rules! m {
|
||||
() => { mod mod_file_not_owning_aux2; }
|
||||
}
|
||||
m!();
|
|
@ -1 +0,0 @@
|
|||
//@ ignore-test this is not a test
|
|
@ -1,3 +0,0 @@
|
|||
//@ ignore-test this is not a test
|
||||
|
||||
mod mod_file_not_owning_aux2;
|
|
@ -1,4 +1,4 @@
|
|||
//@ ignore-test auxiliary file for expansion-time.rs
|
||||
//@ ignore-auxiliary (used by `./expansion-time.rs`)
|
||||
|
||||
1
|
||||
2
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//@ ignore-test: not a test
|
||||
//@ ignore-auxiliary (used by `./root.rs`)
|
||||
|
||||
#[allow(tool::lint)]
|
||||
pub fn foo() {}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
//@ ignore-test: not a test
|
||||
//@ ignore-auxiliary (used by `./lint-pre-expansion-extern-module.rs`)
|
||||
|
||||
pub fn try() {}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
//@ ignore-test (auxiliary)
|
||||
|
||||
// Companion to allow-in-other-module.rs
|
||||
//@ ignore-auxiliary (used by `./allow-in-other-module.rs`)
|
||||
|
||||
// This should not warn.
|
||||
#![allow(not_a_real_lint)]
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
// ignore-test: this is not a test
|
||||
|
||||
1
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
// ignore-test: this is not a test
|
||||
|
||||
fn foo() { bar() }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//@ ignore-test auxiliary file for include-single-expr.rs
|
||||
//@ ignore-auxiliary (used by `./include-single-expr.rs`)
|
||||
|
||||
0
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//@ ignore-test auxiliary file for include-single-expr.rs
|
||||
//@ ignore-auxiliary (used by `./include-single-expr.rs`)
|
||||
|
||||
0
|
||||
10
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
//@ ignore-test -- this is an auxiliary file as part of another test.
|
||||
//@ ignore-auxiliary (used by `../issue-69838-mods-relative-to-included-path.rs`)
|
||||
|
||||
pub fn i_am_in_bar() {}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
//@ ignore-test -- this is an auxiliary file as part of another test.
|
||||
//@ ignore-auxiliary (used by `../issue-69838-mods-relative-to-included-path.rs`)
|
||||
|
||||
pub mod bar;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//@ ignore-test (auxiliary, used by other tests)
|
||||
//@ ignore-auxiliary (used by `../test.rs`)
|
||||
|
||||
macro_rules! m {
|
||||
() => { include!("file.txt"); }
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
//
|
||||
//@ ignore-test this is just a helper for the real test in this dir
|
||||
//@ ignore-auxiliary (used by `./missing_non_modrs_mod.rs`)
|
||||
|
||||
mod missing;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//@ ignore-test this is just a helper for the real test in this dir
|
||||
//@ ignore-auxiliary (used by `./missing_non_modrs_mod_inline.rs`)
|
||||
|
||||
mod inline {
|
||||
mod missing;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0583]: file not found for module `missing`
|
||||
--> $DIR/foo.rs:4:1
|
||||
--> $DIR/foo.rs:3:1
|
||||
|
|
||||
LL | mod missing;
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
//@ run-pass
|
||||
//@ ignore-test Not a test. Used by other tests
|
||||
//@ ignore-auxiliary (used by `./mod_file_with_path_attr.rs` and `mod_file.rs`)
|
||||
|
||||
pub fn foo() -> isize { 10 }
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
//@ ignore-test Not a test. Used by other tests
|
||||
//@ ignore-auxiliary (used by `./mod_file_correct_spans.rs`)
|
||||
|
||||
pub fn foo() -> isize { 10 }
|
||||
|
|
|
@ -1 +1 @@
|
|||
//@ ignore-test not a test. aux file
|
||||
//@ ignore-auxiliary (used by `./mod_file_disambig.rs`)
|
||||
|
|
|
@ -1 +1 @@
|
|||
//@ ignore-test not a test. aux file
|
||||
//@ ignore-auxiliary (used by `../mod_file_disambig.rs`)
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
//@ run-pass
|
||||
//
|
||||
//@ ignore-test: not a test, used by non_modrs_mods.rs
|
||||
//@ ignore-auxiliary (used by `./non_modrs_mods.rs`)
|
||||
|
||||
pub mod inner_modrs_mod;
|
||||
pub mod inner_foors_mod;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//@ ignore-test: not a test
|
||||
//@ ignore-auxiliary (used by `./non_modrs_mods_and_inline_mods.rs`)
|
||||
|
||||
pub mod y {
|
||||
pub mod z;
|
||||
|
|
|
@ -1 +1 @@
|
|||
//@ ignore-test: not a test
|
||||
//@ ignore-auxiliary (used by `../../../non_modrs_mods_and_inline_mods.rs`)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//@ ignore-test (auxiliary, used by other tests)
|
||||
//@ ignore-auxiliary (used by `./saturating-float-casts.rs` and `./saturating-float-casts-wasm.rs`)
|
||||
|
||||
// Tests saturating float->int casts. See u128-as-f32.rs for the opposite direction.
|
||||
//
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//@ ignore-test: this is an auxiliary file for circular-modules-main.rs
|
||||
//@ ignore-auxiliary (used by `./circular-modules-main.rs`)
|
||||
|
||||
#[path = "circular_modules_main.rs"]
|
||||
mod circular_modules_main;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//@ ignore-test: this is an auxiliary file for circular-module-with-doc-comment-issue-97589.rs
|
||||
//@ ignore-auxiliary (used by `./circular-module-with-doc-comment-issue-97589.rs`)
|
||||
|
||||
//! this comment caused the circular dependency checker to break
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
//@ run-pass
|
||||
//@ ignore-test Not a test. Used by issue-48508.rs
|
||||
//@ ignore-auxiliary (used by `./issue-48508.rs`)
|
||||
|
||||
pub fn other() -> f64 {
|
||||
let µ = 1.0;
|
||||
|
|
|
@ -1 +1 @@
|
|||
//@ ignore-test (auxiliary, used by other tests)
|
||||
//@ ignore-auxiliary (used by `./attributes-on-modules-fail.rs`)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//@ ignore-test (auxiliary, used by other tests)
|
||||
//@ ignore-auxiliary (used by `../inner-attr-non-inline-mod.rs`)
|
||||
|
||||
#![rustfmt::skip]
|
||||
#![print_attr]
|
||||
|
|
|
@ -1 +1 @@
|
|||
//@ ignore-test (auxiliary, used by other tests)
|
||||
//@ ignore-auxiliary (used by `../attributes-on-modules-fail.rs`)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//@ ignore-test (auxiliary, used by other tests)
|
||||
//@ ignore-auxiliary (used by `../../../pretty-print-hack-show.rs`)
|
||||
|
||||
#[derive(Print)]
|
||||
enum ProceduralMasqueradeDummyType {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//@ ignore-test (auxiliary, used by other tests)
|
||||
//@ ignore-auxiliary (used by `../../../pretty-print-hack-show.rs`)
|
||||
|
||||
#[derive(Print)]
|
||||
enum ProceduralMasqueradeDummyType {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//@ ignore-test (auxiliary, used by other tests)
|
||||
//@ ignore-auxiliary (used by `../../../pretty-print-hack/hide.rs`)
|
||||
|
||||
#[derive(Print)]
|
||||
enum ProceduralMasqueradeDummyType {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
//@ run-pass
|
||||
//@ ignore-test: not a test, used by backtrace-debuginfo.rs to test file!()
|
||||
//@ ignore-auxiliary (used by `./backtrace-debuginfo.rs` to test `file!()`)
|
||||
|
||||
#[inline(never)]
|
||||
pub fn callback<F>(f: F) where F: FnOnce((&'static str, u32)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue