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

Rustdoc gui tests #79979

Merged
merged 4 commits into from
Feb 22, 2021
Merged

Rustdoc gui tests #79979

merged 4 commits into from
Feb 22, 2021

Conversation

GuillaumeGomez
Copy link
Member

@GuillaumeGomez GuillaumeGomez commented Dec 12, 2020

This is a reopening of #70533.

For this first version, there will be no screenshot comparison. Also, a big change compared to the previous version: the tests are now hosted in the rust repository directly. Since there is no image, it's pretty lightweight to say the least.

So now, only remains the nodejs script to run the tests and the tests themselves. Just one thing is missing: where should I put the documentation for these tests? I'm not sure where would be the best place for that. The doc will contain important information like the documentation of the framework used and how to install it (npm install browser-ui-test, but still needs to be put somewhere so no one is lost).

We'd also need to install the package when running the CI too. For now, it runs as long as we have nodejs installed, but I think we don't it to run in all nodejs targets?

cc @jyn514

r? @Mark-Simulacrum

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 12, 2020
@GuillaumeGomez
Copy link
Member Author

Also: weird CI failure...

@jyn514
Copy link
Member

jyn514 commented Dec 12, 2020

where should I put the documentation for these tests?

I think either a README in the directory they're in, or in the dev-guide would be a good place. Possibly one could link to the other.

@jyn514 jyn514 added A-rustdoc-ui Area: rustdoc UI (generated HTML) A-testsuite Area: The testsuite used to check the correctness of rustc T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Dec 12, 2020
@Mark-Simulacrum
Copy link
Member

I am still a little uncertain about the approach here of needing a JS out-of-tree dependency expected to be installed through nodejs/npm; I definitely think this cannot land without some amount of published documentation on how to update these tests. I am a bit worried that it's going to be a significant increase in the overhead for contributors to rustdoc (needing a JS toolchain installed to test things locally), but I could be wrong about that. Ultimately that's a T-rustdoc decision, I suppose.

The comment I left should hopefully fix CI.

@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 Dec 12, 2020
@GuillaumeGomez
Copy link
Member Author

We can clone the framework too. I don't have much preference for a solution, just thought that it might be simpler to use npm to do so. In the previous version, it's true that we cloned the repository inside bootstrap script and then run it. So whatever way you prefer.

@Mark-Simulacrum
Copy link
Member

Even cloning the framework presumably doesn't decouple us from needing the JS toolchain though? I think that's my primary concern. If it's just nodejs that's not too bad, but I'm a bit worried about running npm install mid-build.

@GuillaumeGomez
Copy link
Member Author

GuillaumeGomez commented Dec 14, 2020

Then let's go for a submodule. Like that at least we'll know what's going on and no need for npm.

@GuillaumeGomez
Copy link
Member Author

To make things a bit simpler to track down, I made the browser-UI-test into a submodule instead of relying completely on npm. However, we still need to install puppeteer and pngjs with npm. Another concern that @Mark-Simulacrum had was that the test suite would be run too often, so to prevent this to happen, I added the following checks:

  • You need both npm and nodejs to be installed
  • You need the browser-UI-test dependencies to be installed (through npm) as well

In case only the second condition isn't respected, a warning is displayed.

The last commit is the CI update. I took the changes mostly from #70533 but we'll still need to have @Mark-Simulacrum to confirm them. :)

So once everything else has been validated, I'll add the documentation.

@Mark-Simulacrum
Copy link
Member

If we're going to require npm anyway I see no reason for the submodule I think? We probably want to put the lockfile in git though...

@GuillaumeGomez
Copy link
Member Author

That's the thing: either we put a lockfile in rust repository, or we keep the submodule and use its own lockfile. One way or another, it's fine by me. Maybe you have an opinion @jyn514 ?

@Mark-Simulacrum
Copy link
Member

I have several requirements:

  • we should use published (to npm or crates.io etc) deps or rust-lang repositories in submodules, to help ensure they don't go away on us; regardless a lockfile of some kind should exist.
  • it should be easy to ensure that the test here is run by CI (e.g. minimal checking for just node is fine); if we start checking for the presence of multiple binaries I'd rather just gate on a new config.toml option

It's up to the rustdoc team whether you think this requirement is a reasonable ask of contributors - it seems like a high bar to me, but maybe editing these tests is rare and not too worrisome.

I will take a look at this PR's implementation soon.

@GuillaumeGomez
Copy link
Member Author

These tests are mostly for me. To be more precise: I spend most of my time fixing GUI issues and I'd that to slow down quite a lot. So unless someone is changing the front-end, they don't need to run this test suite, and even if they do, I'm pretty sure in most cases there won't be an issue (but if there is one, the CI will tell us, finally!).

@rust-log-analyzer

This comment has been minimized.

@jyn514
Copy link
Member

jyn514 commented Dec 15, 2020

@GuillaumeGomez that's not how testing works, though. CI can fail on anyone's changes, not just yours. The scenario is someone does make changes and either needs to add a new test or an existing test fails.

That said, I think if we print "run npm install x" if the package isn't installed, that's good enough - I'd expect anyone modifying the frontend to at least be familiar with npm even if it's not currently installed.

@GuillaumeGomez
Copy link
Member Author

I maybe badly tried to explain my point of view. The idea was "if you broke the GUI tests, you very likely know how npm works". 😄

@GuillaumeGomez
Copy link
Member Author

@Mark-Simulacrum I might need help for the CI scripts update (not too sure what to change here without breaking everything...). So whenever you have time, it'd be super appreciated! :)

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 15, 2020
@Mark-Simulacrum
Copy link
Member

I think this is still adding a submodule which seems like the wrong approach. I would expect us to use browser-ui-test just like we expect e.g. a C compiler to be installed to run this test. I presume that it can be readily installed by contributors via npm or so?

@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 Dec 23, 2020
@GuillaumeGomez
Copy link
Member Author

Hmmm... Well, it doesn't hurt to have package.json and package-lock.json files instead of a submodule I guess. I'll make the update soon. But still need your help for the CI files though. ;)

@GuillaumeGomez
Copy link
Member Author

Commits squashed, src/ci/github-actions/ci.yml changes were removed as well. Thanks a lot for your help!

@bors: r=Mark-Simulacrum

@bors
Copy link
Contributor

bors commented Feb 21, 2021

📌 Commit 20f2497 has been approved by Mark-Simulacrum

@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 Feb 21, 2021
@bors
Copy link
Contributor

bors commented Feb 21, 2021

⌛ Testing commit 20f2497 with merge f8297b6ad3ae48ff88b8cdd31dcc8fbe34355050...

@bors
Copy link
Contributor

bors commented Feb 21, 2021

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 21, 2021
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@GuillaumeGomez
Copy link
Member Author

There is no failure apparently? Well, let's rety...

@bors: retry

@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 Feb 21, 2021
@bors
Copy link
Contributor

bors commented Feb 21, 2021

⌛ Testing commit 20f2497 with merge 9d32bf0a81931e6e833eb0155aa5f067e7b7b3f6...

@bors
Copy link
Contributor

bors commented Feb 21, 2021

💥 Test timed out

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 21, 2021
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@ehuss
Copy link
Contributor

ehuss commented Feb 22, 2021

@bors retry
macos: system is shutting down

@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 Feb 22, 2021
@bors
Copy link
Contributor

bors commented Feb 22, 2021

⌛ Testing commit 20f2497 with merge 352238d...

@bors
Copy link
Contributor

bors commented Feb 22, 2021

☀️ Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing 352238d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 22, 2021
@bors bors merged commit 352238d into rust-lang:master Feb 22, 2021
@rustbot rustbot added this to the 1.52.0 milestone Feb 22, 2021
@GuillaumeGomez GuillaumeGomez deleted the rustdoc-gui-tests branch February 22, 2021 09:34
@@ -50,4 +50,6 @@ Session.vim
.cargo
!/src/test/run-make/thumb-none-qemu/example/.cargo
no_llvm_build
**node_modules
**package-lock.json
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is valid syntax. At least I can't find it in man gitignore and ripgrep complains about it:

rust/.gitignore: line 55: error parsing glob '**node_modules': invalid use of **; must be one path component
rust/.gitignore: line 56: error parsing glob '**package-lock.json': invalid use of **; must be one path component

Copy link
Member Author

Choose a reason for hiding this comment

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

** is to look for all subfolders, whatever the level.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe that would be **/node_modules

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 works for me as is but don't hesitate to send an update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: rustdoc UI (generated HTML) A-testsuite Area: The testsuite used to check the correctness of rustc 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. 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.

10 participants