Auto merge of #2521 - oli-obk:bump_ui_test, r=RalfJung

Bump UI test dependency

This gives us the new diff renderer as well as the ability to run tests without parallelism if we'd want to.
This commit is contained in:
bors 2022-08-31 11:37:27 +00:00
commit feeeba2925
3 changed files with 50 additions and 94 deletions

50
Cargo.lock generated
View file

@ -32,15 +32,6 @@ dependencies = [
"memchr",
]
[[package]]
name = "ansi_term"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
dependencies = [
"winapi",
]
[[package]]
name = "atty"
version = "0.2.14"
@ -229,21 +220,11 @@ dependencies = [
"lazy_static",
]
[[package]]
name = "ctor"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c"
dependencies = [
"quote",
"syn",
]
[[package]]
name = "diff"
version = "0.1.12"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e25ea47919b1560c4e3b7fe0aaab9becf5b84a10325ddf7db0f0ba5e1026499"
checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
[[package]]
name = "env_logger"
@ -464,15 +445,6 @@ version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1"
[[package]]
name = "output_vt100"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66"
dependencies = [
"winapi",
]
[[package]]
name = "owo-colors"
version = "3.4.0"
@ -525,18 +497,6 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba"
[[package]]
name = "pretty_assertions"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c89f989ac94207d048d92db058e4f6ec7342b0971fc58d1271ca148b799b3563"
dependencies = [
"ansi_term",
"ctor",
"diff",
"output_vt100",
]
[[package]]
name = "proc-macro2"
version = "1.0.39"
@ -794,16 +754,16 @@ dependencies = [
[[package]]
name = "ui_test"
version = "0.1.1"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a7bfdb147f57c498ca629c7802b57899de0bb82ae36b6f01f1540da41832f1"
checksum = "7d1f546a5883ae78da735bba529ec1116661e2f73582f23920d994dc97da3a22"
dependencies = [
"cargo_metadata",
"color-eyre",
"colored",
"crossbeam",
"diff",
"lazy_static",
"pretty_assertions",
"regex",
"rustc_version",
"serde",

View file

@ -40,7 +40,7 @@ libc = "0.2"
[dev-dependencies]
colored = "2"
ui_test = "0.1"
ui_test = "0.3.1"
# Features chosen to match those required by env_logger, to avoid rebuilds
regex = { version = "1.5.5", default-features = false, features = ["perf", "std"] }
lazy_static = "1.4.0"

View file

@ -1,8 +1,8 @@
use colored::*;
use regex::Regex;
use std::path::{Path, PathBuf};
use std::{env, ffi::OsString, process::Command};
use ui_test::{color_eyre::Result, Config, DependencyBuilder, Mode, OutputConflictHandling};
use std::{env, process::Command};
use ui_test::{color_eyre::Result, Config, Mode, OutputConflictHandling};
fn miri_path() -> PathBuf {
PathBuf::from(option_env!("MIRI").unwrap_or(env!("CARGO_BIN_EXE_miri")))
@ -43,30 +43,40 @@ fn run_tests(
target: Option<String>,
with_dependencies: bool,
) -> Result<()> {
let mut config = Config {
target,
stderr_filters: STDERR.clone(),
stdout_filters: STDOUT.clone(),
root_dir: PathBuf::from(path),
mode,
program: miri_path(),
quiet: false,
..Config::default()
};
let in_rustc_test_suite = option_env!("RUSTC_STAGE").is_some();
// Add some flags we always want.
let mut flags: Vec<OsString> = Vec::new();
flags.push("--edition".into());
flags.push("2018".into());
config.args.push("--edition".into());
config.args.push("2018".into());
if in_rustc_test_suite {
// Less aggressive warnings to make the rustc toolstate management less painful.
// (We often get warnings when e.g. a feature gets stabilized or some lint gets added/improved.)
flags.push("-Astable-features".into());
flags.push("-Aunused".into());
config.args.push("-Astable-features".into());
config.args.push("-Aunused".into());
} else {
flags.push("-Dwarnings".into());
flags.push("-Dunused".into());
config.args.push("-Dwarnings".into());
config.args.push("-Dunused".into());
}
if let Ok(extra_flags) = env::var("MIRIFLAGS") {
for flag in extra_flags.split_whitespace() {
flags.push(flag.into());
config.args.push(flag.into());
}
}
flags.push("-Zui-testing".into());
if let Some(target) = &target {
flags.push("--target".into());
flags.push(target.into());
config.args.push("-Zui-testing".into());
if let Some(target) = &config.target {
config.args.push("--target".into());
config.args.push(target.into());
}
// If we're on linux, and we're testing the extern-so functionality,
@ -76,57 +86,43 @@ fn run_tests(
let so_file_path = build_so_for_c_ffi_tests();
let mut flag = std::ffi::OsString::from("-Zmiri-extern-so-file=");
flag.push(so_file_path.into_os_string());
flags.push(flag);
config.args.push(flag);
}
let skip_ui_checks = env::var_os("MIRI_SKIP_UI_CHECKS").is_some();
let output_conflict_handling = match (env::var_os("MIRI_BLESS").is_some(), skip_ui_checks) {
config.output_conflict_handling = match (env::var_os("MIRI_BLESS").is_some(), skip_ui_checks) {
(false, false) => OutputConflictHandling::Error,
(true, false) => OutputConflictHandling::Bless,
(false, true) => OutputConflictHandling::Ignore,
(true, true) => panic!("cannot use MIRI_BLESS and MIRI_SKIP_UI_CHECKS at the same time"),
};
// Pass on all unknown arguments as filters.
let mut quiet = false;
let path_filter = std::env::args().skip(1).filter(|arg| {
// Handle command-line arguments.
config.path_filter.extend(std::env::args().skip(1).filter(|arg| {
match &**arg {
"--quiet" => {
quiet = true;
config.quiet = true;
false
}
_ => true,
}
});
}));
let use_std = env::var_os("MIRI_NO_STD").is_none();
let config = Config {
args: flags,
target,
stderr_filters: STDERR.clone(),
stdout_filters: STDOUT.clone(),
root_dir: PathBuf::from(path),
mode,
path_filter: path_filter.collect(),
program: miri_path(),
output_conflict_handling,
dependencies_crate_manifest_path: (with_dependencies && use_std)
.then(|| Path::new("test_dependencies").join("Cargo.toml")),
dependency_builder: Some(DependencyBuilder {
program: std::env::var_os("CARGO").unwrap().into(),
args: vec![
"run".into(),
"--manifest-path".into(),
"cargo-miri/Cargo.toml".into(),
"--".into(),
"miri".into(),
],
envs: vec![],
}),
quiet,
};
if with_dependencies && use_std {
config.dependencies_crate_manifest_path =
Some(Path::new("test_dependencies").join("Cargo.toml"));
config.dependency_builder.args = vec![
"run".into(),
"--manifest-path".into(),
"cargo-miri/Cargo.toml".into(),
"--".into(),
"miri".into(),
"run".into(), // There is no `cargo miri build` so we just use `cargo miri run`.
];
}
ui_test::run_tests(config)
}
@ -214,10 +210,10 @@ fn main() -> Result<()> {
ui(Mode::Pass, "tests/pass", WithoutDependencies)?;
ui(Mode::Pass, "tests/pass-dep", WithDependencies)?;
ui(Mode::Panic, "tests/panic", WithDependencies)?;
ui(Mode::Fail, "tests/fail", WithDependencies)?;
ui(Mode::Fail { require_patterns: true }, "tests/fail", WithDependencies)?;
if cfg!(target_os = "linux") {
ui(Mode::Pass, "tests/extern-so/pass", WithoutDependencies)?;
ui(Mode::Fail, "tests/extern-so/fail", WithDependencies)?;
ui(Mode::Fail { require_patterns: true }, "tests/extern-so/fail", WithDependencies)?;
}
Ok(())