Update to new ui_test crate

This commit is contained in:
Oli Scherer 2023-04-06 16:11:53 +00:00
parent fa8e02f634
commit 6c8cf4e6af
6 changed files with 32 additions and 16 deletions

View File

@ -26,6 +26,12 @@ dependencies = [
"memchr",
]
[[package]]
name = "anyhow"
version = "1.0.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4"
[[package]]
name = "atty"
version = "0.2.14"
@ -570,6 +576,18 @@ dependencies = [
"semver",
]
[[package]]
name = "rustfix"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecd2853d9e26988467753bd9912c3a126f642d05d229a4b53f5752ee36c56481"
dependencies = [
"anyhow",
"log",
"serde",
"serde_json",
]
[[package]]
name = "ryu"
version = "1.0.12"
@ -744,11 +762,12 @@ dependencies = [
[[package]]
name = "ui_test"
version = "0.5.0"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54ddb6f31025943e2f9d59237f433711c461a43d9415974c3eb3a4902edc1c1f"
checksum = "3e10f5f88ce8c331a388deda1e6e2bd533c73ca89cc5f539a3df02ed35c8efba"
dependencies = [
"bstr",
"cargo-platform",
"cargo_metadata",
"color-eyre",
"colored",
@ -757,6 +776,7 @@ dependencies = [
"lazy_static",
"regex",
"rustc_version",
"rustfix",
"serde",
"serde_json",
"tempfile",

View File

@ -39,7 +39,7 @@ libloading = "0.7"
[dev-dependencies]
colored = "2"
ui_test = "0.5"
ui_test = "0.6.2"
rustc_version = "0.4"
# Features chosen to match those required by env_logger, to avoid rebuilds
regex = { version = "1.5.5", default-features = false, features = ["perf", "std"] }

View File

@ -2,7 +2,7 @@
use regex::bytes::Regex;
use std::path::{Path, PathBuf};
use std::{env, process::Command};
use ui_test::{color_eyre::Result, Config, Mode, OutputConflictHandling};
use ui_test::{color_eyre::Result, Config, Match, Mode, OutputConflictHandling};
fn miri_path() -> PathBuf {
PathBuf::from(option_env!("MIRI").unwrap_or(env!("CARGO_BIN_EXE_miri")))
@ -52,14 +52,13 @@ fn run_tests(mode: Mode, path: &str, target: &str, with_dependencies: bool) -> R
mode,
program: miri_path(),
quiet: false,
edition: Some("2018".into()),
..Config::default()
};
let in_rustc_test_suite = option_env!("RUSTC_STAGE").is_some();
// Add some flags we always want.
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.)
@ -129,8 +128,8 @@ fn run_tests(mode: Mode, path: &str, target: &str, with_dependencies: bool) -> R
macro_rules! regexes {
($name:ident: $($regex:expr => $replacement:expr,)*) => {lazy_static::lazy_static! {
static ref $name: Vec<(Regex, &'static [u8])> = vec![
$((Regex::new($regex).unwrap(), $replacement.as_bytes()),)*
static ref $name: Vec<(Match, &'static [u8])> = vec![
$((Regex::new($regex).unwrap().into(), $replacement.as_bytes()),)*
];
}};
}

View File

@ -12,14 +12,13 @@ fn drop(&mut self) {}
#[inline(always)]
fn has_cleanup() {
//~^ ERROR: panic in a function that cannot unwind
// FIXME(nbdd0121): The error should be reported at the call site.
let _f = Foo;
panic!();
}
extern "C" fn panic_abort() {
has_cleanup();
//~^ ERROR: panic in a function that cannot unwind
}
fn main() {

View File

@ -6,8 +6,6 @@ error: abnormal termination: panic in a function that cannot unwind
--> $DIR/terminate-terminator.rs:LL:CC
|
LL | / fn has_cleanup() {
LL | |
LL | | // FIXME(nbdd0121): The error should be reported at the call site.
LL | | let _f = Foo;
LL | | panic!();
LL | | }

View File

@ -23,17 +23,17 @@ fn not_so_innocent(x: &mut u32) -> usize {
let mut c = 42u32;
let x_unique1 = &mut c;
// [..., Unique(1)]
// stack: [..., Unique(1)]
let x_raw2 = x_unique1 as *mut u32;
let x_raw2_addr = x_raw2.expose_addr();
// [..., Unique(1), SharedRW(2)]
// stack: [..., Unique(1), SharedRW(2)]
let x_unique3 = &mut *x_raw2;
// [.., Unique(1), SharedRW(2), Unique(3)]
// stack: [.., Unique(1), SharedRW(2), Unique(3)]
assert_eq!(not_so_innocent(x_unique3), x_raw2_addr);
// [.., Unique(1), SharedRW(2), Unique(3), ..., SharedRW(4)]
// stack: [.., Unique(1), SharedRW(2), Unique(3), ..., SharedRW(4)]
// Do an int2ptr cast. This can pick tag 2 or 4 (the two previously exposed tags).
// 4 is the "obvious" choice (topmost tag, what we used to do with untagged pointers).