Skip to content

Commit acdffd7

Browse files
committed
Auto merge of #11427 - oli-obk:ui_test_bump, r=Alexendoo
Bump ui_test This makes `ui_test` parse `--bless` and allows a follow up change to use `Mode::Error` (instead of `Mode::Yolo`) with `RustfixMode::Everything` changelog: none
2 parents c1f8ae3 + aeed86c commit acdffd7

File tree

2 files changed

+14
-26
lines changed

2 files changed

+14
-26
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ tempfile = { version = "3.2", optional = true }
2727
termize = "0.1"
2828

2929
[dev-dependencies]
30-
ui_test = "0.17.0"
30+
ui_test = "0.20"
3131
tester = "0.9"
3232
regex = "1.5"
3333
toml = "0.7.3"

tests/compile-test.rs

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -114,34 +114,26 @@ fn canonicalize(path: impl AsRef<Path>) -> PathBuf {
114114
}
115115

116116
fn base_config(test_dir: &str) -> (Config, Args) {
117-
let bless = var_os("RUSTC_BLESS").is_some_and(|v| v != "0") || env::args().any(|arg| arg == "--bless");
118-
119-
let args = Args {
120-
filters: env::var("TESTNAME")
121-
.map(|filters| filters.split(',').map(str::to_string).collect())
122-
.unwrap_or_default(),
123-
quiet: false,
124-
check: !bless,
125-
threads: match std::env::var_os("RUST_TEST_THREADS") {
126-
Some(n) => n.to_str().unwrap().parse().unwrap(),
127-
None => std::thread::available_parallelism().unwrap(),
128-
},
129-
skip: Vec::new(),
130-
};
117+
let mut args = Args::test().unwrap();
118+
args.bless |= var_os("RUSTC_BLESS").is_some_and(|v| v != "0");
131119

132120
let mut config = Config {
133-
mode: Mode::Yolo { rustfix: true },
121+
mode: Mode::Yolo {
122+
rustfix: ui_test::RustfixMode::Everything,
123+
},
134124
stderr_filters: vec![(Match::PathBackslash, b"/")],
135125
stdout_filters: vec![],
136-
output_conflict_handling: if bless {
137-
OutputConflictHandling::Bless
138-
} else {
139-
OutputConflictHandling::Error("cargo uibless".into())
140-
},
126+
filter_files: env::var("TESTNAME")
127+
.map(|filters| filters.split(',').map(str::to_string).collect())
128+
.unwrap_or_default(),
141129
target: None,
142130
out_dir: canonicalize(var_os("CARGO_TARGET_DIR").unwrap_or_else(|| "target".into())).join("ui_test"),
143131
..Config::rustc(Path::new("tests").join(test_dir))
144132
};
133+
config.with_args(&args, /* bless by default */ false);
134+
if let OutputConflictHandling::Error(err) = &mut config.output_conflict_handling {
135+
*err = "cargo uibless".into();
136+
}
145137
let current_exe_path = env::current_exe().unwrap();
146138
let deps_path = current_exe_path.parent().unwrap();
147139
let profile_path = deps_path.parent().unwrap();
@@ -184,7 +176,6 @@ fn run_ui() {
184176

185177
ui_test::run_tests_generic(
186178
vec![config],
187-
args,
188179
ui_test::default_file_filter,
189180
ui_test::default_per_file_config,
190181
if quiet {
@@ -209,7 +200,6 @@ fn run_internal_tests() {
209200

210201
ui_test::run_tests_generic(
211202
vec![config],
212-
args,
213203
ui_test::default_file_filter,
214204
ui_test::default_per_file_config,
215205
if quiet {
@@ -243,7 +233,6 @@ fn run_ui_toml() {
243233

244234
ui_test::run_tests_generic(
245235
vec![config],
246-
args,
247236
ui_test::default_file_filter,
248237
|config, path, _file_contents| {
249238
config
@@ -302,8 +291,7 @@ fn run_ui_cargo() {
302291

303292
ui_test::run_tests_generic(
304293
vec![config],
305-
args,
306-
|path, args, _config| path.ends_with("Cargo.toml") && ui_test::default_filter_by_arg(path, args),
294+
|path, config| path.ends_with("Cargo.toml") && ui_test::default_any_file_filter(path, config),
307295
|config, path, _file_contents| {
308296
config.out_dir = canonicalize(
309297
std::env::current_dir()

0 commit comments

Comments
 (0)