Skip to content

Commit 619880e

Browse files
committed
Fix tests with auxiliary docs
1 parent 975471c commit 619880e

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

src/tools/compiletest/src/runtest.rs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1729,7 +1729,7 @@ impl<'test> TestCx<'test> {
17291729
self.config.target.contains("vxworks") && !self.is_vxworks_pure_static()
17301730
}
17311731

1732-
fn compose_and_run_compiler(&self, mut rustc: Command, input: Option<String>) -> ProcRes {
1732+
fn build_all_auxiliary(&self, rustc: &mut Command) -> PathBuf {
17331733
let aux_dir = self.aux_output_dir_name();
17341734

17351735
if !self.props.aux_builds.is_empty() {
@@ -1748,6 +1748,11 @@ impl<'test> TestCx<'test> {
17481748
rustc.arg("--extern").arg(format!("{}={}/{}", aux_name, aux_dir.display(), lib_name));
17491749
}
17501750

1751+
aux_dir
1752+
}
1753+
1754+
fn compose_and_run_compiler(&self, mut rustc: Command, input: Option<String>) -> ProcRes {
1755+
let aux_dir = self.build_all_auxiliary(&mut rustc);
17511756
self.props.unset_rustc_env.clone().iter().fold(&mut rustc, |rustc, v| rustc.env_remove(v));
17521757
rustc.envs(self.props.rustc_env.clone());
17531758
self.compose_and_run(
@@ -2359,13 +2364,26 @@ impl<'test> TestCx<'test> {
23592364
// We need to create a new struct for the lifetimes on `config` to work.
23602365
let new_rustdoc = TestCx {
23612366
config: &Config {
2362-
// FIXME: use beta or a user-specified rustdoc instead of hardcoding
2363-
// the default toolchain
2367+
// FIXME: use beta or a user-specified rustdoc instead of
2368+
// hardcoding the default toolchain
23642369
rustdoc_path: Some("rustdoc".into()),
2370+
// Needed for building auxiliary docs below
2371+
rustc_path: "rustc".into(),
23652372
..self.config.clone()
23662373
},
23672374
..*self
23682375
};
2376+
2377+
let output_file = TargetLocation::ThisDirectory(new_rustdoc.aux_output_dir_name());
2378+
let mut rustc = new_rustdoc.make_compile_args(
2379+
&new_rustdoc.testpaths.file,
2380+
output_file,
2381+
EmitMetadata::No,
2382+
AllowUnused::Yes,
2383+
);
2384+
rustc.arg("-L").arg(&new_rustdoc.aux_output_dir_name());
2385+
new_rustdoc.build_all_auxiliary(&mut dbg!(rustc));
2386+
23692387
let proc_res = new_rustdoc.document(&compare_dir);
23702388
if !proc_res.status.success() {
23712389
proc_res.fatal(Some("failed to run nightly rustdoc"), || ());
@@ -2390,6 +2408,7 @@ impl<'test> TestCx<'test> {
23902408

23912409
let has_delta = Command::new("delta")
23922410
.arg("--version")
2411+
.stdout(Stdio::null())
23932412
.status()
23942413
.map_or(false, |status| status.success());
23952414
let mut diff = Command::new("diff");

0 commit comments

Comments
 (0)