From 3d6fcea4178f885d034c49d1c4fc14f81fe71d49 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 23 Mar 2024 18:59:15 +0100 Subject: [PATCH 1/2] when a test fails, repeat the target after the failure report --- src/tools/miri/tests/ui.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tools/miri/tests/ui.rs b/src/tools/miri/tests/ui.rs index 7f363ccdfe5..6dee5a6d6c1 100644 --- a/src/tools/miri/tests/ui.rs +++ b/src/tools/miri/tests/ui.rs @@ -4,6 +4,7 @@ use std::ffi::OsString; use std::num::NonZeroUsize; use std::path::{Path, PathBuf}; use std::{env, process::Command}; +use ui_test::color_eyre::eyre::Context; use ui_test::{color_eyre::Result, Config, Match, Mode, OutputConflictHandling}; use ui_test::{status_emitter, CommandBuilder, Format, RustfixMode}; @@ -231,6 +232,7 @@ fn ui( WithoutDependencies => false, }; run_tests(mode, path, target, with_dependencies, tmpdir) + .with_context(|| format!("ui tests in {path} for {target} failed")) } fn get_target() -> String { From bb4ef1a5fb81e4cd6433551bfc5935f79d1084f6 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 23 Mar 2024 18:59:27 +0100 Subject: [PATCH 2/2] disable RUST_BACKTRACE in CI, set it inside the test harness instead --- src/tools/miri/.github/workflows/ci.yml | 1 - src/tools/miri/tests/ui.rs | 13 +++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/tools/miri/.github/workflows/ci.yml b/src/tools/miri/.github/workflows/ci.yml index 1097fc6db72..c10c711d61b 100644 --- a/src/tools/miri/.github/workflows/ci.yml +++ b/src/tools/miri/.github/workflows/ci.yml @@ -30,7 +30,6 @@ jobs: host_target: i686-pc-windows-msvc runs-on: ${{ matrix.os }} env: - RUST_BACKTRACE: 1 HOST_TARGET: ${{ matrix.host_target }} steps: - uses: actions/checkout@v3 diff --git a/src/tools/miri/tests/ui.rs b/src/tools/miri/tests/ui.rs index 6dee5a6d6c1..129d1dfd732 100644 --- a/src/tools/miri/tests/ui.rs +++ b/src/tools/miri/tests/ui.rs @@ -4,9 +4,11 @@ use std::ffi::OsString; use std::num::NonZeroUsize; use std::path::{Path, PathBuf}; use std::{env, process::Command}; -use ui_test::color_eyre::eyre::Context; -use ui_test::{color_eyre::Result, Config, Match, Mode, OutputConflictHandling}; -use ui_test::{status_emitter, CommandBuilder, Format, RustfixMode}; +use ui_test::color_eyre::eyre::{Context, Result}; +use ui_test::{ + status_emitter, CommandBuilder, Config, Format, Match, Mode, OutputConflictHandling, + RustfixMode, +}; fn miri_path() -> PathBuf { PathBuf::from(option_env!("MIRI").unwrap_or(env!("CARGO_BIN_EXE_miri"))) @@ -125,6 +127,9 @@ fn run_tests( // Let the tests know where to store temp files (they might run for a different target, which can make this hard to find). config.program.envs.push(("MIRI_TEMP".into(), Some(tmpdir.to_owned().into()))); + // If a test ICEs, we want to see a backtrace. + config.program.envs.push(("RUST_BACKTRACE".into(), Some("1".into()))); + // Handle command-line arguments. let args = ui_test::Args::test()?; let default_bless = env::var_os("RUSTC_BLESS").is_some_and(|v| v != "0"); @@ -224,7 +229,7 @@ fn ui( with_dependencies: Dependencies, tmpdir: &Path, ) -> Result<()> { - let msg = format!("## Running ui tests in {path} against miri for {target}"); + let msg = format!("## Running ui tests in {path} for {target}"); eprintln!("{}", msg.green().bold()); let with_dependencies = match with_dependencies {