compiletest/runtest/rustdoc.rs
1use super::{DocKind, TestCx, remove_and_create_dir_all};
2use crate::util::ArgFileCommand;
3
4impl TestCx<'_> {
5 pub(super) fn run_rustdoc_html_test(&self) {
6 assert!(self.revision.is_none(), "revisions not supported in this test suite");
7
8 let out_dir = self.output_base_dir();
9 remove_and_create_dir_all(&out_dir).unwrap_or_else(|e| {
10 panic!("failed to remove and recreate output directory `{out_dir}`: {e}")
11 });
12
13 let proc_res = self.document(&out_dir, DocKind::Html);
14 if !proc_res.status.success() {
15 self.fatal_proc_rec("rustdoc failed!", &proc_res);
16 }
17
18 if self.props.check_test_line_numbers_match {
19 self.check_rustdoc_test_option(proc_res);
20 } else {
21 let mut cmd = ArgFileCommand::new(&self.config.python);
22 cmd.arg(self.config.src_root.join("src/etc/htmldocck.py"))
23 .arg(&out_dir)
24 .arg(&self.testpaths.file);
25 if self.config.bless {
26 cmd.arg("--bless");
27 }
28 let res = self.run_command_to_procres(cmd);
29 if !res.status.success() {
30 self.fatal_proc_rec("htmldocck failed!", &res);
31 }
32 }
33 }
34}