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

mir-opt tests: run current target on --bless; enable --keep-stage-std #122257

Closed
wants to merge 1 commit into from

Conversation

Nadrieril
Copy link
Member

@Nadrieril Nadrieril commented Mar 9, 2024

Currently, ./x.py test tests/mir-opt runs only the tests for the current target, and ./x.py test tests/mir-opt --bless runs tests for a representative set of targets.

I find this confusing and not what I want: for one I never run tests without --bless because I prefer to look at a git diff. What I however like to do is pass --keep-stage-std when I'm working on the compiler; this doesn't work today with --bless because it tries a bunch of targets for which I don't have a built std.

In this PR, I make it so ./x.py test tests/mir-opt runs the same set of tests regardless of --bless. By default it runs a representative sample of targets, and if --keep-stage-std is set it only runs tests for the current target.

Fixes #122292

@rustbot
Copy link
Collaborator

rustbot commented Mar 9, 2024

r? @clubby789

rustbot has assigned @clubby789.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added 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 Mar 9, 2024
@Nadrieril Nadrieril added the A-testsuite Area: The testsuite used to check the correctness of rustc label Mar 9, 2024
@clubby789
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Mar 10, 2024

📌 Commit 047e17d has been approved by clubby789

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 Mar 10, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 10, 2024
…lubby789

mir-opt tests: don't run a different set on --bless; enable --keep-stage-std

Currently, `./x.py test tests/mir-opt` runs only the tests for the current target, and `./x.py test tests/mir-opt --bless` runs tests for a representative set of targets.

I find this confusing and not what I want: for one I never run tests without `--bless` because I prefer to look at a git diff. What I however like to do is pass `--keep-stage-std` when I'm working on the compiler; this doesn't work today with `--bless` because it tries a bunch of targets for which I don't have a built std.

In this PR, I make it so `./x.py test tests/mir-opt` runs the same set of tests regardless of `--bless`. By default it runs a representative sample of targets, and if `--keep-stage-std` is set it only runs tests for the current target.
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 10, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#121573 (unix_sigpipe: Add test for SIGPIPE disposition in child processes)
 - rust-lang#121754 ([bootstrap] Move the `split-debuginfo` setting to the per-target section)
 - rust-lang#122205 (ensure that sysroot is properly set for cross-targets)
 - rust-lang#122257 (mir-opt tests: don't run a different set on --bless; enable --keep-stage-std)
 - rust-lang#122272 (Subtree update of `rust-analyzer`)

Failed merges:

 - rust-lang#122108 (Add `target.*.runner` configuration for targets)

r? `@ghost`
`@rustbot` modify labels: rollup
@Nadrieril
Copy link
Member Author

Having seen #122292, I'm not sure this is a good idea anymore. For one, in CI we only want to run the test for the current target (I assume that was the original intent of the --bless check). For two, it appears the set of targets chosen here does not cover all the targets. I'll r- until someone can confirm

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 10, 2024
@RalfJung
Copy link
Member

RalfJung commented Mar 10, 2024

In this PR, I make it so ./x.py test tests/mir-opt runs the same set of tests regardless of --bless. By default it runs a representative sample of targets, and if --keep-stage-std is set it only runs tests for the current target.

As you noted, this decreases test coverage. So I don't think it is a good idea.
Also tying this to --keep-stage-std seems at least as surprising as the surprise you expressed in the PR description.

I think it is important that --bless uses a superset of the targets used without, but it doesn't have to be the same set. Can we "just" make sure that the host is always part of the target set for --bless?

Blessing with different targets is needed since MIR differs a lot between panic=abort and panic=unwind. So if you actually want to bless tests then you most likely do want to do it for more than just your host target. It is never useful to bless just the host target.

@@ -1568,6 +1568,7 @@ impl Step for MirOpt {
run(panic_abort_target);
}
} else {
// If we're keeping a std stage, only run tests for this target.
run(self.target);
Copy link
Member

Choose a reason for hiding this comment

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

My proposed patch would be to simply move this to before the if.

Alternatively we could enact a policy saying that only-x86_64 is not allowed in mir-opt, and generally making sure that the set of targets in the bless list above is covering all mir-opt tests. That would require tool support however.

Copy link
Member Author

Choose a reason for hiding this comment

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

It would be nice to have more targets here. At least have all targets that are run in CI

Copy link
Member Author

Choose a reason for hiding this comment

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

That would take forever though

@Nadrieril
Copy link
Member Author

Yeah ok, there are two changes then:

  • the "representative set of targets" that's used on --bless today is not representative enough. It should indeed include the current target at least;
  • by nature --keep-stage-std can only work for the current target, so it makes sense to only run the current target when that's on.

Let's keep the --bless switch, I understand its purpose now.

@Nadrieril Nadrieril changed the title mir-opt tests: don't run a different set on --bless; enable --keep-stage-std mir-opt tests: run current target on --bless; enable --keep-stage-std Mar 10, 2024
@Nadrieril
Copy link
Member Author

Oh, we can keep several stds at once apparently. I was entirely mistaken about --keep-stage-std then.

@Nadrieril
Copy link
Member Author

Alright, I'll make a different PR for your fix

@Nadrieril Nadrieril closed this Mar 10, 2024
@@ -1549,6 +1549,8 @@ impl Step for MirOpt {
})
};

run(self.target);

if builder.config.cmd.bless() {
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
if builder.config.cmd.bless() {
// Run more targets with `--bless`. But we always run the host target first, since some
// tests use very specific `only` clauses that are not covered by the target set below.
if builder.config.cmd.bless() {

@Nadrieril Nadrieril deleted the tweak-mir-opt-tests branch March 10, 2024 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

x.py test mir-opt --bless does not bless some tests
5 participants