Skip to content

Commit 2dd7ff6

Browse files
committed
Auto merge of #3399 - RalfJung:ci, r=RalfJung
make CI failures easier to interpret RUST_BACKTRACE=1 means we show 2 backtraces that are almost always irrelevant: from ui_test and from the miri script. Instead let's set the env var inside the test harness so we see backtraces of Miri ICEing but nothing else.
2 parents 3670823 + bb96963 commit 2dd7ff6

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ jobs:
3030
host_target: i686-pc-windows-msvc
3131
runs-on: ${{ matrix.os }}
3232
env:
33-
RUST_BACKTRACE: 1
3433
HOST_TARGET: ${{ matrix.host_target }}
3534
steps:
3635
- uses: actions/checkout@v3

tests/ui.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ use std::ffi::OsString;
44
use std::num::NonZeroUsize;
55
use std::path::{Path, PathBuf};
66
use std::{env, process::Command};
7-
use ui_test::{color_eyre::Result, Config, Match, Mode, OutputConflictHandling};
8-
use ui_test::{status_emitter, CommandBuilder, Format, RustfixMode};
7+
use ui_test::color_eyre::eyre::{Context, Result};
8+
use ui_test::{
9+
status_emitter, CommandBuilder, Config, Format, Match, Mode, OutputConflictHandling,
10+
RustfixMode,
11+
};
912

1013
fn miri_path() -> PathBuf {
1114
PathBuf::from(option_env!("MIRI").unwrap_or(env!("CARGO_BIN_EXE_miri")))
@@ -124,6 +127,9 @@ fn run_tests(
124127
// Let the tests know where to store temp files (they might run for a different target, which can make this hard to find).
125128
config.program.envs.push(("MIRI_TEMP".into(), Some(tmpdir.to_owned().into())));
126129

130+
// If a test ICEs, we want to see a backtrace.
131+
config.program.envs.push(("RUST_BACKTRACE".into(), Some("1".into())));
132+
127133
// Handle command-line arguments.
128134
let args = ui_test::Args::test()?;
129135
let default_bless = env::var_os("RUSTC_BLESS").is_some_and(|v| v != "0");
@@ -223,14 +229,15 @@ fn ui(
223229
with_dependencies: Dependencies,
224230
tmpdir: &Path,
225231
) -> Result<()> {
226-
let msg = format!("## Running ui tests in {path} against miri for {target}");
232+
let msg = format!("## Running ui tests in {path} for {target}");
227233
eprintln!("{}", msg.green().bold());
228234

229235
let with_dependencies = match with_dependencies {
230236
WithDependencies => true,
231237
WithoutDependencies => false,
232238
};
233239
run_tests(mode, path, target, with_dependencies, tmpdir)
240+
.with_context(|| format!("ui tests in {path} for {target} failed"))
234241
}
235242

236243
fn get_target() -> String {

0 commit comments

Comments
 (0)