Add a build-aux-docs
directive to compiletest
This flag causes the documentation for all `aux-build` files to be built, which happens prior to running/building the parent test.
This commit is contained in:
parent
1099af732d
commit
14f504c5b7
@ -34,6 +34,8 @@ pub struct TestProps {
|
||||
pub exec_env: Vec<(String,String)> ,
|
||||
// Lines to check if they appear in the expected debugger output
|
||||
pub check_lines: Vec<String> ,
|
||||
// Build documentation for all specified aux-builds as well
|
||||
pub build_aux_docs: bool,
|
||||
// Flag to force a crate to be built with the host architecture
|
||||
pub force_host: bool,
|
||||
// Check stdout for error-pattern output as well as stderr
|
||||
@ -59,6 +61,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
|
||||
let mut run_flags = None;
|
||||
let mut pp_exact = None;
|
||||
let mut check_lines = Vec::new();
|
||||
let mut build_aux_docs = false;
|
||||
let mut force_host = false;
|
||||
let mut check_stdout = false;
|
||||
let mut no_prefer_dynamic = false;
|
||||
@ -83,6 +86,10 @@ pub fn load_props(testfile: &Path) -> TestProps {
|
||||
pp_exact = parse_pp_exact(ln, testfile);
|
||||
}
|
||||
|
||||
if !build_aux_docs {
|
||||
build_aux_docs = parse_build_aux_docs(ln);
|
||||
}
|
||||
|
||||
if !force_host {
|
||||
force_host = parse_force_host(ln);
|
||||
}
|
||||
@ -144,6 +151,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
|
||||
aux_builds: aux_builds,
|
||||
exec_env: exec_env,
|
||||
check_lines: check_lines,
|
||||
build_aux_docs: build_aux_docs,
|
||||
force_host: force_host,
|
||||
check_stdout: check_stdout,
|
||||
no_prefer_dynamic: no_prefer_dynamic,
|
||||
@ -284,6 +292,10 @@ fn parse_force_host(line: &str) -> bool {
|
||||
parse_name_directive(line, "force-host")
|
||||
}
|
||||
|
||||
fn parse_build_aux_docs(line: &str) -> bool {
|
||||
parse_name_directive(line, "build-aux-docs")
|
||||
}
|
||||
|
||||
fn parse_check_stdout(line: &str) -> bool {
|
||||
parse_name_directive(line, "check-stdout")
|
||||
}
|
||||
|
@ -1149,11 +1149,20 @@ fn compile_test(config: &Config, props: &TestProps,
|
||||
}
|
||||
|
||||
fn document(config: &Config, props: &TestProps,
|
||||
testfile: &Path) -> (ProcRes, PathBuf) {
|
||||
testfile: &Path, out_dir: &Path) -> ProcRes {
|
||||
if props.build_aux_docs {
|
||||
for rel_ab in &props.aux_builds {
|
||||
let abs_ab = config.aux_base.join(rel_ab);
|
||||
let aux_props = header::load_props(&abs_ab);
|
||||
|
||||
let auxres = document(config, &aux_props, &abs_ab, out_dir);
|
||||
if !auxres.status.success() {
|
||||
return auxres;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let aux_dir = aux_output_dir_name(config, testfile);
|
||||
let out_dir = output_base_name(config, testfile);
|
||||
let _ = fs::remove_dir_all(&out_dir);
|
||||
ensure_dir(&out_dir);
|
||||
let mut args = vec!["-L".to_owned(),
|
||||
aux_dir.to_str().unwrap().to_owned(),
|
||||
"-o".to_owned(),
|
||||
@ -1164,7 +1173,7 @@ fn document(config: &Config, props: &TestProps,
|
||||
prog: config.rustdoc_path.to_str().unwrap().to_owned(),
|
||||
args: args,
|
||||
};
|
||||
(compose_and_run_compiler(config, props, testfile, args, None), out_dir)
|
||||
compose_and_run_compiler(config, props, testfile, args, None)
|
||||
}
|
||||
|
||||
fn exec_compiled_test(config: &Config, props: &TestProps,
|
||||
@ -1723,7 +1732,11 @@ fn charset() -> &'static str {
|
||||
}
|
||||
|
||||
fn run_rustdoc_test(config: &Config, props: &TestProps, testfile: &Path) {
|
||||
let (proc_res, out_dir) = document(config, props, testfile);
|
||||
let out_dir = output_base_name(config, testfile);
|
||||
let _ = fs::remove_dir_all(&out_dir);
|
||||
ensure_dir(&out_dir);
|
||||
|
||||
let proc_res = document(config, props, testfile, &out_dir);
|
||||
if !proc_res.status.success() {
|
||||
fatal_proc_rec("rustdoc failed!", &proc_res);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user