Skip to content

Commit 9f4e7c6

Browse files
committed
Bump ui_test crate
1 parent e706367 commit 9f4e7c6

File tree

5 files changed

+61
-39
lines changed

5 files changed

+61
-39
lines changed

src/tools/miri/Cargo.lock

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ dependencies = [
2626
"memchr",
2727
]
2828

29+
[[package]]
30+
name = "annotate-snippets"
31+
version = "0.9.1"
32+
source = "registry+https://github.com/rust-lang/crates.io-index"
33+
checksum = "c3b9d411ecbaf79885c6df4d75fff75858d5995ff25385657a28af47e82f9c36"
34+
dependencies = [
35+
"unicode-width",
36+
"yansi-term",
37+
]
38+
2939
[[package]]
3040
name = "ansi_term"
3141
version = "0.12.1"
@@ -216,12 +226,6 @@ dependencies = [
216226
"windows-sys 0.45.0",
217227
]
218228

219-
[[package]]
220-
name = "distance"
221-
version = "0.4.0"
222-
source = "registry+https://github.com/rust-lang/crates.io-index"
223-
checksum = "6d9d8664cf849d7d0f3114a3a387d2f5e4303176d746d5a951aaddc66dfe9240"
224-
225229
[[package]]
226230
name = "encode_unicode"
227231
version = "0.3.6"
@@ -372,6 +376,12 @@ version = "1.4.0"
372376
source = "registry+https://github.com/rust-lang/crates.io-index"
373377
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
374378

379+
[[package]]
380+
name = "levenshtein"
381+
version = "1.0.5"
382+
source = "registry+https://github.com/rust-lang/crates.io-index"
383+
checksum = "db13adb97ab515a3691f56e4dbab09283d0b86cb45abd991d8634a9d6f501760"
384+
375385
[[package]]
376386
name = "libc"
377387
version = "0.2.148"
@@ -937,10 +947,11 @@ dependencies = [
937947

938948
[[package]]
939949
name = "ui_test"
940-
version = "0.14.2"
950+
version = "0.21.1"
941951
source = "registry+https://github.com/rust-lang/crates.io-index"
942-
checksum = "33d15b71b50d95aeb687f68289543b9cabdbec7afc277176ce9dfcf192c7035d"
952+
checksum = "accffe020b57a6dd50014d457b5842c5a2ca73cd84f07d86d0a19c460a6509ae"
943953
dependencies = [
954+
"annotate-snippets",
944955
"anyhow",
945956
"bstr",
946957
"cargo-platform",
@@ -949,9 +960,9 @@ dependencies = [
949960
"colored",
950961
"comma",
951962
"crossbeam-channel",
952-
"distance",
953963
"indicatif",
954964
"lazy_static",
965+
"levenshtein",
955966
"prettydiff",
956967
"regex",
957968
"rustc_version",
@@ -1147,3 +1158,12 @@ name = "windows_x86_64_msvc"
11471158
version = "0.48.0"
11481159
source = "registry+https://github.com/rust-lang/crates.io-index"
11491160
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
1161+
1162+
[[package]]
1163+
name = "yansi-term"
1164+
version = "0.1.2"
1165+
source = "registry+https://github.com/rust-lang/crates.io-index"
1166+
checksum = "fe5c30ade05e61656247b2e334a031dfd0cc466fadef865bdcdea8d537951bf1"
1167+
dependencies = [
1168+
"winapi",
1169+
]

src/tools/miri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ libloading = "0.7"
3636

3737
[dev-dependencies]
3838
colored = "2"
39-
ui_test = "0.14.1"
39+
ui_test = "0.21.1"
4040
rustc_version = "0.4"
4141
# Features chosen to match those required by env_logger, to avoid rebuilds
4242
regex = { version = "1.5.5", default-features = false, features = ["perf", "std"] }

src/tools/miri/tests/compiletest.rs

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::num::NonZeroUsize;
55
use std::path::{Path, PathBuf};
66
use std::{env, process::Command};
77
use ui_test::{color_eyre::Result, Config, Match, Mode, OutputConflictHandling};
8-
use ui_test::{status_emitter, CommandBuilder};
8+
use ui_test::{status_emitter, CommandBuilder, Format, RustfixMode};
99

1010
fn miri_path() -> PathBuf {
1111
PathBuf::from(option_env!("MIRI").unwrap_or(env!("CARGO_BIN_EXE_miri")))
@@ -79,25 +79,17 @@ fn test_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) ->
7979
program.args.push(flag);
8080
}
8181

82-
let bless = env::var_os("RUSTC_BLESS").is_some_and(|v| v != "0");
83-
let skip_ui_checks = env::var_os("MIRI_SKIP_UI_CHECKS").is_some();
84-
85-
let output_conflict_handling = match (bless, skip_ui_checks) {
86-
(false, false) => OutputConflictHandling::Error("./miri test --bless".into()),
87-
(true, false) => OutputConflictHandling::Bless,
88-
(false, true) => OutputConflictHandling::Ignore,
89-
(true, true) => panic!("cannot use RUSTC_BLESS and MIRI_SKIP_UI_CHECKS at the same time"),
90-
};
91-
9282
let mut config = Config {
9383
target: Some(target.to_owned()),
9484
stderr_filters: STDERR.clone(),
9585
stdout_filters: STDOUT.clone(),
9686
mode,
9787
program,
98-
output_conflict_handling,
9988
out_dir: PathBuf::from(std::env::var_os("CARGO_TARGET_DIR").unwrap()).join("ui"),
10089
edition: Some("2021".into()),
90+
threads: std::env::var("MIRI_TEST_THREADS")
91+
.ok()
92+
.map(|threads| NonZeroUsize::new(threads.parse().unwrap()).unwrap()),
10193
..Config::rustc(path)
10294
};
10395

@@ -121,25 +113,31 @@ fn test_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) ->
121113
}
122114

123115
fn run_tests(mode: Mode, path: &str, target: &str, with_dependencies: bool) -> Result<()> {
124-
let config = test_config(target, path, mode, with_dependencies);
116+
let mut config = test_config(target, path, mode, with_dependencies);
125117

126118
// Handle command-line arguments.
127-
let args = ui_test::Args::test();
128-
let quiet = args.quiet;
119+
let args = ui_test::Args::test()?;
120+
let default_bless = env::var_os("RUSTC_BLESS").is_some_and(|v| v != "0");
121+
config.with_args(&args, default_bless);
122+
if let OutputConflictHandling::Error(msg) = &mut config.output_conflict_handling {
123+
*msg = "./miri test --bless".into();
124+
}
125+
if env::var_os("MIRI_SKIP_UI_CHECKS").is_some() {
126+
assert!(!default_bless, "cannot use RUSTC_BLESS and MIRI_SKIP_UI_CHECKS at the same time");
127+
config.output_conflict_handling = OutputConflictHandling::Ignore;
128+
}
129129
eprintln!(" Compiler: {}", config.program.display());
130130
ui_test::run_tests_generic(
131131
vec![config],
132-
std::env::var("MIRI_TEST_THREADS").map_or_else(
133-
|_| std::thread::available_parallelism().unwrap(),
134-
|threads| NonZeroUsize::new(threads.parse().unwrap()).unwrap(),
135-
),
136-
args,
137132
// The files we're actually interested in (all `.rs` files).
138133
ui_test::default_file_filter,
139134
// This could be used to overwrite the `Config` on a per-test basis.
140-
|_, _| {},
135+
|_, _, _| {},
141136
(
142-
if quiet { status_emitter::Text::quiet() } else { status_emitter::Text::verbose() },
137+
match args.format {
138+
Format::Terse => status_emitter::Text::quiet(),
139+
Format::Pretty => status_emitter::Text::verbose(),
140+
},
143141
status_emitter::Gha::</* GHA Actions groups*/ false> {
144142
name: format!("{mode:?} {path} ({target})"),
145143
},
@@ -244,21 +242,21 @@ fn main() -> Result<()> {
244242
ui(Mode::Pass, "tests/pass-dep", &target, WithDependencies)?;
245243
ui(Mode::Panic, "tests/panic", &target, WithDependencies)?;
246244
ui(
247-
Mode::Fail { require_patterns: true, rustfix: false },
245+
Mode::Fail { require_patterns: true, rustfix: RustfixMode::Disabled },
248246
"tests/fail",
249247
&target,
250248
WithoutDependencies,
251249
)?;
252250
ui(
253-
Mode::Fail { require_patterns: true, rustfix: false },
251+
Mode::Fail { require_patterns: true, rustfix: RustfixMode::Disabled },
254252
"tests/fail-dep",
255253
&target,
256254
WithDependencies,
257255
)?;
258256
if cfg!(target_os = "linux") {
259257
ui(Mode::Pass, "tests/extern-so/pass", &target, WithoutDependencies)?;
260258
ui(
261-
Mode::Fail { require_patterns: true, rustfix: false },
259+
Mode::Fail { require_patterns: true, rustfix: RustfixMode::Disabled },
262260
"tests/extern-so/fail",
263261
&target,
264262
WithoutDependencies,
@@ -270,8 +268,12 @@ fn main() -> Result<()> {
270268

271269
fn run_dep_mode(target: String, mut args: impl Iterator<Item = OsString>) -> Result<()> {
272270
let path = args.next().expect("./miri run-dep must be followed by a file name");
273-
let mut config =
274-
test_config(&target, "", Mode::Yolo { rustfix: false }, /* with dependencies */ true);
271+
let mut config = test_config(
272+
&target,
273+
"",
274+
Mode::Yolo { rustfix: RustfixMode::Disabled },
275+
/* with dependencies */ true,
276+
);
275277
config.program.args.clear(); // We want to give the user full control over flags
276278
let dep_args = config.build_dependencies()?;
277279

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
$DIR/backtrace-api-v0.rs:24:14 (func_d)
22
$DIR/backtrace-api-v0.rs:20:5 (func_c)
3-
$DIR/backtrace-api-v0.rs:9:5 (func_b)
3+
$DIR/backtrace-api-v0.rs:9:5 (func_b::<u8>)
44
$DIR/backtrace-api-v0.rs:5:5 (func_a)
55
$DIR/backtrace-api-v0.rs:29:18 (main)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
$DIR/backtrace-api-v1.rs:27:9 (func_d)
22
$DIR/backtrace-api-v1.rs:20:5 (func_c)
3-
$DIR/backtrace-api-v1.rs:9:5 (func_b)
3+
$DIR/backtrace-api-v1.rs:9:5 (func_b::<u8>)
44
$DIR/backtrace-api-v1.rs:5:5 (func_a)
55
$DIR/backtrace-api-v1.rs:34:18 (main)

0 commit comments

Comments
 (0)