-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
bootstrap: Make ./x test compiler
actually run the compiler unit tests
#134919
Conversation
fn test_test_compiler() { | ||
let cmd = &["test", "compiler"].map(str::to_owned); | ||
let config = configure_with_args(cmd, &[TEST_TRIPLE_1], &[TEST_TRIPLE_1]); | ||
let cache = run_build(&config.paths.clone(), config); | ||
|
||
let compiler = cache.contains::<test::CrateLibrustc>(); | ||
let cranelift = cache.contains::<test::CodegenCranelift>(); | ||
let gcc = cache.contains::<test::CodegenGCC>(); | ||
|
||
assert_eq!((compiler, cranelift, gcc), (true, false, false)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have manually verified that this unit test fails before the change, and succeeds after the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also tried to write a unit test for ./x test rustc_codegen_cranelift
and ./x test compiler/rustc_codegen_cranelift
, to make sure this PR doesn't break them. But so far I haven't managed to get those tests to work, so for now I've just verified them by hand.
Explanation of the fix: When bootstrap tries to figure out which step is responsible for each command-line argument, it only allows one step to claim any argument. So to force This is the code that allows steps to claim arguments: rust/src/bootstrap/src/core/builder/mod.rs Lines 489 to 509 in c156614
|
be32f13
to
796835f
Compare
FTR, in my investigation, the root problem is potentially the concept of the
Both rust/src/bootstrap/src/core/build_steps/test.rs Lines 3406 to 3408 in 2061630
rust/src/bootstrap/src/core/build_steps/test.rs Lines 3530 to 3532 in 2061630
These test rust/src/bootstrap/src/core/builder/mod.rs Lines 925 to 926 in 2061630
When the cli receives the filter string rust/src/bootstrap/src/core/builder/mod.rs Lines 465 to 475 in 2061630
Instead, the Codegen{Cranelift,Gcc} test rust/src/bootstrap/src/core/builder/mod.rs Lines 489 to 490 in 2061630
Indeed, if you inject some printf logging, you can see how the
Why does moving
So now Ok. Now you may ask: how does #133492 regress I'm also only describing why this is a problem, I don't quite have a good solution in mind just yet. (Also I'm not sure why there's a specific distinction of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In any case, this is a sufficient fix for the basic workflow of testing the compiler unit crates. Thanks.
@bors r+ rollup |
bootstrap: Make `./x test compiler` actually run the compiler unit tests Fixes rust-lang#134916.
Rollup of 7 pull requests Successful merges: - rust-lang#133461 (Add COPYRIGHT-*.html files to distribution and update `COPYRIGHT`) - rust-lang#134919 (bootstrap: Make `./x test compiler` actually run the compiler unit tests) - rust-lang#134927 (Make slice::as_flattened_mut unstably const) - rust-lang#134930 (ptr docs: make it clear that we are talking only about memory accesses) - rust-lang#134932 (explicitly set float ABI for all ARM targets) - rust-lang#134934 (Fix typos) - rust-lang#134941 (compiler: Add a statement-of-intent to `rustc_abi`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 8 pull requests Successful merges: - rust-lang#134919 (bootstrap: Make `./x test compiler` actually run the compiler unit tests) - rust-lang#134927 (Make slice::as_flattened_mut unstably const) - rust-lang#134930 (ptr docs: make it clear that we are talking only about memory accesses) - rust-lang#134932 (explicitly set float ABI for all ARM targets) - rust-lang#134933 (Make sure we check the future type is `Sized` in `AsyncFn*`) - rust-lang#134934 (Fix typos) - rust-lang#134941 (compiler: Add a statement-of-intent to `rustc_abi`) - rust-lang#134949 (Convert some `Into` impls into `From` impls) r? `@ghost` `@rustbot` modify labels: rollup
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.
Signed-off-by: onur-ozkan <[email protected]>
Signed-off-by: onur-ozkan <[email protected]>
Fixes #134916.