Skip to content

Commit 7514c69

Browse files
committed
Bump ui test crate
1 parent cc9c5d6 commit 7514c69

File tree

3 files changed

+115
-50
lines changed

3 files changed

+115
-50
lines changed

Cargo.lock

Lines changed: 94 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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.11.7"
39+
ui_test = "0.14"
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"] }

tests/compiletest.rs

Lines changed: 20 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ fn test_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) ->
9797
output_conflict_handling,
9898
out_dir: PathBuf::from(std::env::var_os("CARGO_TARGET_DIR").unwrap()).join("ui"),
9999
edition: Some("2021".into()),
100-
..Config::rustc(path.into())
100+
..Config::rustc(path)
101101
};
102102

103103
let use_std = env::var_os("MIRI_NO_STD").is_none();
@@ -123,49 +123,19 @@ fn run_tests(mode: Mode, path: &str, target: &str, with_dependencies: bool) -> R
123123
let config = test_config(target, path, mode, with_dependencies);
124124

125125
// Handle command-line arguments.
126-
let mut after_dashdash = false;
127-
let mut quiet = false;
128-
let filters = std::env::args()
129-
.skip(1)
130-
.filter(|arg| {
131-
if after_dashdash {
132-
// Just propagate everything.
133-
return true;
134-
}
135-
match &**arg {
136-
"--quiet" => {
137-
quiet = true;
138-
false
139-
}
140-
"--" => {
141-
after_dashdash = true;
142-
false
143-
}
144-
s if s.starts_with('-') => {
145-
panic!("unknown compiletest flag `{s}`");
146-
}
147-
_ => true,
148-
}
149-
})
150-
.collect::<Vec<_>>();
126+
let args = ui_test::Args::test();
127+
let quiet = args.quiet;
151128
eprintln!(" Compiler: {}", config.program.display());
152129
ui_test::run_tests_generic(
153-
config,
130+
vec![config],
131+
std::thread::available_parallelism().unwrap(),
132+
args,
154133
// The files we're actually interested in (all `.rs` files).
155-
|path| {
156-
path.extension().is_some_and(|ext| ext == "rs")
157-
&& (filters.is_empty()
158-
|| filters.iter().any(|f| path.display().to_string().contains(f)))
159-
},
134+
ui_test::default_file_filter,
160135
// This could be used to overwrite the `Config` on a per-test basis.
161-
|_, _| None,
136+
|_, _| {},
162137
(
163-
if quiet {
164-
Box::<status_emitter::Quiet>::default()
165-
as Box<dyn status_emitter::StatusEmitter + Send>
166-
} else {
167-
Box::new(status_emitter::Text)
168-
},
138+
if quiet { status_emitter::Text::quiet() } else { status_emitter::Text::verbose() },
169139
status_emitter::Gha::</* GHA Actions groups*/ false> {
170140
name: format!("{mode:?} {path} ({target})"),
171141
},
@@ -269,11 +239,16 @@ fn main() -> Result<()> {
269239
ui(Mode::Pass, "tests/pass", &target, WithoutDependencies)?;
270240
ui(Mode::Pass, "tests/pass-dep", &target, WithDependencies)?;
271241
ui(Mode::Panic, "tests/panic", &target, WithDependencies)?;
272-
ui(Mode::Fail { require_patterns: true }, "tests/fail", &target, WithDependencies)?;
242+
ui(
243+
Mode::Fail { require_patterns: true, rustfix: false },
244+
"tests/fail",
245+
&target,
246+
WithDependencies,
247+
)?;
273248
if cfg!(target_os = "linux") {
274249
ui(Mode::Pass, "tests/extern-so/pass", &target, WithoutDependencies)?;
275250
ui(
276-
Mode::Fail { require_patterns: true },
251+
Mode::Fail { require_patterns: true, rustfix: false },
277252
"tests/extern-so/fail",
278253
&target,
279254
WithoutDependencies,
@@ -285,11 +260,13 @@ fn main() -> Result<()> {
285260

286261
fn run_dep_mode(target: String, mut args: impl Iterator<Item = OsString>) -> Result<()> {
287262
let path = args.next().expect("./miri run-dep must be followed by a file name");
288-
let mut config = test_config(&target, "", Mode::Yolo, /* with dependencies */ true);
263+
let mut config =
264+
test_config(&target, "", Mode::Yolo { rustfix: false }, /* with dependencies */ true);
289265
config.program.args.clear(); // We want to give the user full control over flags
290-
config.build_dependencies_and_link_them()?;
266+
let dep_args = config.build_dependencies()?;
291267

292268
let mut cmd = config.program.build(&config.out_dir);
269+
cmd.args(dep_args);
293270

294271
cmd.arg(path);
295272

0 commit comments

Comments
 (0)