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

Fix rustdoc gui tester #112962

Merged
merged 3 commits into from
Jun 23, 2023
Merged

Conversation

GuillaumeGomez
Copy link
Member

@GuillaumeGomez GuillaumeGomez commented Jun 23, 2023

Problem was that the main was always exiting with 0, whether or not there was an error. It led to failing GUI tests being ignored in the CI since no one saw them.

r? @klensy

@rustbot
Copy link
Collaborator

rustbot commented Jun 23, 2023

Failed to set assignee to klensy: invalid assignee

Note: Only org members, users with write permissions, or people who have commented on the PR may be assigned.

@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) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jun 23, 2023
@GuillaumeGomez
Copy link
Member Author

r? @ozkanonur

try_run(&mut cargo, config.verbose);
if !try_run(&mut cargo, config.verbose) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at cause if this bug, i want to slap must_use over try_run and find all similar places.

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's a good idea. Doing that shortly.

@@ -158,5 +161,5 @@ If you want to install the `browser-ui-test` dependency, run `npm install browse

command.args(&config.test_args);

try_run(&mut command, config.verbose);
if try_run(&mut command, config.verbose) { Ok(()) } else { Err(()) }
Copy link
Member

Choose a reason for hiding this comment

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

What about using assert! with a simple error message on all try_run usages?

Copy link
Member Author

Choose a reason for hiding this comment

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

The error message would be less good because of the panic. I think try_run should return a Result instead of a boolean. Impossible to ignore it this way.

@onur-ozkan
Copy link
Member

r=me with adding must_use on try_run

@GuillaumeGomez
Copy link
Member Author

Like I said above, instead of relying on #[must_use], I instead made try_run return a Result<(), ()> so the type system itself prevents the returned value to be ignored.

@GuillaumeGomez GuillaumeGomez force-pushed the fix-rustdoc-gui-tester branch from 0fd01a4 to 9a78945 Compare June 23, 2023 14:43
@onur-ozkan
Copy link
Member

Like I said above, instead of relying on #[must_use], I instead made try_run return a Result<(), ()> so the type system itself prevents the returned value to be ignored.

I thought you wouldn't want to do it in this PR. This is even better. Thanks a lot!

Will queue the PR once CI is green

@rust-log-analyzer

This comment has been minimized.

@GuillaumeGomez GuillaumeGomez force-pushed the fix-rustdoc-gui-tester branch from 9a78945 to 7b55779 Compare June 23, 2023 15:07
@onur-ozkan
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jun 23, 2023

📌 Commit 7b55779 has been approved by ozkanonur

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 Jun 23, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 23, 2023
…ter, r=ozkanonur

Fix rustdoc gui tester

Problem was that the `main` was always exiting with `0`, whether or not there was an error. It led to failing GUI tests being ignored in the CI since no one saw them.

r? `@klensy`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 23, 2023
…ter, r=ozkanonur

Fix rustdoc gui tester

Problem was that the `main` was always exiting with `0`, whether or not there was an error. It led to failing GUI tests being ignored in the CI since no one saw them.

r? ``@klensy``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 23, 2023
…ter, r=ozkanonur

Fix rustdoc gui tester

Problem was that the `main` was always exiting with `0`, whether or not there was an error. It led to failing GUI tests being ignored in the CI since no one saw them.

r? ```@klensy```
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 23, 2023
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#112616 (Improve tests on targets without unwinding)
 - rust-lang#112643 (Always register sized obligation for argument)
 - rust-lang#112740 (Add link to rustdoc book search chapter in help popover)
 - rust-lang#112810 (Don't ICE on unnormalized struct tail in layout computation)
 - rust-lang#112870 (Migrate `item_bounds` to `ty::Clause`)
 - rust-lang#112925 (Stop hiding const eval limit in external macros)
 - rust-lang#112960 ([tests/rustdoc] Add `@files` command)
 - rust-lang#112962 (Fix rustdoc gui tester)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9d7f297 into rust-lang:master Jun 23, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jun 23, 2023
@GuillaumeGomez GuillaumeGomez deleted the fix-rustdoc-gui-tester branch June 24, 2023 10:29
Comment on lines -42 to +53
fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> bool {
fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> Result<(), ()> {
if !builder.fail_fast {
if !builder.try_run(cmd) {
if let Err(e) = builder.try_run(cmd) {
let mut failures = builder.delayed_failures.borrow_mut();
failures.push(format!("{:?}", cmd));
return false;
return Err(e);
}
} else {
builder.run(cmd);
}
true
Ok(())
Copy link
Member

Choose a reason for hiding this comment

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

this function should not have changed. now fail_fast is broken because anything calling try_run will panic immediately instead of waiting for all other steps to finish running.

Comment on lines +51 to +61
fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> Result<(), ()> {
if !builder.fail_fast {
if !builder.try_run(cmd) {
if let Err(e) = builder.try_run(cmd) {
let mut failures = builder.delayed_failures.borrow_mut();
failures.push(format!("{:?}", cmd));
return false;
return Err(e);
}
} else {
builder.run(cmd);
}
true
Ok(())
Copy link
Member

Choose a reason for hiding this comment

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

this also doesn't look right and no longer respects fail_fast.

bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 12, 2023
…nur,jyn514

Don't fail early if `try_run` returns an error

Fixes rust-lang#113208.

Follow-up of rust-lang#112962.

r? `@jyn514`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants