Skip to content

Conversation

GuillaumeGomez
Copy link
Member

Based on errors in #146414, some tests with LLVM-specific options are run when another codegen is actually the one used.

This PR ignores these tests in such cases now to prevent this situation.

r? @Kobzol

@rustbot
Copy link
Collaborator

rustbot commented Sep 16, 2025

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Sep 16, 2025
@GuillaumeGomez GuillaumeGomez changed the title Do not run ui test if options specific to llvm are used when another codegen backend is used Do not run ui test if options specific to LLVM are used when another codegen backend is used Sep 16, 2025
@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez GuillaumeGomez force-pushed the backend-run-llvm-options branch from f2b78ae to 2c13435 Compare September 16, 2025 02:50
@GuillaumeGomez
Copy link
Member Author

And fixed fmt.

Copy link
Member

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left two nits.

View changes since this review

name: "needs-enzyme",
condition: config.has_enzyme,
condition: config.has_enzyme && config.default_codegen_backend.is_llvm(),
ignore_reason: "ignored when LLVM Enzyme is disabled",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ignore_reason: "ignored when LLVM Enzyme is disabled",
ignore_reason: "ignored when LLVM Enzyme is disabled or LLVM is not the default codegen backend",

name: "needs-llvm-zstd",
condition: cache.llvm_zstd,
condition: cache.llvm_zstd && config.default_codegen_backend.is_llvm(),
ignore_reason: "ignored if LLVM wasn't build with zstd for ELF section compression",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ignore_reason: "ignored if LLVM wasn't build with zstd for ELF section compression",
ignore_reason: "ignored if LLVM wasn't build with zstd for ELF section compression or LLVM is not the default codegen backend",

@GuillaumeGomez GuillaumeGomez force-pushed the backend-run-llvm-options branch from 2c13435 to a535042 Compare September 16, 2025 15:48
@GuillaumeGomez
Copy link
Member Author

Done!

@bors r=kobzol rollup

@bors
Copy link
Collaborator

bors commented Sep 16, 2025

📌 Commit a535042 has been approved by kobzol

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 16, 2025
bors added a commit that referenced this pull request Sep 16, 2025
Rollup of 5 pull requests

Successful merges:

 - #146442 (Display ?Sized, const, and lifetime parameters in trait item suggestions across a crate boundary)
 - #146474 (Improve `core::ascii` coverage)
 - #146605 (Bump rustfix 0.8.1 -> 0.8.7)
 - #146611 (bootstrap: emit hint if a config key is used in the wrong section)
 - #146618 (Do not run ui test if options specific to LLVM are used when another codegen backend is used)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit cf03552 into rust-lang:master Sep 17, 2025
10 checks passed
rust-timer added a commit that referenced this pull request Sep 17, 2025
Rollup merge of #146618 - GuillaumeGomez:backend-run-llvm-options, r=kobzol

Do not run ui test if options specific to LLVM are used when another codegen backend is used

Based on errors in #146414, some tests with LLVM-specific options are run when another codegen is actually the one used.

This PR ignores these tests in such cases now to prevent this situation.

r? `@kobzol`
@rustbot rustbot added this to the 1.92.0 milestone Sep 17, 2025
@GuillaumeGomez GuillaumeGomez deleted the backend-run-llvm-options branch September 18, 2025 20:22
Comment on lines +282 to +285
if config.default_codegen_backend.is_llvm() {
return IgnoreDecision::Continue;
}
return IgnoreDecision::Ignore { reason: "LLVM specific test".into() };
Copy link
Member

@workingjubilee workingjubilee Oct 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not correct. needs-llvm-components is only informational so that the test is elided if the target cannot be built for using the available LLVM components. Many of these are x86 targets that we should be able to test using cg_gcc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In particular, needs-llvm-components is commonly used for gnarly target-specific tests that we set up with no_core so they can run on all targets; we then need to tell compiletest about that so that it knows whether building for this target is possible at all. None of these are backend-specific.

Those are never "run" tests since obviously we can't run random binaries for a different target, so most of codegen is not relevant. However, tests like tests/ui/target-feature/abi-incompatible-target-feature-flag-enable.rs and its brethren are still crucial to run for all codegen backends since a bunch of the target feature logic lives inside the backends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants