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 root = self.config.find_rust_src_root().unwrap();
21 let mut cmd = Command::new(&self.config.python);
22 cmd.arg(root.join("src/etc/htmldocck.py")).arg(&out_dir).arg(&self.testpaths.file);
23 if self.config.bless {
24 cmd.arg("--bless");
25 }
26 let res = self.run_command_to_procres(&mut cmd);
27 if !res.status.success() {
28 self.fatal_proc_rec_with_ctx("htmldocck failed!", &res, |mut this| {
29 this.compare_to_default_rustdoc(&out_dir)
30 });
31 }
32 }
33 }
34}