Skip to content

Commit 4e5333c

Browse files
Don't needlessly build rustdoc for compiletest.
For most tests, rustdoc isn't needed, so avoid building it.
1 parent e2e9b40 commit 4e5333c

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

src/bootstrap/check.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,12 @@ impl Step for Compiletest {
562562
cmd.arg("--compile-lib-path").arg(builder.rustc_libdir(compiler));
563563
cmd.arg("--run-lib-path").arg(builder.sysroot_libdir(compiler, target));
564564
cmd.arg("--rustc-path").arg(builder.rustc(compiler));
565-
cmd.arg("--rustdoc-path").arg(builder.rustdoc(compiler));
565+
566+
// Avoid depending on rustdoc when we don't need it.
567+
if mode == "rustdoc" || mode == "run-make" {
568+
cmd.arg("--rustdoc-path").arg(builder.rustdoc(compiler));
569+
}
570+
566571
cmd.arg("--src-base").arg(build.src.join("src/test").join(suite));
567572
cmd.arg("--build-base").arg(testdir(build, compiler.host).join(suite));
568573
cmd.arg("--stage-id").arg(format!("stage{}-{}", compiler.stage, target));

src/tools/compiletest/src/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ pub struct Config {
9393
pub rustc_path: PathBuf,
9494

9595
// The rustdoc executable
96-
pub rustdoc_path: PathBuf,
96+
pub rustdoc_path: Option<PathBuf>,
9797

9898
// The python executable to use for LLDB
9999
pub lldb_python: String,

src/tools/compiletest/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
6767
opts.reqopt("", "compile-lib-path", "path to host shared libraries", "PATH")
6868
.reqopt("", "run-lib-path", "path to target shared libraries", "PATH")
6969
.reqopt("", "rustc-path", "path to rustc to use for compiling", "PATH")
70-
.reqopt("", "rustdoc-path", "path to rustdoc to use for compiling", "PATH")
70+
.optopt("", "rustdoc-path", "path to rustdoc to use for compiling", "PATH")
7171
.reqopt("", "lldb-python", "path to python to use for doc tests", "PATH")
7272
.reqopt("", "docck-python", "path to python to use for doc tests", "PATH")
7373
.optopt("", "valgrind-path", "path to Valgrind executable for Valgrind tests", "PROGRAM")
@@ -157,7 +157,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
157157
compile_lib_path: make_absolute(opt_path(matches, "compile-lib-path")),
158158
run_lib_path: make_absolute(opt_path(matches, "run-lib-path")),
159159
rustc_path: opt_path(matches, "rustc-path"),
160-
rustdoc_path: opt_path(matches, "rustdoc-path"),
160+
rustdoc_path: matches.opt_str("rustdoc-path").map(PathBuf::from),
161161
lldb_python: matches.opt_str("lldb-python").unwrap(),
162162
docck_python: matches.opt_str("docck-python").unwrap(),
163163
valgrind_path: matches.opt_str("valgrind-path"),
@@ -210,7 +210,7 @@ pub fn log_config(config: &Config) {
210210
logv(c, format!("compile_lib_path: {:?}", config.compile_lib_path));
211211
logv(c, format!("run_lib_path: {:?}", config.run_lib_path));
212212
logv(c, format!("rustc_path: {:?}", config.rustc_path.display()));
213-
logv(c, format!("rustdoc_path: {:?}", config.rustdoc_path.display()));
213+
logv(c, format!("rustdoc_path: {:?}", config.rustdoc_path));
214214
logv(c, format!("src_base: {:?}", config.src_base.display()));
215215
logv(c, format!("build_base: {:?}", config.build_base.display()));
216216
logv(c, format!("stage_id: {}", config.stage_id));

src/tools/compiletest/src/runtest.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,8 @@ actual:\n\
11921192
self.testpaths.file.to_str().unwrap().to_owned()];
11931193
args.extend(self.props.compile_flags.iter().cloned());
11941194
let args = ProcArgs {
1195-
prog: self.config.rustdoc_path.to_str().unwrap().to_owned(),
1195+
prog: self.config.rustdoc_path
1196+
.as_ref().expect("--rustdoc-path passed").to_str().unwrap().to_owned(),
11961197
args: args,
11971198
};
11981199
self.compose_and_run_compiler(args, None)
@@ -2163,7 +2164,8 @@ actual:\n\
21632164
.env("S", src_root)
21642165
.env("RUST_BUILD_STAGE", &self.config.stage_id)
21652166
.env("RUSTC", cwd.join(&self.config.rustc_path))
2166-
.env("RUSTDOC", cwd.join(&self.config.rustdoc_path))
2167+
.env("RUSTDOC",
2168+
cwd.join(&self.config.rustdoc_path.as_ref().expect("--rustdoc-path passed")))
21672169
.env("TMPDIR", &tmpdir)
21682170
.env("LD_LIB_PATH_ENVVAR", procsrv::dylib_env_var())
21692171
.env("HOST_RPATH_DIR", cwd.join(&self.config.compile_lib_path))

0 commit comments

Comments
 (0)