Stream: rustdoc

Topic: run rustdoc unit tests


view this post on Zulip Noah Lev (Jul 22 2021 at 22:27):

Does anyone know of a way to run rustdoc unit tests (i.e., the #[test]s in src/librustdoc) with download-rustc? x.py test rustdoc and x.py test src/librustdoc both start building the compiler.

view this post on Zulip Joshua Nelson (Jul 22 2021 at 23:00):

@Noah Lev does --stage 2 help?

view this post on Zulip Joshua Nelson (Jul 22 2021 at 23:01):

if not, it's probably just not implemented in bootstrap

view this post on Zulip Joshua Nelson (Jul 22 2021 at 23:01):

but it should be an easy fix

view this post on Zulip Noah Lev (Jul 23 2021 at 01:42):

IIRC, --stage 2 didn't work either.

view this post on Zulip Noah Lev (Jul 23 2021 at 01:43):

Where in bootstrap would it need to be implemented?

view this post on Zulip GuillaumeGomez (Jul 23 2021 at 08:42):

For me it works as expected?

view this post on Zulip Noah Lev (Jul 24 2021 at 22:37):

GuillaumeGomez said:

For me it works as expected?

Does it build the compiler when you run the tests though?

view this post on Zulip Joshua Nelson (Jul 24 2021 at 22:52):

Noah Lev said:

Where in bootstrap would it need to be implemented?

@Noah Lev https://github.com/rust-lang/rust/blob/d9aa28767287670df6cf823b94629122e04442c0/src/bootstrap/test.rs#L2075

view this post on Zulip Joshua Nelson (Jul 24 2021 at 22:58):

probably due to the off-by-one numbering for rustdoc - the first thing I'd try is changing compiler_for() to compiler()

view this post on Zulip GuillaumeGomez (Jul 24 2021 at 23:06):

Noah Lev said:

GuillaumeGomez said:

For me it works as expected?

Does it build the compiler when you run the tests though?

Unfortunately yes.

view this post on Zulip Noah Lev (Jul 25 2021 at 00:02):

Ah, yeah, that's what I mean by "not working" :)

view this post on Zulip Joshua Nelson (Jul 25 2021 at 00:04):

Joshua Nelson said:

probably due to the off-by-one numbering for rustdoc - the first thing I'd try is changing compiler_for() to compiler()

tried this locally and ran into LLVM linking issues but not sure if they're related or not

view this post on Zulip Noah Lev (Jul 25 2021 at 00:06):

Also the problem with using compiler is that it rebuilds rustdoc even if it was built for running compiletests

view this post on Zulip Joshua Nelson (Jul 25 2021 at 00:07):

are you sure that's true even when download-rustc is set?

view this post on Zulip Joshua Nelson (Jul 25 2021 at 00:07):

it's fine to add an if builder.download_rustc there IMO

view this post on Zulip Noah Lev (Jul 25 2021 at 00:07):

Yes, because it's rebuilding rustdoc right now, and had I already built it for compiletest

view this post on Zulip Joshua Nelson (Jul 25 2021 at 00:07):

hmm, ok, I think I'm misunderstanding that code then. I'm not sure what the proper fix would be.

view this post on Zulip Noah Lev (Jul 25 2021 at 00:07):

Joshua Nelson said:

it's fine to add an if builder.download_rustc there IMO

Yeah, rebuilding just rustdoc would certainly be better than rebuilding all of rustc :)

view this post on Zulip Noah Lev (Jul 25 2021 at 04:42):

I can confirm that with the change from compiler_for to compiler, x test src/librustdoc/ does not build the compiler, but does rebuild rustdoc.

view this post on Zulip Noah Lev (Jul 25 2021 at 04:42):

Although it seems like it's building rustdoc twice at once?

    Building [=======================> ] 123/126: rustdoc, rustdoc

view this post on Zulip Noah Lev (Jul 25 2021 at 04:43):

Maybe it was rustdoc without cfg(test) + rustdoc with cfg(test).

view this post on Zulip Joshua Nelson (Jul 25 2021 at 11:25):

Noah Lev said:

Maybe it was rustdoc without cfg(test) + rustdoc with cfg(test).

that seems likely

view this post on Zulip Joshua Nelson (Jul 25 2021 at 11:25):

Noah Lev said:

I can confirm that with the change from compiler_for to compiler, x test src/librustdoc/ does not build the compiler, but does rebuild rustdoc.

I would take a PR for this if it were conditional on download_rustc


Last updated: Oct 11 2021 at 22:34 UTC