Skip to content

Commit 37c3af4

Browse files
committed
Update to latest ui_test crate version.
Also stops using github actions groups that conflict with our groups as github does not nest them
1 parent a477b81 commit 37c3af4

40 files changed

+102
-51
lines changed

src/tools/miri/Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,9 +820,9 @@ dependencies = [
820820

821821
[[package]]
822822
name = "ui_test"
823-
version = "0.6.2"
823+
version = "0.9.0"
824824
source = "registry+https://github.com/rust-lang/crates.io-index"
825-
checksum = "3e10f5f88ce8c331a388deda1e6e2bd533c73ca89cc5f539a3df02ed35c8efba"
825+
checksum = "95033b0e41b8018013d99a6f1486c1ae5bd080378ced60c5f797e93842423b33"
826826
dependencies = [
827827
"bstr",
828828
"cargo-platform",

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.6.2"
42+
ui_test = "0.9"
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: 62 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ use colored::*;
22
use regex::bytes::Regex;
33
use std::path::{Path, PathBuf};
44
use std::{env, process::Command};
5+
use ui_test::status_emitter::StatusEmitter;
6+
use ui_test::CommandBuilder;
57
use ui_test::{color_eyre::Result, Config, Match, Mode, OutputConflictHandling};
68

79
fn miri_path() -> PathBuf {
@@ -50,33 +52,35 @@ fn run_tests(mode: Mode, path: &str, target: &str, with_dependencies: bool) -> R
5052
stdout_filters: STDOUT.clone(),
5153
root_dir: PathBuf::from(path),
5254
mode,
53-
program: miri_path(),
55+
program: CommandBuilder::rustc(),
5456
quiet: false,
5557
edition: Some("2021".into()),
5658
..Config::default()
5759
};
5860

61+
config.program.program = miri_path();
62+
5963
let in_rustc_test_suite = option_env!("RUSTC_STAGE").is_some();
6064

6165
// Add some flags we always want.
6266
if in_rustc_test_suite {
6367
// Less aggressive warnings to make the rustc toolstate management less painful.
6468
// (We often get warnings when e.g. a feature gets stabilized or some lint gets added/improved.)
65-
config.args.push("-Astable-features".into());
66-
config.args.push("-Aunused".into());
69+
config.program.args.push("-Astable-features".into());
70+
config.program.args.push("-Aunused".into());
6771
} else {
68-
config.args.push("-Dwarnings".into());
69-
config.args.push("-Dunused".into());
72+
config.program.args.push("-Dwarnings".into());
73+
config.program.args.push("-Dunused".into());
7074
}
7175
if let Ok(extra_flags) = env::var("MIRIFLAGS") {
7276
for flag in extra_flags.split_whitespace() {
73-
config.args.push(flag.into());
77+
config.program.args.push(flag.into());
7478
}
7579
}
76-
config.args.push("-Zui-testing".into());
80+
config.program.args.push("-Zui-testing".into());
7781
if let Some(target) = &config.target {
78-
config.args.push("--target".into());
79-
config.args.push(target.into());
82+
config.program.args.push("--target".into());
83+
config.program.args.push(target.into());
8084
}
8185

8286
// If we're on linux, and we're testing the extern-so functionality,
@@ -86,7 +90,7 @@ fn run_tests(mode: Mode, path: &str, target: &str, with_dependencies: bool) -> R
8690
let so_file_path = build_so_for_c_ffi_tests();
8791
let mut flag = std::ffi::OsString::from("-Zmiri-extern-so-file=");
8892
flag.push(so_file_path.into_os_string());
89-
config.args.push(flag);
93+
config.program.args.push(flag);
9094
}
9195

9296
let skip_ui_checks = env::var_os("MIRI_SKIP_UI_CHECKS").is_some();
@@ -135,7 +139,12 @@ fn run_tests(mode: Mode, path: &str, target: &str, with_dependencies: bool) -> R
135139
"run".into(), // There is no `cargo miri build` so we just use `cargo miri run`.
136140
];
137141
}
138-
ui_test::run_tests(config)
142+
ui_test::run_tests_generic(
143+
config,
144+
|path| path.extension().is_some_and(|ext| ext == "rs"),
145+
|_, _| None,
146+
TextAndGha,
147+
)
139148
}
140149

141150
macro_rules! regexes {
@@ -235,3 +244,45 @@ fn main() -> Result<()> {
235244

236245
Ok(())
237246
}
247+
248+
/// This is a custom renderer for `ui_test` output that does not emit github actions
249+
/// `group`s, while still producing regular github actions messages on test failures.
250+
struct TextAndGha;
251+
impl StatusEmitter for TextAndGha {
252+
fn failed_test<'a>(
253+
&'a self,
254+
revision: &'a str,
255+
path: &'a Path,
256+
cmd: &'a Command,
257+
stderr: &'a [u8],
258+
) -> Box<dyn std::fmt::Debug + 'a> {
259+
Box::new((
260+
ui_test::status_emitter::Gha::<false>.failed_test(revision, path, cmd, stderr),
261+
ui_test::status_emitter::Text.failed_test(revision, path, cmd, stderr),
262+
))
263+
}
264+
265+
fn run_tests(&self, _config: &Config) -> Box<dyn ui_test::status_emitter::DuringTestRun> {
266+
Box::new(TextAndGha)
267+
}
268+
269+
fn finalize(
270+
&self,
271+
failures: usize,
272+
succeeded: usize,
273+
ignored: usize,
274+
filtered: usize,
275+
) -> Box<dyn ui_test::status_emitter::Summary> {
276+
Box::new((
277+
ui_test::status_emitter::Gha::<false>.finalize(failures, succeeded, ignored, filtered),
278+
ui_test::status_emitter::Text.finalize(failures, succeeded, ignored, filtered),
279+
))
280+
}
281+
}
282+
283+
impl ui_test::status_emitter::DuringTestRun for TextAndGha {
284+
fn test_result(&mut self, path: &Path, revision: &str, result: &ui_test::TestResult) {
285+
ui_test::status_emitter::Text.test_result(path, revision, result);
286+
ui_test::status_emitter::Gha::<false>.test_result(path, revision, result);
287+
}
288+
}

src/tools/miri/tests/fail/alloc/deallocate-bad-alignment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::alloc::{alloc, dealloc, Layout};
22

3-
//@error-pattern: has size 1 and alignment 1, but gave size 1 and alignment 2
3+
//@error-in-other-file: has size 1 and alignment 1, but gave size 1 and alignment 2
44

55
fn main() {
66
unsafe {

src/tools/miri/tests/fail/alloc/deallocate-bad-size.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::alloc::{alloc, dealloc, Layout};
22

3-
//@error-pattern: has size 1 and alignment 1, but gave size 2 and alignment 1
3+
//@error-in-other-file: has size 1 and alignment 1, but gave size 2 and alignment 1
44

55
fn main() {
66
unsafe {

src/tools/miri/tests/fail/alloc/deallocate-twice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::alloc::{alloc, dealloc, Layout};
22

3-
//@error-pattern: dereferenced after this allocation got freed
3+
//@error-in-other-file: dereferenced after this allocation got freed
44

55
fn main() {
66
unsafe {

src/tools/miri/tests/fail/alloc/global_system_mixup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Make sure we detect when the `Global` and `System` allocators are mixed
22
// (even when the default `Global` uses `System`).
3-
//@error-pattern: /deallocating .*, which is Rust heap memory, using .* heap deallocation operation/
3+
//@error-in-other-file: /deallocating .*, which is Rust heap memory, using .* heap deallocation operation/
44

55
//@normalize-stderr-test: "using [A-Za-z]+ heap deallocation operation" -> "using PLATFORM heap deallocation operation"
66
//@normalize-stderr-test: "\| +\^+" -> "| ^"

src/tools/miri/tests/fail/alloc/reallocate-bad-size.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::alloc::{alloc, realloc, Layout};
22

3-
//@error-pattern: has size 1 and alignment 1, but gave size 2 and alignment 1
3+
//@error-in-other-file: has size 1 and alignment 1, but gave size 2 and alignment 1
44

55
fn main() {
66
unsafe {

src/tools/miri/tests/fail/alloc/reallocate-dangling.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::alloc::{alloc, dealloc, realloc, Layout};
22

3-
//@error-pattern: dereferenced after this allocation got freed
3+
//@error-in-other-file: dereferenced after this allocation got freed
44

55
fn main() {
66
unsafe {

src/tools/miri/tests/fail/alloc/stack_free.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Validation/SB changes why we fail
22
//@compile-flags: -Zmiri-disable-validation -Zmiri-disable-stacked-borrows
33

4-
//@error-pattern: /deallocating .*, which is stack variable memory, using Rust heap deallocation operation/
4+
//@error-in-other-file: /deallocating .*, which is stack variable memory, using Rust heap deallocation operation/
55

66
fn main() {
77
let x = 42;

src/tools/miri/tests/fail/concurrency/libc_pthread_create_main_terminate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ignore-target-windows: No libc on Windows
2-
//@error-pattern: the main thread terminated without waiting for all remaining threads
2+
//@error-in-other-file: the main thread terminated without waiting for all remaining threads
33

44
// Check that we terminate the program when the main thread terminates.
55

src/tools/miri/tests/fail/concurrency/windows_join_detached.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@only-target-windows: Uses win32 api functions
2-
//@error-pattern: Undefined Behavior: trying to join a detached thread
2+
//@error-in-other-file: Undefined Behavior: trying to join a detached thread
33

44
// Joining a detached thread is undefined behavior.
55

src/tools/miri/tests/fail/deny_lint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: miri cannot be run on programs that fail compilation
1+
//@error-in-other-file: miri cannot be run on programs that fail compilation
22

33
#![deny(warnings)]
44

src/tools/miri/tests/fail/intrinsics/simd-float-to-int.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: cannot be represented in target type `i32`
1+
//@error-in-other-file: cannot be represented in target type `i32`
22
#![feature(portable_simd)]
33
use std::simd::*;
44

src/tools/miri/tests/fail/intrinsics/simd-gather.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: pointer to 1 byte starting at offset 9 is out-of-bounds
1+
//@error-in-other-file: pointer to 1 byte starting at offset 9 is out-of-bounds
22
#![feature(portable_simd)]
33
use std::simd::*;
44

src/tools/miri/tests/fail/intrinsics/simd-scatter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: pointer to 1 byte starting at offset 9 is out-of-bounds
1+
//@error-in-other-file: pointer to 1 byte starting at offset 9 is out-of-bounds
22
#![feature(portable_simd)]
33
use std::simd::*;
44

src/tools/miri/tests/fail/layout_cycle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: a cycle occurred during layout computation
1+
//@error-in-other-file: a cycle occurred during layout computation
22
//~^ ERROR: cycle detected when computing layout of
33

44
use std::mem;

src/tools/miri/tests/fail/memleak.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: memory leaked
1+
//@error-in-other-file: memory leaked
22
//@normalize-stderr-test: ".*│.*" -> "$$stripped$$"
33

44
fn main() {

src/tools/miri/tests/fail/memleak_no_backtrace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@compile-flags: -Zmiri-disable-leak-backtraces
2-
//@error-pattern: the evaluated program leaked memory
2+
//@error-in-other-file: the evaluated program leaked memory
33
//@normalize-stderr-test: ".*│.*" -> "$$stripped$$"
44

55
fn main() {

src/tools/miri/tests/fail/memleak_rc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: memory leaked
1+
//@error-in-other-file: memory leaked
22
//@stderr-per-bitwidth
33
//@normalize-stderr-test: ".*│.*" -> "$$stripped$$"
44

src/tools/miri/tests/fail/no_main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
//@error-pattern: miri can only run programs that have a main function
1+
//@error-in-other-file: miri can only run programs that have a main function
22
#![no_main]

src/tools/miri/tests/fail/panic/double_panic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: the program aborted
1+
//@error-in-other-file: the program aborted
22
//@normalize-stderr-test: "\| +\^+" -> "| ^"
33
//@normalize-stderr-test: "unsafe \{ libc::abort\(\) \}|crate::intrinsics::abort\(\);" -> "ABORT();"
44
//@normalize-stderr-test: "\n +[0-9]+:[^\n]+" -> "$1"

src/tools/miri/tests/fail/panic/panic_abort1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: the program aborted execution
1+
//@error-in-other-file: the program aborted execution
22
//@normalize-stderr-test: "\| +\^+" -> "| ^"
33
//@normalize-stderr-test: "libc::abort\(\);|core::intrinsics::abort\(\);" -> "ABORT();"
44
//@compile-flags: -C panic=abort

src/tools/miri/tests/fail/panic/panic_abort2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: the program aborted execution
1+
//@error-in-other-file: the program aborted execution
22
//@normalize-stderr-test: "\| +\^+" -> "| ^"
33
//@normalize-stderr-test: "libc::abort\(\);|core::intrinsics::abort\(\);" -> "ABORT();"
44
//@compile-flags: -C panic=abort

src/tools/miri/tests/fail/panic/panic_abort3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: the program aborted execution
1+
//@error-in-other-file: the program aborted execution
22
//@normalize-stderr-test: "\| +\^+" -> "| ^"
33
//@normalize-stderr-test: "libc::abort\(\);|core::intrinsics::abort\(\);" -> "ABORT();"
44
//@compile-flags: -C panic=abort

src/tools/miri/tests/fail/panic/panic_abort4.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: the program aborted execution
1+
//@error-in-other-file: the program aborted execution
22
//@normalize-stderr-test: "\| +\^+" -> "| ^"
33
//@normalize-stderr-test: "libc::abort\(\);|core::intrinsics::abort\(\);" -> "ABORT();"
44
//@compile-flags: -C panic=abort

src/tools/miri/tests/fail/shims/fs/isolated_file.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ignore-target-windows: File handling is not implemented yet
2-
//@error-pattern: `open` not available when isolation is enabled
2+
//@error-in-other-file: `open` not available when isolation is enabled
33

44
fn main() {
55
let _file = std::fs::File::open("file.txt").unwrap();

src/tools/miri/tests/fail/stacked_borrows/deallocate_against_protector1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: /deallocating while item \[Unique for .*\] is strongly protected/
1+
//@error-in-other-file: /deallocating while item \[Unique for .*\] is strongly protected/
22

33
fn inner(x: &mut i32, f: fn(&mut i32)) {
44
// `f` may mutate, but it may not deallocate!

src/tools/miri/tests/fail/stacked_borrows/drop_in_place_retag.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Test that drop_in_place mutably retags the entire place, even for a type that does not need
22
//! dropping, ensuring among other things that it is writeable
33
4-
//@error-pattern: /retag .* for Unique permission .* only grants SharedReadOnly permission/
4+
//@error-in-other-file: /retag .* for Unique permission .* only grants SharedReadOnly permission/
55

66
fn main() {
77
unsafe {

src/tools/miri/tests/fail/stacked_borrows/illegal_dealloc1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: /deallocation .* tag does not exist in the borrow stack/
1+
//@error-in-other-file: /deallocation .* tag does not exist in the borrow stack/
22
use std::alloc::{alloc, dealloc, Layout};
33

44
fn main() {

src/tools/miri/tests/fail/stacked_borrows/issue-miri-1050-1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: pointer to 4 bytes starting at offset 0 is out-of-bounds
1+
//@error-in-other-file: pointer to 4 bytes starting at offset 0 is out-of-bounds
22

33
fn main() {
44
unsafe {

src/tools/miri/tests/fail/stacked_borrows/issue-miri-1050-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: is a dangling pointer
1+
//@error-in-other-file: is a dangling pointer
22
use std::ptr::NonNull;
33

44
fn main() {

src/tools/miri/tests/fail/stacked_borrows/newtype_pair_retagging.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: which is strongly protected
1+
//@error-in-other-file: which is strongly protected
22
struct Newtype<'a>(&'a mut i32, i32);
33

44
fn dealloc_while_running(_n: Newtype<'_>, dealloc: impl FnOnce()) {

src/tools/miri/tests/fail/stacked_borrows/newtype_retagging.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: which is strongly protected
1+
//@error-in-other-file: which is strongly protected
22
struct Newtype<'a>(&'a mut i32);
33

44
fn dealloc_while_running(_n: Newtype<'_>, dealloc: impl FnOnce()) {

src/tools/miri/tests/fail/stacked_borrows/zst_slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@compile-flags: -Zmiri-strict-provenance
2-
//@error-pattern: /retag .* tag does not exist in the borrow stack/
2+
//@error-in-other-file: /retag .* tag does not exist in the borrow stack/
33

44
fn main() {
55
unsafe {

src/tools/miri/tests/fail/tokio/sleep.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@compile-flags: -Zmiri-permissive-provenance -Zmiri-backtrace=full
22
//@only-target-x86_64-unknown-linux: support for tokio only on linux and x86
3-
//@error-pattern: returning ready events from epoll_wait is not yet implemented
3+
//@error-in-other-file: returning ready events from epoll_wait is not yet implemented
44
//@normalize-stderr-test: " += note:.*\n" -> ""
55

66
use tokio::time::{sleep, Duration, Instant};

src/tools/miri/tests/fail/tree-borrows/strongly-protected.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@compile-flags: -Zmiri-tree-borrows
2-
//@error-pattern: /deallocation through .* is forbidden/
2+
//@error-in-other-file: /deallocation through .* is forbidden/
33

44
fn inner(x: &mut i32, f: fn(&mut i32)) {
55
// `f` may mutate, but it may not deallocate!

src/tools/miri/tests/fail/unaligned_pointers/drop_in_place.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct PartialDrop {
1313
b: u8,
1414
}
1515

16-
//@error-pattern: /alignment 2 is required/
16+
//@error-in-other-file: /alignment 2 is required/
1717
fn main() {
1818
unsafe {
1919
// Create an unaligned pointer

src/tools/miri/tests/fail/uninit_buffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: memory is uninitialized at [0x4..0x10]
1+
//@error-in-other-file: memory is uninitialized at [0x4..0x10]
22

33
use std::alloc::{alloc, dealloc, Layout};
44
use std::slice::from_raw_parts;

src/tools/miri/tests/fail/uninit_buffer_with_provenance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//@error-pattern: memory is uninitialized at [0x4..0x8]
1+
//@error-in-other-file: memory is uninitialized at [0x4..0x8]
22
//@normalize-stderr-test: "a[0-9]+" -> "ALLOC"
33
#![feature(strict_provenance)]
44

0 commit comments

Comments
 (0)