compiletest/runtest/rustdoc.rs
1use std::process::Command;
2
3use super::{TestCx, remove_and_create_dir_all};
4
5impl TestCx<'_> {
6 pub(super) fn run_rustdoc_test(&self) {
7 assert!(self.revision.is_none(), "revisions not relevant here");
8
9 let out_dir = self.output_base_dir();
10 remove_and_create_dir_all(&out_dir);
11
12 let proc_res = self.document(&out_dir, &self.testpaths);
13 if !proc_res.status.success() {
14 self.fatal_proc_rec("rustdoc failed!", &proc_res);
15 }
16
17 if self.props.check_test_line_numbers_match {
18 self.check_rustdoc_test_option(proc_res);
19 } else {
20 let mut cmd = Command::new(&self.config.python);
21 cmd.arg(self.config.src_root.join("src/etc/htmldocck.py"))
22 .arg(&out_dir)
23 .arg(&self.testpaths.file);
24 if self.config.bless {
25 cmd.arg("--bless");
26 }
27 let res = self.run_command_to_procres(&mut cmd);
28 if !res.status.success() {
29 self.fatal_proc_rec_with_ctx("htmldocck failed!", &res, |mut this| {
30 this.compare_to_default_rustdoc(&out_dir)
31 });
32 }
33 }
34 }
35}