Skip to content

--exclude is broken for individual files #96342

Closed
@jyn514

Description

@jyn514
$ x t src/test/ui --exclude src/test/ui
Skipping Suite(test::src/test/ui) because it is excluded
Skipping Suite(test::src/test/ui) because it is excluded
$ x t src/test/ui/attr-start.rs --exclude src/test/ui/attr-start.rs
Check compiletest suite=ui mode=ui (x86_64-unknown-linux-gnu(x86_64-unknown-linux-gnu) -> x86_64-unknown-linux-gnu(x86_64-unknown-linux-gnu))

running 1 test
.
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 12951 filtered out; finished in 0.09s

This is harder to fix than it looks - if you try something simple like

diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 0c4f3265dbf..e0acf20ae48 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -225,8 +225,8 @@ fn maybe_run(&self, builder: &Builder<'_>, pathset: &PathSet) {
         }
     }
 
-    fn is_excluded(&self, builder: &Builder<'_>, pathset: &PathSet) -> bool {
-        if builder.config.exclude.iter().any(|e| pathset.has(&e.path, e.kind)) {
+    fn is_excluded(&self, builder: &Builder<'_>, pathset: &PathSet, should_run: &ShouldRun) -> bool {
+        if builder.config.exclude.iter().any(|e| pathset.has(&e.path, e.kind) || should_run.is_suite_path(&e.path).is_some()) {
             eprintln!("Skipping {:?} because it is excluded", pathset);
             return true;
         }

you end up skipping the whole suite:

Skipping Suite(test::src/test/ui) because it is excluded
Skipping Suite(test::src/test/ui) because it is excluded

I think the proper fix for this involves adding support in compiletest itself :( by passing --exclude p for each is_valid_test_suite_arg in config.exclude.

@rustbot label +A-rustbuild +A-testsuite +C-bug +E-hard

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-testsuiteArea: The testsuite used to check the correctness of rustcC-bugCategory: This is a bug.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions