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

Test rustdoc js #47250

Merged
merged 7 commits into from
Jan 18, 2018
Merged

Test rustdoc js #47250

merged 7 commits into from
Jan 18, 2018

Conversation

GuillaumeGomez
Copy link
Member

@GuillaumeGomez GuillaumeGomez commented Jan 7, 2018

Add tests for the rustdoc search. It was heavily required because of all the recent breaking changes that happened while I went through improvements in doc search (add search in/for generic search for example).

@rust-highfive
Copy link
Collaborator

Some changes occurred in HTML/CSS.

cc @GuillaumeGomez

@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@GuillaumeGomez
Copy link
Member Author

Ah apparently, @Mark-Simulacrum is the one! Could you give me a hand when you have time please?

});
}

fn run(self, _: &Builder) {
Copy link
Member

Choose a reason for hiding this comment

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

  • The _ probably needs to be builder for line 457 to work.
  • This function needs to return Self::Output anyway, for the trait to match. Since Self::Output is PathBuf, that's what this needs to return. However, all of the other Step impls in this file return (), so that's probably what the Output needs to be here as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Certainly, I stopped trying to make it work and certainly forgot to commit the version which compiles. The problem is more global anyway. But thanks for taking a look in here. ;)

Copy link
Member

@Mark-Simulacrum Mark-Simulacrum left a comment

Choose a reason for hiding this comment

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

Left some basic feedback. Let me know if you have any questions.

@@ -260,6 +260,7 @@ tool!(
BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::Libstd;
RemoteTestClient, "src/tools/remote-test-client", "remote-test-client", Mode::Libstd;
RustInstaller, "src/tools/rust-installer", "fabricate", Mode::Libstd;
RustdocJS, "node", "node", Mode::Tool;
Copy link
Member

Choose a reason for hiding this comment

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

You almost certainly want these arguments to be closer to the above. Something like RustdocJs, "rustdoc-js", "js-tests", Mode::Tool.

But frankly I'm not entirely certain what this tool is doing either way -- you'd probably actually not want it, or at least it seems like at the very least it shouldn't be generated by the macro. If this doesn't make sense, explaining why it's here would help.

Copy link
Member Author

Choose a reason for hiding this comment

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

I just tried my best understanding what was going on in here. My goal is to test the search in rust documentation. So I need to run this tool once the documentation has been generated. To run it, I need nodejs and I don't really know how to pick up the currently installed one.

const ONLY_HOSTS: bool = true;

fn should_run(run: ShouldRun) -> ShouldRun {
run.path("node")
Copy link
Member

Choose a reason for hiding this comment

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

This should be something more reasonable, like src/tests/rustdoc-js.

} else {
let command = Command::new("sh");
command.args(&["-c", "node src/tools/rustdoc-js/tester.js"]);
command
Copy link
Member

Choose a reason for hiding this comment

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

The commands here likely want to use the configured node executable (builder.config.nodejs or something like that).

@@ -570,6 +604,7 @@ static HOST_COMPILETESTS: &[Test] = &[
},
Test { path: "src/test/run-make", mode: "run-make", suite: "run-make" },
Test { path: "src/test/rustdoc", mode: "rustdoc", suite: "rustdoc" },
Test { path: "src/test/rustdoc-js", mode: "rustdoc-js", suite: "rustdoc-js" },
Copy link
Member

Choose a reason for hiding this comment

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

This (probably) shouldn't be here, unless you want to branch on rustdoc-js as the mode below and call into RustdocJs... I would remove this, and add RustdocJs to the list of tests here

Kind::Test => describe!(check::Tidy, check::Bootstrap, check::DefaultCompiletest,
check::HostCompiletest, check::Crate, check::CrateLibrustc, check::Rustdoc,
check::Linkcheck, check::Cargotest, check::Cargo, check::Rls, check::Docs,
check::ErrorIndex, check::Distcheck, check::Rustfmt, check::Miri, check::Clippy),
.

@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 8, 2018
@GuillaumeGomez
Copy link
Member Author

@Mark-Simulacrum: Ok, moved a bit forward (still not compiling). Are you sure I need to put RustdocJS into the tool! macro call?

@Mark-Simulacrum
Copy link
Member

Sorry for the delay in getting back to you. Since the tool RustdocJS added doesn't require compilation (as far as I can tell) I believe we should not have it in src/bootstrap/tool.rs whatsoever; otherwise I think the code looks good to me. Once you remove the changes to src/bootstrap/tool.rs then I think this should work -- let me know if it doesn't.

@kennytm kennytm 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 Jan 10, 2018
@GuillaumeGomez
Copy link
Member Author

It requires at least rustdoc compilation in order to have a doc built (I need generated docs). Therefore it requires rustc and everything coming beforehand. :)

@Mark-Simulacrum
Copy link
Member

So if you need specific generated docs, you can call builder.ensure(doc::Std { ... }) or if you need whatever the "default docs" are (please say you don't need this) then builder.default_docs(None) or something like that... if you need rustdoc built, then builder.ensure(tool::Rustdoc { ... }) is the invocation, I believe. You can look at how we pass it to cargo in builder.rs's fn cargo.

Does that help?

@GuillaumeGomez
Copy link
Member Author

Yes, thanks a lot!

This is now ready on my side.

@Mark-Simulacrum
Copy link
Member

Looks like we'll need to install nodejs for this to work. cc @alexcrichton -- are we okay with a default test requiring this (new) dependency?

You can see examples of how we do it in the emscripten script: https://github.com/rust-lang/rust/blob/master/src/ci/docker/scripts/emscripten.sh#L50-L53.

@alexcrichton
Copy link
Member

Could we perhaps not run these tests by default but run them on one builder or when node is already detected? I think it'd be best to not pick up a new dependency for all builds but just some (opt-in) builds.

@GuillaumeGomez
Copy link
Member Author

Sure. Let's go for testing only when node is present.

@GuillaumeGomez
Copy link
Member Author

Done!

@GuillaumeGomez GuillaumeGomez 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 Jan 14, 2018
@GuillaumeGomez
Copy link
Member Author

I'll put the explanation in this comment, don't hesitate to copy/paste it anywhere you might want.

This PR is pretty "simple" and "just" add tests for the rustdoc search. It was heavily required because of all the recent breaking changes that happened while I went through improvements in doc search (add search in/for generic search for example).

@Mark-Simulacrum
Copy link
Member

r=me if you're ready and don't want docs team review; I have not looked over the tests themselves to verify that they make sense. It is also be worth checking that we have at least one builder on CI that would run these tests, and if not, probably adding nodejs to one of our test-running builders. My impression is that wasm32-unknown, dist-various-2, and asmjs builders all install nodejs, but only the asmjs builder today will run the test you want. I think that should be sufficient, but let me know if you disagree and we can discuss which builder would be best to add it to.

@GuillaumeGomez
Copy link
Member Author

The doc team already gave its go through @QuietMisdreavus so I suppose it's fine. For me it seems good enough for a first step. We can always add more later on. :) Thanks a lot for your help in here @Mark-Simulacrum!

@bors: r=Mark-Simulcram

@bors
Copy link
Contributor

bors commented Jan 15, 2018

📌 Commit 026c749 has been approved by Mark-Simulcram

@Mark-Simulacrum
Copy link
Member

@bors r- r+

@bors
Copy link
Contributor

bors commented Jan 15, 2018

💡 This pull request was already approved, no need to approve it again.

@bors
Copy link
Contributor

bors commented Jan 15, 2018

📌 Commit 026c749 has been approved by Mark-Simulacrum

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jan 16, 2018
…ark-Simulacrum

Test rustdoc js

Add tests for the rustdoc search. It was heavily required because of all the recent breaking changes that happened while I went through improvements in doc search (add search in/for generic search for example).
@GuillaumeGomez
Copy link
Member Author

Apparently windows uses an old version:

02:28:22] C:\projects\rust\src\tools\rustdoc-js\tester.js:118
[02:28:22]             let value = data[i][key];
[02:28:22]             ^^^
[02:28:22] 
[02:28:22] SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
[02:28:22]     at exports.runInThisContext (vm.js:53:16)
[02:28:22]     at Module._compile (module.js:373:25)
[02:28:22]     at Object.Module._extensions..js (module.js:416:10)
[02:28:22]     at Module.load (module.js:343:32)
[02:28:22]     at Function.Module._load (module.js:300:12)
[02:28:22]     at Function.Module.runMain (module.js:441:10)
[02:28:22]     at startup (node.js:140:18)
[02:28:22]     at node.js:1043:3

@GuillaumeGomez
Copy link
Member Author

@bors: r=Mark-Simulacrum

@bors
Copy link
Contributor

bors commented Jan 16, 2018

📌 Commit 3a7e247 has been approved by Mark-Simulacrum

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jan 16, 2018
…ark-Simulacrum

Test rustdoc js

Add tests for the rustdoc search. It was heavily required because of all the recent breaking changes that happened while I went through improvements in doc search (add search in/for generic search for example).
bors added a commit that referenced this pull request Jan 16, 2018
Rollup of 6 pull requests

- Successful merges: #47250, #47302, #47387, #47398, #47436, #47444
- Failed merges:
bors added a commit that referenced this pull request Jan 17, 2018
Rollup of 6 pull requests

- Successful merges: #47250, #47302, #47387, #47398, #47436, #47444
- Failed merges:
kennytm added a commit to kennytm/rust that referenced this pull request Jan 17, 2018
…ark-Simulacrum

Test rustdoc js

Add tests for the rustdoc search. It was heavily required because of all the recent breaking changes that happened while I went through improvements in doc search (add search in/for generic search for example).
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jan 17, 2018
…ark-Simulacrum

Test rustdoc js

Add tests for the rustdoc search. It was heavily required because of all the recent breaking changes that happened while I went through improvements in doc search (add search in/for generic search for example).
bors added a commit that referenced this pull request Jan 18, 2018
Rollup of 6 pull requests

- Successful merges: #47250, #47313, #47398, #47468, #47471, #47520
- Failed merges:
@bors bors merged commit 3a7e247 into rust-lang:master Jan 18, 2018
@GuillaumeGomez GuillaumeGomez deleted the test-rustdoc-js branch January 18, 2018 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants