diff options
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/compiletest/src/main.rs | 6 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 51 |
2 files changed, 35 insertions, 22 deletions
diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 80cab96434b..ae4f4aa4046 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -283,6 +283,8 @@ pub fn parse_config(args: Vec<String>) -> Config { ), }; + let src_base = opt_path(matches, "src-base"); + let run_ignored = matches.opt_present("ignored"); Config { compile_lib_path: make_absolute(opt_path(matches, "compile-lib-path")), run_lib_path: make_absolute(opt_path(matches, "run-lib-path")), @@ -293,7 +295,7 @@ pub fn parse_config(args: Vec<String>) -> Config { valgrind_path: matches.opt_str("valgrind-path"), force_valgrind: matches.opt_present("force-valgrind"), llvm_filecheck: matches.opt_str("llvm-filecheck").map(|s| PathBuf::from(&s)), - src_base: opt_path(matches, "src-base"), + src_base, build_base: opt_path(matches, "build-base"), stage_id: matches.opt_str("stage-id").unwrap(), mode: matches @@ -301,7 +303,7 @@ pub fn parse_config(args: Vec<String>) -> Config { .unwrap() .parse() .expect("invalid mode"), - run_ignored: matches.opt_present("ignored"), + run_ignored, filter: matches.free.first().cloned(), filter_exact: matches.opt_present("exact"), logfile: matches.opt_str("logfile").map(|s| PathBuf::from(&s)), diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index db0ac927904..9fa176aa68c 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1288,7 +1288,9 @@ impl<'test> TestCx<'test> { // want to actually assert warnings about all this code. Instead // let's just ignore unused code warnings by defaults and tests // can turn it back on if needed. - rustc.args(&["-A", "unused"]); + if !self.config.src_base.ends_with("rustdoc-ui") { + rustc.args(&["-A", "unused"]); + } } _ => {} } @@ -1582,7 +1584,12 @@ impl<'test> TestCx<'test> { } fn make_compile_args(&self, input_file: &Path, output_file: TargetLocation) -> Command { - let mut rustc = Command::new(&self.config.rustc_path); + let is_rustdoc = self.config.src_base.ends_with("rustdoc-ui"); + let mut rustc = if !is_rustdoc { + Command::new(&self.config.rustc_path) + } else { + Command::new(&self.config.rustdoc_path.clone().expect("no rustdoc built yet")) + }; rustc.arg(input_file).arg("-L").arg(&self.config.build_base); // Optionally prevent default --target if specified in test compile-flags. @@ -1605,17 +1612,19 @@ impl<'test> TestCx<'test> { rustc.args(&["--cfg", revision]); } - if let Some(ref incremental_dir) = self.props.incremental_dir { - rustc.args(&[ - "-C", - &format!("incremental={}", incremental_dir.display()), - ]); - rustc.args(&["-Z", "incremental-verify-ich"]); - rustc.args(&["-Z", "incremental-queries"]); - } + if !is_rustdoc { + if let Some(ref incremental_dir) = self.props.incremental_dir { + rustc.args(&[ + "-C", + &format!("incremental={}", incremental_dir.display()), + ]); + rustc.args(&["-Z", "incremental-verify-ich"]); + rustc.args(&["-Z", "incremental-queries"]); + } - if self.config.mode == CodegenUnits { - rustc.args(&["-Z", "human_readable_cgu_names"]); + if self.config.mode == CodegenUnits { + rustc.args(&["-Z", "human_readable_cgu_names"]); + } } match self.config.mode { @@ -1668,11 +1677,12 @@ impl<'test> TestCx<'test> { } } - - if self.config.target == "wasm32-unknown-unknown" { - // rustc.arg("-g"); // get any backtrace at all on errors - } else if !self.props.no_prefer_dynamic { - rustc.args(&["-C", "prefer-dynamic"]); + if !is_rustdoc { + if self.config.target == "wasm32-unknown-unknown" { + // rustc.arg("-g"); // get any backtrace at all on errors + } else if !self.props.no_prefer_dynamic { + rustc.args(&["-C", "prefer-dynamic"]); + } } match output_file { @@ -1696,8 +1706,10 @@ impl<'test> TestCx<'test> { } else { rustc.args(self.split_maybe_args(&self.config.target_rustcflags)); } - if let Some(ref linker) = self.config.linker { - rustc.arg(format!("-Clinker={}", linker)); + if !is_rustdoc { + if let Some(ref linker) = self.config.linker { + rustc.arg(format!("-Clinker={}", linker)); + } } rustc.args(&self.props.compile_flags); @@ -2509,7 +2521,6 @@ impl<'test> TestCx<'test> { .compile_flags .iter() .any(|s| s.contains("--error-format")); - let proc_res = self.compile_test(); self.check_if_test_should_compile(&proc_res); |
