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

Running ./x test compiler only runs unit tests for rustc_codegen_cranelift #134916

Closed
Zalathar opened this issue Dec 30, 2024 · 8 comments · Fixed by #134919
Closed

Running ./x test compiler only runs unit tests for rustc_codegen_cranelift #134916

Zalathar opened this issue Dec 30, 2024 · 8 comments · Fixed by #134919
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@Zalathar
Copy link
Contributor

In theory, this command should run cargo test for all of the compiler crates in compiler/:

# (stage 0 isn't essential, but it's faster than using a later stage)
./x test compiler --stage=0

Instead, it just prints this message and exits successfully:

cranelift not in rust.codegen-backends. skipping

This seems to be because test::CodegenCranelift::should_run registers compiler/rustc_codegen_cranelift as its path, which has the side-effect of hijacking compiler in bootstrap's wacky path-resolution logic. That prevents test::CrateLibrustc from running, which is what would run the unit tests for the vast majority of compiler crates.

The same problem is also theoretically present for test::CodegenGCC, though currently the cranelift step takes priority for whatever reason.

@Zalathar Zalathar added A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Dec 30, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 30, 2024
@jieyouxu jieyouxu added C-bug Category: This is a bug. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Dec 30, 2024
@lqd
Copy link
Member

lqd commented Dec 30, 2024

Is this only locally or are tests now also ignored on CI? This must be a somewhat recent regression, I remember this working before; some bisection would be good I guess.

@Zalathar

This comment has been minimized.

@Zalathar
Copy link
Contributor Author

Is this only locally or are tests now also ignored on CI? This must be a somewhat recent regression, I remember this working before; some bisection would be good I guess.

I think this only affects manually running ./x test compiler; jobs that just do ./x test and rely on the defaults should be unaffected.

@Zalathar
Copy link
Contributor Author

I haven't done a bisection, but based on my fix, it seems likely that this has been broken ever since cg_clif tests were added to bootstrap.

@jyn514
Copy link
Member

jyn514 commented Dec 30, 2024

This seems to be because test::CodegenCranelift::should_run registers compiler/rustc_codegen_cranelift as its path, which has the side-effect of hijacking compiler in bootstrap's wacky path-resolution logic

i suspect this is a new regression since bootstrap started supporting prefixes as well as suffixes. cc #133492, @MarcoIeni

@MarcoIeni
Copy link
Member

Is this only locally or are tests now also ignored on CI?

In CI we run tests with the --skip mechanism. So maybe this bug doesn't affect CI.

i suspect this is a new regression since bootstrap started supporting prefixes as well as suffixes. cc #133492, @MarcoIeni

It might be! (I haven't understood the bug completely, I just checked this issue quickly).
Hopefully the bisection process will verify this 👍

A quick remediation might be only applying the login introduced in that PR only to --skip maybe.

@jieyouxu
Copy link
Member

It might be! (I haven't understood the bug completely, I just checked this issue quickly).

Having PathSet::check also match on prefixes in addition to suffixes might be somewhat problematic, see #134919 (comment) for more detailed explanation.

Zalathar added a commit to Zalathar/rust that referenced this issue Dec 31, 2024
bootstrap: Make `./x test compiler` actually run the compiler unit tests

Fixes rust-lang#134916.
@Zalathar
Copy link
Contributor Author

I can confirm that reverting #133492 seems to fix this, without having to reorder the test steps as in #134919 (though there's no harm in reordering them either, so it's fine for that PR to land).

So this suggests that a revert would probably be a good idea in the short term, though we would want @MarcoIeni 's input on how to avoid breaking #134427.

@bors bors closed this as completed in a777f4a Dec 31, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Dec 31, 2024
Rollup merge of rust-lang#134919 - Zalathar:x-test-compiler, r=jieyouxu

bootstrap: Make `./x test compiler` actually run the compiler unit tests

Fixes rust-lang#134916.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants