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

Run rustdoc-gui tests in parallel #86692

Merged
merged 8 commits into from
Aug 15, 2021

Conversation

dns2utf8
Copy link
Contributor

I hid the passing tests and only show the failed ones in alphabetical order:
image

Also this PR cuts down the execution time from ~40 to ~9 seconds

@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 28, 2021
@dns2utf8
Copy link
Contributor Author

I extracted this from #86594 with @GuillaumeGomez

}
function print_test_erroneous() {
// Bold Red "F" Reset
process.stdout.write("\033[1m\x1b[31mF\x1b[0m");
Copy link
Member

Choose a reason for hiding this comment

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

That might work well for linux, but not on windows at all. ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wished that JavsScript had #[cfg(unix)] ...

Copy link
Member

Choose a reason for hiding this comment

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

If that's the only thing you wished js had, I guess it's fine. 😉

For now, just keep it simple and simply print text.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found an easy way to detect linux at runtime and enable the colour, what do you think?

Copy link
Member

@GuillaumeGomez GuillaumeGomez Jul 1, 2021

Choose a reason for hiding this comment

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

I think it's completely beyond scope. I'd rather keep it as simple as possible. Please simply print the text (on stderr if it's an error).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done 👍

}
}).catch(err => {
console.error(err);
error_outputs += err + "\n";
Copy link
Member

Choose a reason for hiding this comment

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

Instead of putting everything into one string, it would maybe be better to keep an array of the tests and have some info for each, like output, errors, etc...

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Jun 28, 2021

I also think we should disable running checks in parallel when --no-headless is used (take a look at src/test/rustdoc-gui/README.md to see how to use it).

@Mark-Simulacrum Mark-Simulacrum 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-review Status: Awaiting review from the assignee but also interested parties. labels Jun 28, 2021
@dns2utf8
Copy link
Contributor Author

I implemented sequential execution if the --no-headless flag is present.

However, I was unable to make it run with ./x.py:

./x.py test --stage 1 --jobs 8 --no-headless --debug rustdoc-gui

Updating only changed submodules
Submodules updated in 0.03 seconds
    Finished dev [unoptimized + debuginfo] target(s) in 0.15s

Unrecognized option: 'no-headless'

Usage: x.py <subcommand> [options] [<paths>...]
...

@dns2utf8
Copy link
Contributor Author

Regarding ordering the logs, I perallocate an Array now that the async tests fill with a result object. This can happen in order with the --no-headless flag or out of order without it.

The output then remains sorted with the exception of execution errors, which are at the end because I wanted people working with them to see them at the end of the output where they should be simpler to spot.
That just an idea I had and we can change it to just sorted output

@GuillaumeGomez
Copy link
Member

I implemented sequential execution if the --no-headless flag is present.

However, I was unable to make it run with ./x.py:

./x.py test --stage 1 --jobs 8 --no-headless --debug rustdoc-gui

Updating only changed submodules
Submodules updated in 0.03 seconds
    Finished dev [unoptimized + debuginfo] target(s) in 0.15s

Unrecognized option: 'no-headless'

Usage: x.py <subcommand> [options] [<paths>...]
...

Look here how to pass arguments to the tester through x.py.

@dns2utf8 dns2utf8 force-pushed the parallelize_rustdoc-gui_tests branch from d5b4f1b to 74ed2b2 Compare July 1, 2021 14:00
@dns2utf8 dns2utf8 force-pushed the parallelize_rustdoc-gui_tests branch from 74ed2b2 to dc61d6c Compare July 1, 2021 14:15
@dns2utf8 dns2utf8 force-pushed the parallelize_rustdoc-gui_tests branch from bff8e1d to fa0c7a5 Compare July 1, 2021 14:37
@dns2utf8 dns2utf8 force-pushed the parallelize_rustdoc-gui_tests branch from 591be15 to c17628b Compare August 9, 2021 22:47
await tests[i];
}
}
await Promise.all(tests);
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't it be:

Suggested change
await Promise.all(tests);
if (!no_headless) {
await Promise.all(tests);
}

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Logic wise kind of yes. But you can await a future multiple times, the work will get done only once

}
await Promise.all(tests);
// final \n after the tests
console.log("\n");
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't it be:

Suggested change
console.log("\n");
console.log("");

? Or do you specifically want an empty line?

Copy link
Member

Choose a reason for hiding this comment

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

If so, maybe better to use two console.log("") instead I think. No strong opinion though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted a bit more separation between the sections for readability so the progress bar is visually spaced from the outputs.
The output should be the same on all platforms because we don't write anything on the empty line but fully correct it should be two console.log(""), will change that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Replaced it with a better finish method that prints the final stats

Copy link
Member

@GuillaumeGomez GuillaumeGomez left a comment

Choose a reason for hiding this comment

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

A few questions to be answered but otherwise it looks really promising!

@dns2utf8
Copy link
Contributor Author

I am using os.EOL now for the line endings. Also the status_bar now has a finish function that aligns the last progress bar.

Here is an example run with two failed tests and --debug:
image

And here is one without:
image

One small question for me is how many characters do we want per line? Currently I picked 10, but this is arbitrary and maybe a bit low?

@GuillaumeGomez
Copy link
Member

One small question for me is how many characters do we want per line? Currently I picked 10, but this is arbitrary and maybe a bit low?

Other test-suites use 100 but I don't care. We can always update it later. Looks all good to me now, thanks a lot!

@bors: r+

@bors
Copy link
Contributor

bors commented Aug 15, 2021

📌 Commit 7f2b52b has been approved by GuillaumeGomez

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 15, 2021
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 15, 2021
…sts, r=GuillaumeGomez

Run rustdoc-gui tests in parallel

I hid the passing tests and only show the failed ones in alphabetical order:
![image](https://user-images.githubusercontent.com/739070/123663020-84e63100-d825-11eb-9b35-0a8c30cd219c.png)

Also this PR cuts down the execution time from ~40 to ~9 seconds
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 15, 2021
…sts, r=GuillaumeGomez

Run rustdoc-gui tests in parallel

I hid the passing tests and only show the failed ones in alphabetical order:
![image](https://user-images.githubusercontent.com/739070/123663020-84e63100-d825-11eb-9b35-0a8c30cd219c.png)

Also this PR cuts down the execution time from ~40 to ~9 seconds
This was referenced Aug 15, 2021
@bors
Copy link
Contributor

bors commented Aug 15, 2021

⌛ Testing commit 7f2b52b with merge 58d685e...

@Mark-Simulacrum
Copy link
Member

Is this respecting -j passed to x.py somehow? We should avoid running multiple processes if -j1 is passed, for example.

@bors
Copy link
Contributor

bors commented Aug 15, 2021

☀️ Test successful - checks-actions
Approved by: GuillaumeGomez
Pushing 58d685e to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 15, 2021
@bors bors merged commit 58d685e into rust-lang:master Aug 15, 2021
@rustbot rustbot added this to the 1.56.0 milestone Aug 15, 2021
@GuillaumeGomez
Copy link
Member

@Mark-Simulacrum Good point. I'll open an issue for it.

@dns2utf8 dns2utf8 deleted the parallelize_rustdoc-gui_tests branch August 16, 2021 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants