Skip to content

Commit 026d56b

Browse files
authored
Rollup merge of rust-lang#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: - rust-lang#139705 - rust-lang#139783 - rust-lang#139740 See also discussions in: - [#t-compiler > Directive name for non-test aux files?](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Directive.20name.20for.20non-test.20aux.20files.3F/with/512773817) - [#t-compiler > Handling disabled &rust-lang#96;//@ ignore-test&rust-lang#96; tests](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Handling.20disabled.20.60.2F.2F.40.20ignore-test.60.20tests/with/512005974) - [#t-compiler/meetings > &rust-lang#91;steering&rust-lang#93; 2025-04-11 Dealing with disabled tests](https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bsteering.5D.202025-04-11.20Dealing.20with.20disabled.20tests/with/511717981) ### Remarks on remaining unconditionally disabled tests under `tests/` After this PR, against commit 79a272c, 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 rust-lang#128971) tests/rustdoc/macro-document-private-duplicate.rs 1://@ ignore-test (fails spuriously, see issue rust-lang#89228) tests/rustdoc/inline_cross/assoc-const-equality.rs 3://@ ignore-test (FIXME: rust-lang#125092) tests/ui/match/issue-27021.rs 7://@ ignore-test (rust-lang#54987) tests/ui/match/issue-26996.rs 7://@ ignore-test (rust-lang#54987) tests/ui/issues/issue-49298.rs 9://@ ignore-test (rust-lang#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 (rust-lang#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 rust-lang#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 rust-lang#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
2 parents 8b7a289 + 6c5a481 commit 026d56b

File tree

48 files changed

+56
-60
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+56
-60
lines changed

src/doc/rustc-dev-guide/src/tests/best-practices.md

Lines changed: 2 additions & 0 deletions

src/doc/rustc-dev-guide/src/tests/directives.md

Lines changed: 3 additions & 0 deletions

src/tools/compiletest/src/directive-list.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
4444
"ignore-arm-unknown-linux-gnueabihf",
4545
"ignore-arm-unknown-linux-musleabi",
4646
"ignore-arm-unknown-linux-musleabihf",
47+
"ignore-auxiliary",
4748
"ignore-avr",
4849
"ignore-beta",
4950
"ignore-cdb",

src/tools/compiletest/src/header/cfg.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ fn parse_cfg_name_directive<'a>(
100100
name: "test",
101101
message: "always"
102102
}
103+
condition! {
104+
name: "auxiliary",
105+
message: "used by another main test file"
106+
}
103107
condition! {
104108
name: &config.target,
105109
allowed_names: &target_cfgs.all_targets,

src/tools/compiletest/src/header/tests.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,3 +940,9 @@ fn test_supported_crate_types() {
940940
"//@ needs-crate-type: bin, cdylib, dylib, lib, proc-macro, rlib, staticlib"
941941
));
942942
}
943+
944+
#[test]
945+
fn test_ignore_auxiliary() {
946+
let config = cfg().build();
947+
assert!(check_ignore(&config, "//@ ignore-auxiliary"));
948+
}

tests/codegen/remap_path_prefix/aux_mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test: this is not a test
1+
//@ ignore-auxiliary (used by `./main.rs`)
22

33
#[inline]
44
pub fn some_aux_mod_function() -> i32 {

tests/debuginfo/drop-locations.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//@ ignore-android
2-
//@ ignore-test: #128971
2+
3+
// FIXME: stepping with "next" in a debugger skips past end-of-scope drops
4+
//@ ignore-test (broken, see #128971)
35

46
#![allow(unused)]
57

tests/ui/borrowck/move-error-snippets-ext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test (auxiliary, used by other tests)
1+
//@ ignore-auxiliary (used by `./move-error-snippets.rs`)
22

33
macro_rules! aaa {
44
($c:ident) => {{

tests/ui/codemap_tests/two_files_data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@ ignore-test (auxiliary, used by other tests)
1+
//@ ignore-auxiliary (used by `./two_files.rs`)
22

33
trait Foo { }
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
//@ ignore-test (auxiliary, used by other tests)
1+
//@ ignore-auxiliary (used by `./inner-cfg-non-inline-mod.rs`)
22

33
#![cfg_attr(all(), cfg(false))]

0 commit comments

Comments
 (0)