Bump ui_test crate
This commit is contained in:
parent
e706367941
commit
9f4e7c6945
@ -26,6 +26,16 @@ dependencies = [
|
|||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "annotate-snippets"
|
||||||
|
version = "0.9.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c3b9d411ecbaf79885c6df4d75fff75858d5995ff25385657a28af47e82f9c36"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-width",
|
||||||
|
"yansi-term",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ansi_term"
|
name = "ansi_term"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
@ -216,12 +226,6 @@ dependencies = [
|
|||||||
"windows-sys 0.45.0",
|
"windows-sys 0.45.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "distance"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6d9d8664cf849d7d0f3114a3a387d2f5e4303176d746d5a951aaddc66dfe9240"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "encode_unicode"
|
name = "encode_unicode"
|
||||||
version = "0.3.6"
|
version = "0.3.6"
|
||||||
@ -372,6 +376,12 @@ version = "1.4.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "levenshtein"
|
||||||
|
version = "1.0.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "db13adb97ab515a3691f56e4dbab09283d0b86cb45abd991d8634a9d6f501760"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.148"
|
version = "0.2.148"
|
||||||
@ -937,10 +947,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ui_test"
|
name = "ui_test"
|
||||||
version = "0.14.2"
|
version = "0.21.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "33d15b71b50d95aeb687f68289543b9cabdbec7afc277176ce9dfcf192c7035d"
|
checksum = "accffe020b57a6dd50014d457b5842c5a2ca73cd84f07d86d0a19c460a6509ae"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"annotate-snippets",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bstr",
|
"bstr",
|
||||||
"cargo-platform",
|
"cargo-platform",
|
||||||
@ -949,9 +960,9 @@ dependencies = [
|
|||||||
"colored",
|
"colored",
|
||||||
"comma",
|
"comma",
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"distance",
|
|
||||||
"indicatif",
|
"indicatif",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
"levenshtein",
|
||||||
"prettydiff",
|
"prettydiff",
|
||||||
"regex",
|
"regex",
|
||||||
"rustc_version",
|
"rustc_version",
|
||||||
@ -1147,3 +1158,12 @@ name = "windows_x86_64_msvc"
|
|||||||
version = "0.48.0"
|
version = "0.48.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
|
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "yansi-term"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fe5c30ade05e61656247b2e334a031dfd0cc466fadef865bdcdea8d537951bf1"
|
||||||
|
dependencies = [
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
@ -36,7 +36,7 @@ libloading = "0.7"
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
colored = "2"
|
colored = "2"
|
||||||
ui_test = "0.14.1"
|
ui_test = "0.21.1"
|
||||||
rustc_version = "0.4"
|
rustc_version = "0.4"
|
||||||
# Features chosen to match those required by env_logger, to avoid rebuilds
|
# Features chosen to match those required by env_logger, to avoid rebuilds
|
||||||
regex = { version = "1.5.5", default-features = false, features = ["perf", "std"] }
|
regex = { version = "1.5.5", default-features = false, features = ["perf", "std"] }
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::{env, process::Command};
|
use std::{env, process::Command};
|
||||||
use ui_test::{color_eyre::Result, Config, Match, Mode, OutputConflictHandling};
|
use ui_test::{color_eyre::Result, Config, Match, Mode, OutputConflictHandling};
|
||||||
use ui_test::{status_emitter, CommandBuilder};
|
use ui_test::{status_emitter, CommandBuilder, Format, RustfixMode};
|
||||||
|
|
||||||
fn miri_path() -> PathBuf {
|
fn miri_path() -> PathBuf {
|
||||||
PathBuf::from(option_env!("MIRI").unwrap_or(env!("CARGO_BIN_EXE_miri")))
|
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) ->
|
|||||||
program.args.push(flag);
|
program.args.push(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
let bless = env::var_os("RUSTC_BLESS").is_some_and(|v| v != "0");
|
|
||||||
let skip_ui_checks = env::var_os("MIRI_SKIP_UI_CHECKS").is_some();
|
|
||||||
|
|
||||||
let output_conflict_handling = match (bless, skip_ui_checks) {
|
|
||||||
(false, false) => OutputConflictHandling::Error("./miri test --bless".into()),
|
|
||||||
(true, false) => OutputConflictHandling::Bless,
|
|
||||||
(false, true) => OutputConflictHandling::Ignore,
|
|
||||||
(true, true) => panic!("cannot use RUSTC_BLESS and MIRI_SKIP_UI_CHECKS at the same time"),
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut config = Config {
|
let mut config = Config {
|
||||||
target: Some(target.to_owned()),
|
target: Some(target.to_owned()),
|
||||||
stderr_filters: STDERR.clone(),
|
stderr_filters: STDERR.clone(),
|
||||||
stdout_filters: STDOUT.clone(),
|
stdout_filters: STDOUT.clone(),
|
||||||
mode,
|
mode,
|
||||||
program,
|
program,
|
||||||
output_conflict_handling,
|
|
||||||
out_dir: PathBuf::from(std::env::var_os("CARGO_TARGET_DIR").unwrap()).join("ui"),
|
out_dir: PathBuf::from(std::env::var_os("CARGO_TARGET_DIR").unwrap()).join("ui"),
|
||||||
edition: Some("2021".into()),
|
edition: Some("2021".into()),
|
||||||
|
threads: std::env::var("MIRI_TEST_THREADS")
|
||||||
|
.ok()
|
||||||
|
.map(|threads| NonZeroUsize::new(threads.parse().unwrap()).unwrap()),
|
||||||
..Config::rustc(path)
|
..Config::rustc(path)
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -121,25 +113,31 @@ fn test_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) ->
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn run_tests(mode: Mode, path: &str, target: &str, with_dependencies: bool) -> Result<()> {
|
fn run_tests(mode: Mode, path: &str, target: &str, with_dependencies: bool) -> Result<()> {
|
||||||
let config = test_config(target, path, mode, with_dependencies);
|
let mut config = test_config(target, path, mode, with_dependencies);
|
||||||
|
|
||||||
// Handle command-line arguments.
|
// Handle command-line arguments.
|
||||||
let args = ui_test::Args::test();
|
let args = ui_test::Args::test()?;
|
||||||
let quiet = args.quiet;
|
let default_bless = env::var_os("RUSTC_BLESS").is_some_and(|v| v != "0");
|
||||||
|
config.with_args(&args, default_bless);
|
||||||
|
if let OutputConflictHandling::Error(msg) = &mut config.output_conflict_handling {
|
||||||
|
*msg = "./miri test --bless".into();
|
||||||
|
}
|
||||||
|
if env::var_os("MIRI_SKIP_UI_CHECKS").is_some() {
|
||||||
|
assert!(!default_bless, "cannot use RUSTC_BLESS and MIRI_SKIP_UI_CHECKS at the same time");
|
||||||
|
config.output_conflict_handling = OutputConflictHandling::Ignore;
|
||||||
|
}
|
||||||
eprintln!(" Compiler: {}", config.program.display());
|
eprintln!(" Compiler: {}", config.program.display());
|
||||||
ui_test::run_tests_generic(
|
ui_test::run_tests_generic(
|
||||||
vec![config],
|
vec![config],
|
||||||
std::env::var("MIRI_TEST_THREADS").map_or_else(
|
|
||||||
|_| std::thread::available_parallelism().unwrap(),
|
|
||||||
|threads| NonZeroUsize::new(threads.parse().unwrap()).unwrap(),
|
|
||||||
),
|
|
||||||
args,
|
|
||||||
// The files we're actually interested in (all `.rs` files).
|
// The files we're actually interested in (all `.rs` files).
|
||||||
ui_test::default_file_filter,
|
ui_test::default_file_filter,
|
||||||
// This could be used to overwrite the `Config` on a per-test basis.
|
// This could be used to overwrite the `Config` on a per-test basis.
|
||||||
|_, _| {},
|
|_, _, _| {},
|
||||||
(
|
(
|
||||||
if quiet { status_emitter::Text::quiet() } else { status_emitter::Text::verbose() },
|
match args.format {
|
||||||
|
Format::Terse => status_emitter::Text::quiet(),
|
||||||
|
Format::Pretty => status_emitter::Text::verbose(),
|
||||||
|
},
|
||||||
status_emitter::Gha::</* GHA Actions groups*/ false> {
|
status_emitter::Gha::</* GHA Actions groups*/ false> {
|
||||||
name: format!("{mode:?} {path} ({target})"),
|
name: format!("{mode:?} {path} ({target})"),
|
||||||
},
|
},
|
||||||
@ -244,13 +242,13 @@ fn main() -> Result<()> {
|
|||||||
ui(Mode::Pass, "tests/pass-dep", &target, WithDependencies)?;
|
ui(Mode::Pass, "tests/pass-dep", &target, WithDependencies)?;
|
||||||
ui(Mode::Panic, "tests/panic", &target, WithDependencies)?;
|
ui(Mode::Panic, "tests/panic", &target, WithDependencies)?;
|
||||||
ui(
|
ui(
|
||||||
Mode::Fail { require_patterns: true, rustfix: false },
|
Mode::Fail { require_patterns: true, rustfix: RustfixMode::Disabled },
|
||||||
"tests/fail",
|
"tests/fail",
|
||||||
&target,
|
&target,
|
||||||
WithoutDependencies,
|
WithoutDependencies,
|
||||||
)?;
|
)?;
|
||||||
ui(
|
ui(
|
||||||
Mode::Fail { require_patterns: true, rustfix: false },
|
Mode::Fail { require_patterns: true, rustfix: RustfixMode::Disabled },
|
||||||
"tests/fail-dep",
|
"tests/fail-dep",
|
||||||
&target,
|
&target,
|
||||||
WithDependencies,
|
WithDependencies,
|
||||||
@ -258,7 +256,7 @@ fn main() -> Result<()> {
|
|||||||
if cfg!(target_os = "linux") {
|
if cfg!(target_os = "linux") {
|
||||||
ui(Mode::Pass, "tests/extern-so/pass", &target, WithoutDependencies)?;
|
ui(Mode::Pass, "tests/extern-so/pass", &target, WithoutDependencies)?;
|
||||||
ui(
|
ui(
|
||||||
Mode::Fail { require_patterns: true, rustfix: false },
|
Mode::Fail { require_patterns: true, rustfix: RustfixMode::Disabled },
|
||||||
"tests/extern-so/fail",
|
"tests/extern-so/fail",
|
||||||
&target,
|
&target,
|
||||||
WithoutDependencies,
|
WithoutDependencies,
|
||||||
@ -270,8 +268,12 @@ fn main() -> Result<()> {
|
|||||||
|
|
||||||
fn run_dep_mode(target: String, mut args: impl Iterator<Item = OsString>) -> Result<()> {
|
fn run_dep_mode(target: String, mut args: impl Iterator<Item = OsString>) -> Result<()> {
|
||||||
let path = args.next().expect("./miri run-dep must be followed by a file name");
|
let path = args.next().expect("./miri run-dep must be followed by a file name");
|
||||||
let mut config =
|
let mut config = test_config(
|
||||||
test_config(&target, "", Mode::Yolo { rustfix: false }, /* with dependencies */ true);
|
&target,
|
||||||
|
"",
|
||||||
|
Mode::Yolo { rustfix: RustfixMode::Disabled },
|
||||||
|
/* with dependencies */ true,
|
||||||
|
);
|
||||||
config.program.args.clear(); // We want to give the user full control over flags
|
config.program.args.clear(); // We want to give the user full control over flags
|
||||||
let dep_args = config.build_dependencies()?;
|
let dep_args = config.build_dependencies()?;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
$DIR/backtrace-api-v0.rs:24:14 (func_d)
|
$DIR/backtrace-api-v0.rs:24:14 (func_d)
|
||||||
$DIR/backtrace-api-v0.rs:20:5 (func_c)
|
$DIR/backtrace-api-v0.rs:20:5 (func_c)
|
||||||
$DIR/backtrace-api-v0.rs:9:5 (func_b)
|
$DIR/backtrace-api-v0.rs:9:5 (func_b::<u8>)
|
||||||
$DIR/backtrace-api-v0.rs:5:5 (func_a)
|
$DIR/backtrace-api-v0.rs:5:5 (func_a)
|
||||||
$DIR/backtrace-api-v0.rs:29:18 (main)
|
$DIR/backtrace-api-v0.rs:29:18 (main)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
$DIR/backtrace-api-v1.rs:27:9 (func_d)
|
$DIR/backtrace-api-v1.rs:27:9 (func_d)
|
||||||
$DIR/backtrace-api-v1.rs:20:5 (func_c)
|
$DIR/backtrace-api-v1.rs:20:5 (func_c)
|
||||||
$DIR/backtrace-api-v1.rs:9:5 (func_b)
|
$DIR/backtrace-api-v1.rs:9:5 (func_b::<u8>)
|
||||||
$DIR/backtrace-api-v1.rs:5:5 (func_a)
|
$DIR/backtrace-api-v1.rs:5:5 (func_a)
|
||||||
$DIR/backtrace-api-v1.rs:34:18 (main)
|
$DIR/backtrace-api-v1.rs:34:18 (main)
|
||||||
|
Loading…
Reference in New Issue
Block a user