Skip to content

Commit 6c8cf4e

Browse files
committed
Update to new ui_test crate
1 parent fa8e02f commit 6c8cf4e

File tree

6 files changed

+32
-16
lines changed

6 files changed

+32
-16
lines changed

src/tools/miri/Cargo.lock

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ dependencies = [
2626
"memchr",
2727
]
2828

29+
[[package]]
30+
name = "anyhow"
31+
version = "1.0.70"
32+
source = "registry+https://github.com/rust-lang/crates.io-index"
33+
checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4"
34+
2935
[[package]]
3036
name = "atty"
3137
version = "0.2.14"
@@ -570,6 +576,18 @@ dependencies = [
570576
"semver",
571577
]
572578

579+
[[package]]
580+
name = "rustfix"
581+
version = "0.6.1"
582+
source = "registry+https://github.com/rust-lang/crates.io-index"
583+
checksum = "ecd2853d9e26988467753bd9912c3a126f642d05d229a4b53f5752ee36c56481"
584+
dependencies = [
585+
"anyhow",
586+
"log",
587+
"serde",
588+
"serde_json",
589+
]
590+
573591
[[package]]
574592
name = "ryu"
575593
version = "1.0.12"
@@ -744,11 +762,12 @@ dependencies = [
744762

745763
[[package]]
746764
name = "ui_test"
747-
version = "0.5.0"
765+
version = "0.6.2"
748766
source = "registry+https://github.com/rust-lang/crates.io-index"
749-
checksum = "54ddb6f31025943e2f9d59237f433711c461a43d9415974c3eb3a4902edc1c1f"
767+
checksum = "3e10f5f88ce8c331a388deda1e6e2bd533c73ca89cc5f539a3df02ed35c8efba"
750768
dependencies = [
751769
"bstr",
770+
"cargo-platform",
752771
"cargo_metadata",
753772
"color-eyre",
754773
"colored",
@@ -757,6 +776,7 @@ dependencies = [
757776
"lazy_static",
758777
"regex",
759778
"rustc_version",
779+
"rustfix",
760780
"serde",
761781
"serde_json",
762782
"tempfile",

src/tools/miri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ libloading = "0.7"
3939

4040
[dev-dependencies]
4141
colored = "2"
42-
ui_test = "0.5"
42+
ui_test = "0.6.2"
4343
rustc_version = "0.4"
4444
# Features chosen to match those required by env_logger, to avoid rebuilds
4545
regex = { version = "1.5.5", default-features = false, features = ["perf", "std"] }

src/tools/miri/tests/compiletest.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use colored::*;
22
use regex::bytes::Regex;
33
use std::path::{Path, PathBuf};
44
use std::{env, process::Command};
5-
use ui_test::{color_eyre::Result, Config, Mode, OutputConflictHandling};
5+
use ui_test::{color_eyre::Result, Config, Match, Mode, OutputConflictHandling};
66

77
fn miri_path() -> PathBuf {
88
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
5252
mode,
5353
program: miri_path(),
5454
quiet: false,
55+
edition: Some("2018".into()),
5556
..Config::default()
5657
};
5758

5859
let in_rustc_test_suite = option_env!("RUSTC_STAGE").is_some();
5960

6061
// Add some flags we always want.
61-
config.args.push("--edition".into());
62-
config.args.push("2018".into());
6362
if in_rustc_test_suite {
6463
// Less aggressive warnings to make the rustc toolstate management less painful.
6564
// (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
129128

130129
macro_rules! regexes {
131130
($name:ident: $($regex:expr => $replacement:expr,)*) => {lazy_static::lazy_static! {
132-
static ref $name: Vec<(Regex, &'static [u8])> = vec![
133-
$((Regex::new($regex).unwrap(), $replacement.as_bytes()),)*
131+
static ref $name: Vec<(Match, &'static [u8])> = vec![
132+
$((Regex::new($regex).unwrap().into(), $replacement.as_bytes()),)*
134133
];
135134
}};
136135
}

src/tools/miri/tests/fail/terminate-terminator.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ impl Drop for Foo {
1212

1313
#[inline(always)]
1414
fn has_cleanup() {
15-
//~^ ERROR: panic in a function that cannot unwind
16-
// FIXME(nbdd0121): The error should be reported at the call site.
1715
let _f = Foo;
1816
panic!();
1917
}
2018

2119
extern "C" fn panic_abort() {
2220
has_cleanup();
21+
//~^ ERROR: panic in a function that cannot unwind
2322
}
2423

2524
fn main() {

src/tools/miri/tests/fail/terminate-terminator.stderr

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ error: abnormal termination: panic in a function that cannot unwind
66
--> $DIR/terminate-terminator.rs:LL:CC
77
|
88
LL | / fn has_cleanup() {
9-
LL | |
10-
LL | | // FIXME(nbdd0121): The error should be reported at the call site.
119
LL | | let _f = Foo;
1210
LL | | panic!();
1311
LL | | }

src/tools/miri/tests/pass/stacked-borrows/int-to-ptr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ fn example(variant: bool) {
2323
let mut c = 42u32;
2424

2525
let x_unique1 = &mut c;
26-
// [..., Unique(1)]
26+
// stack: [..., Unique(1)]
2727

2828
let x_raw2 = x_unique1 as *mut u32;
2929
let x_raw2_addr = x_raw2.expose_addr();
30-
// [..., Unique(1), SharedRW(2)]
30+
// stack: [..., Unique(1), SharedRW(2)]
3131

3232
let x_unique3 = &mut *x_raw2;
33-
// [.., Unique(1), SharedRW(2), Unique(3)]
33+
// stack: [.., Unique(1), SharedRW(2), Unique(3)]
3434

3535
assert_eq!(not_so_innocent(x_unique3), x_raw2_addr);
36-
// [.., Unique(1), SharedRW(2), Unique(3), ..., SharedRW(4)]
36+
// stack: [.., Unique(1), SharedRW(2), Unique(3), ..., SharedRW(4)]
3737

3838
// Do an int2ptr cast. This can pick tag 2 or 4 (the two previously exposed tags).
3939
// 4 is the "obvious" choice (topmost tag, what we used to do with untagged pointers).

0 commit comments

Comments
 (0)