diff options
| author | bors <bors@rust-lang.org> | 2023-09-19 00:02:42 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-09-19 00:02:42 +0000 |
| commit | f3984ce5bbd5b6ab99279617ad1b84dec7a3dd20 (patch) | |
| tree | 20ea25e480deedd30611b34c1dc9a72d017aa4c2 /src/tools/compiletest | |
| parent | 65ea825f4021eaf77f1b25139969712d65b435a4 (diff) | |
| parent | aa55d7d7301ebe569c7a2369b99bd84cd880aee4 (diff) | |
Auto merge of #115952 - matthiaskrgr:rollup-qzk8t4e, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #115869 (Avoid blessing cargo deps's source code in ui tests) - #115873 (Make `TyKind::Adt`'s `Debug` impl be more pretty) - #115879 (Migrate diagnostics in `hir_typeck/src/cast.rs`) - #115930 (coverage: Fix an unstable-sort inconsistency in coverage spans) - #115931 (Move mobile topbar title creation entirely into JS) - #115941 (Add myself to .mailmap) - #115943 (compiletest: Don't swallow some error messages.) - #115949 (Update browser-ui-test version) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/tools/compiletest')
| -rw-r--r-- | src/tools/compiletest/Cargo.toml | 1 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 25 |
2 files changed, 18 insertions, 8 deletions
diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index ff1d5cecb72..bb1fa6e9237 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -24,6 +24,7 @@ walkdir = "2" glob = "0.3.0" lazycell = "1.3.0" anyhow = "1" +home = "0.5.5" [target.'cfg(unix)'.dependencies] libc = "0.2" diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 65af650f6e5..7b42d8e9b58 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -695,7 +695,7 @@ impl<'test> TestCx<'test> { } fn run_command_to_procres(&self, cmd: &mut Command) -> ProcRes { - let output = cmd.output().unwrap_or_else(|_| panic!("failed to exec `{cmd:?}`")); + let output = cmd.output().unwrap_or_else(|e| panic!("failed to exec `{cmd:?}`: {e:?}")); let proc_res = ProcRes { status: output.status, @@ -1216,12 +1216,12 @@ impl<'test> TestCx<'test> { .arg(&exe_file) .arg(&self.config.adb_test_dir) .status() - .unwrap_or_else(|_| panic!("failed to exec `{:?}`", adb_path)); + .unwrap_or_else(|e| panic!("failed to exec `{adb_path:?}`: {e:?}")); Command::new(adb_path) .args(&["forward", "tcp:5039", "tcp:5039"]) .status() - .unwrap_or_else(|_| panic!("failed to exec `{:?}`", adb_path)); + .unwrap_or_else(|e| panic!("failed to exec `{adb_path:?}`: {e:?}")); let adb_arg = format!( "export LD_LIBRARY_PATH={}; \ @@ -1238,7 +1238,7 @@ impl<'test> TestCx<'test> { .stdout(Stdio::piped()) .stderr(Stdio::inherit()) .spawn() - .unwrap_or_else(|_| panic!("failed to exec `{:?}`", adb_path)); + .unwrap_or_else(|e| panic!("failed to exec `{adb_path:?}`: {e:?}")); // Wait for the gdbserver to print out "Listening on port ..." // at which point we know that it's started and then we can @@ -1263,7 +1263,7 @@ impl<'test> TestCx<'test> { let Output { status, stdout, stderr } = Command::new(&gdb_path) .args(debugger_opts) .output() - .unwrap_or_else(|_| panic!("failed to exec `{:?}`", gdb_path)); + .unwrap_or_else(|e| panic!("failed to exec `{gdb_path:?}`: {e:?}")); let cmdline = { let mut gdb = Command::new(&format!("{}-gdb", self.config.target)); gdb.args(debugger_opts); @@ -2277,7 +2277,7 @@ impl<'test> TestCx<'test> { add_dylib_path(&mut command, iter::once(lib_path).chain(aux_path)); let mut child = disable_error_reporting(|| command.spawn()) - .unwrap_or_else(|_| panic!("failed to exec `{:?}`", &command)); + .unwrap_or_else(|e| panic!("failed to exec `{command:?}`: {e:?}")); if let Some(input) = input { child.stdin.as_mut().unwrap().write_all(input.as_bytes()).unwrap(); } @@ -2335,6 +2335,15 @@ impl<'test> TestCx<'test> { rustc.arg("-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX"); rustc.arg("-Ztranslate-remapped-path-to-local-path=no"); + // Hide Cargo dependency sources from ui tests to make sure the error message doesn't + // change depending on whether $CARGO_HOME is remapped or not. If this is not present, + // when $CARGO_HOME is remapped the source won't be shown, and when it's not remapped the + // source will be shown, causing a blessing hell. + rustc.arg("-Z").arg(format!( + "ignore-directory-in-diagnostics-source-blocks={}", + home::cargo_home().expect("failed to find cargo home").to_str().unwrap() + )); + // Optionally prevent default --sysroot if specified in test compile-flags. if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot")) && !self.config.host_rustcflags.iter().any(|flag| flag == "--sysroot") @@ -3838,8 +3847,8 @@ impl<'test> TestCx<'test> { .open(coverage_file_path.as_path()) .expect("could not create or open file"); - if writeln!(file, "{}", self.testpaths.file.display()).is_err() { - panic!("couldn't write to {}", coverage_file_path.display()); + if let Err(e) = writeln!(file, "{}", self.testpaths.file.display()) { + panic!("couldn't write to {}: {e:?}", coverage_file_path.display()); } } } else if self.props.run_rustfix { |
