Record failed tests with --record, and rerun them with --rerun#154586
Record failed tests with --record, and rerun them with --rerun#154586jdonszelmann wants to merge 4 commits intorust-lang:mainfrom
--record, and rerun them with --rerun#154586Conversation
|
This PR modifies If appropriate, please update |
|
r? @clubby789 rustbot has assigned @clubby789. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
I wouldn't make this configurable. What does |
It will warn, but treat it as if the file was empty.
Keeps it around forever, or at least until you |
9bd3be5 to
e5e9e3b
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
e5e9e3b to
28032e6
Compare
This comment has been minimized.
This comment has been minimized.
28032e6 to
a73b6b8
Compare
This comment has been minimized.
This comment has been minimized.
a73b6b8 to
740c441
Compare
If the |
|
This is purely a speculation I suppose, but I feel like I will often forget to use |
|
@WaffleLapkin as long as you don’t modify the compiler, compiletest will remember which tests succeeded the last time, so if you add ––failed it won’t take very long at all to regenerate that list. |
|
I agree with jyn here, shouldn't make such a big difference |
that is true I think. What do you expect the behavior to be? maybe if no file is found, and no paths are given, exit, but if some paths are explicitly given run the explicit ones? |
|
with a warning of course |
|
I think |
|
mhm, well that's the current behavior. Except the warning of course, that you passed --rerun with nothing to rerun. But I think that's nice |
|
cc @jieyouxu (you self assigned the other one, that one was in preparation for this one, also I figured out that bug for this one) |
|
I haven't looked at the full implementation yet, but why not always record failed tests? |
|
Because a later invocation might only rerun a subset of tests. Say you have this series of invocations: |
|
Sorry, always *except when using |
|
I still think it's a bad idea to always record: I want it to be explicit when this file gets overwritten. I might want to That's just an example, but in general what I want this feature to solve is that ignored tests get invalidated by rebuilding the compiler because of a change, something implicit. I want this recording to be explicit so you're in control of it. So you can even temporarily switch branches to try something out and come back and have your little set of tests that make your new feature break. The last part, about switching branches is a little idea I had: we could at some point, not now, try to integrate this with git and see if we can detect branch changes and warn when you overwrite or something. Or even write to a different file (without checking it into git) etc. but if we do logic like that, that's for later |
740c441 to
848602d
Compare
848602d to
bb19e7d
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@jieyouxu @clubby789 rebased on the other PR now that it's merged |
This comment has been minimized.
This comment has been minimized.
bb19e7d to
0e47a91
Compare
| let trimmed = line.as_str().trim(); | ||
| let without_revision = | ||
| trimmed.rsplit_once("#").map(|(before, _)| before).unwrap_or(&trimmed); | ||
| let without_suite_prefix = without_revision | ||
| .strip_prefix("[") | ||
| .and_then(|rest| rest.split_once("]")) | ||
| .map(|(_, after)| after.trim()) | ||
| .unwrap_or(without_revision); |
There was a problem hiding this comment.
Discussion [TEST-HARNESS-JSON 1/2]: hm I thought about this. This is kinda doing a weird thing of post-processing compiletest-emitted test names, so we introduce an implicit dependency on compiletest test name formatting, which I can't say I'm a huge fan of.
I guess this is not the end of the world...
The caveat is that bootstrap captures test harness JSON output to then post-render the outcome messages. This can be from:
- libtest JSON when e.g. cargo test is used on say some library crate or such,
- but it can also come from compiletest-emitted messages which are more "liberal" in how the concept of "test name" is used (that the test name can have a suite prefix or revision suffixes).
If we want to avoid taking on this implicit dependency, we probably will have to introduce separate variants for compiletest-emitted test outcome JSON versus that of libtest, which doesn't really feel that great IMO. That, or maybe we can introduce optional revision / test suite fields for the message variants (which will not be present from other libtest-emitted messages but will be for compiletest-emitted messages).
NB. this was not possible previously, because previously compiletest also shelled out to libtest test executor so compiletest don't have control over the libtest executor emitted libtest JSON message format. But now compiletest uses its own executor and emits emulated libtest JSON messages. So technically I think it might be possible to change the emitted JSON format.
cc @Zalathar (this may be of interest to you)
| const MAX_RERUN_PRINTS: usize = 10; | ||
|
|
||
| for line in lines { | ||
| let trimmed = line.as_str().trim(); |
There was a problem hiding this comment.
Suggestion [TEST-HARNESS-JSON 2/2]: I don't feel like hard-blocking this fuctionality on [TEST-HARNESS-JSON 1/2] considerations, but can you please leave a FIXME to consider changing the compiletest-emitted JSON message formats, and maybe change the failed-tests file to have like JSON lines that looks like
{ "suite": "ui", "path": "tests/ui/foo.rs" }
{ "suite": "run-make", "path": "tests/run-make/hello-world/rmake.rs" }| // If only `compiler` was passed, do not run this step. | ||
| // Instead the `Assemble` step will take care of compiling Rustc. | ||
| if run.builder.paths == vec![PathBuf::from("compiler")] { | ||
| if run.builder.paths(IsForRerunningTests::DontCare) == vec![PathBuf::from("compiler")] { |
There was a problem hiding this comment.
Discussion:
The last commit is a little awkward, but I think it's the best way to make it so that we first run all tests that have to be rerun, and then rerun tests passed through the cli.
I really do not like this viral complexity that cross-cuts all these test steps. Can we keep the rerun functionality simple, to only rerun the set of failed tests?
There was a problem hiding this comment.
hm, is it that complex? Cause I do really like doing x test --rerun tests/ui and using that to run a small part (that likely errors) first and then try everything
|
Reminder, once the PR becomes ready for a review, use |
0e47a91 to
71e6780
Compare
|
@rustbot review |
|
☔ The latest upstream changes (presumably #155253) made this pull request unmergeable. Please resolve the merge conflicts. |
View all comments
This adds two parameters to
x test:--recordWrites a file, by default
build/failed-tests, but this can be overwritten withwith a list of all tests that fail that run.
--rerunLooks for the failed-tests file, parse it, and attempt to rerun only those tests. No cli-arguments are necessary, i.e.
Will run all failed uitests. No need to pass tests/ui to the rerun invocation.
The last commit is a little awkward, but I think it's the best way to make it so that we first run all tests that have to be rerun, and then rerun tests passed through the cli.
This makes it so:
will first rerun failed tests, some of which may be uitests, if any fail it quits and reports failed tests, but if all pass it will run all normally passed tests. In other words, only if all previously-failed tests pass on the rerun, we then also run uitests.
Without the last commit, this would instead just run all uitests, since the failed tests form a subset of all uitests. I think that's less useful.