diff options
| author | mitaa <mitaa.ceb@gmail.com> | 2015-12-03 22:19:58 +0100 |
|---|---|---|
| committer | mitaa <mitaa.ceb@gmail.com> | 2015-12-03 22:20:29 +0100 |
| commit | 14f504c5b7324c77e78feffe5def4282d0f10573 (patch) | |
| tree | 39f18b5183ea7856b1351385f02b454673856b5f | |
| parent | 1099af732dd25be44f4e3da35d0f5b8e40cdcb7e (diff) | |
| download | rust-14f504c5b7324c77e78feffe5def4282d0f10573.tar.gz rust-14f504c5b7324c77e78feffe5def4282d0f10573.zip | |
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.
| -rw-r--r-- | src/compiletest/header.rs | 12 | ||||
| -rw-r--r-- | src/compiletest/runtest.rs | 25 |
2 files changed, 31 insertions, 6 deletions
diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index 9de46cef745..6efe6e608e8 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -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") } diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 8042e2f966c..833ab553a13 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -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