Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump ui_test to 0.22 #3279

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
40 changes: 24 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ default-run = "miri"
edition = "2021"

[lib]
test = true # we have unit tests
test = true # we have unit tests
doctest = false # but no doc tests

[[bin]]
name = "miri"
test = false # we have no unit tests
test = false # we have no unit tests
doctest = false # and no doc tests

[dependencies]
Expand All @@ -41,7 +41,7 @@ libloading = "0.8"

[dev-dependencies]
colored = "2"
ui_test = "0.21.1"
ui_test = "0.22.1"
rustc_version = "0.4"
regex = "1.5.5"
lazy_static = "1.4.0"
Expand Down
27 changes: 14 additions & 13 deletions tests/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::ffi::OsString;
use std::num::NonZeroUsize;
use std::path::{Path, PathBuf};
use std::{env, process::Command};
use ui_test::spanned::Spanned;
use ui_test::{color_eyre::Result, Config, Match, Mode, OutputConflictHandling};
use ui_test::{status_emitter, CommandBuilder, Format, RustfixMode};

Expand Down Expand Up @@ -66,8 +67,6 @@ fn test_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) ->
}
}
program.args.push("-Zui-testing".into());
program.args.push("--target".into());
program.args.push(target.into());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the CI errors, removing --target doesn't seem to be right.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea ^^ looks like it


// If we're on linux, and we're testing the extern-so functionality,
// then build the shared object file for testing external C function calls
Expand All @@ -86,17 +85,21 @@ fn test_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) ->

let mut config = Config {
target: Some(target.to_owned()),
stderr_filters: STDERR.clone(),
stdout_filters: STDOUT.clone(),
mode,
program,
out_dir: PathBuf::from(std::env::var_os("CARGO_TARGET_DIR").unwrap()).join("ui"),
edition: Some("2021".into()), // keep in sync with `./miri run`
threads: std::env::var("MIRI_TEST_THREADS")
.ok()
.map(|threads| NonZeroUsize::new(threads.parse().unwrap()).unwrap()),
..Config::rustc(path)
};
// keep in sync with `./miri run`
config.comment_defaults.base().edition = Some(Spanned::dummy("2021".into())).into();
Comment on lines +95 to +96
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit unclear what should be kept in sync.

Suggested change
// keep in sync with `./miri run`
config.comment_defaults.base().edition = Some(Spanned::dummy("2021".into())).into();
let edition = "2021"; // keep in sync with `./miri run`
config.comment_defaults.base().edition = Some(Spanned::dummy(edition.into())).into();

But also... this is quite confusing, why do we need to Spanned everything?

config.comment_defaults.base().mode = Some(Spanned::dummy(mode)).into();
config.comment_defaults.base().normalize_stdout =
STDOUT.iter().cloned().map(|(m, v)| (m, v.into())).collect();
config.comment_defaults.base().normalize_stderr =
STDERR.iter().cloned().map(|(m, v)| (m, v.into())).collect();
config.filter(path, "$$DIR");

if with_dependencies {
config.dependencies_crate_manifest_path =
Expand All @@ -121,14 +124,12 @@ fn run_tests(mode: Mode, path: &str, target: &str, with_dependencies: bool) -> R
let mut config = test_config(target, path, mode, with_dependencies);

// Handle command-line arguments.
let args = ui_test::Args::test()?;
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();
}
let mut args = ui_test::Args::test()?;
args.bless |= env::var_os("RUSTC_BLESS").is_some_and(|v| v != "0");
config.with_args(&args);
config.bless_command = Some("./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");
assert!(!args.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());
Expand Down
4 changes: 2 additions & 2 deletions tests/extern-so/fail/function_not_in_so.stderr
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
error: unsupported operation: can't call foreign function `foo` on $OS
--> $DIR/function_not_in_so.rs:LL:CC
--> $DIR/fail/function_not_in_so.rs:LL:CC
|
LL | foo();
| ^^^^^ can't call foreign function `foo` on $OS
|
= help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
= note: BACKTRACE:
= note: inside `main` at $DIR/function_not_in_so.rs:LL:CC
= note: inside `main` at $DIR/fail/function_not_in_so.rs:LL:CC

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: Undefined Behavior: callee has fewer arguments than expected
--> $DIR/libc_pthread_create_too_few_args.rs:LL:CC
--> tests/fail-dep/concurrency/libc_pthread_create_too_few_args.rs:LL:CC
|
LL | panic!()
| ^^^^^^^^ callee has fewer arguments than expected
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: Undefined Behavior: callee has more arguments than expected
--> $DIR/libc_pthread_create_too_many_args.rs:LL:CC
--> tests/fail-dep/concurrency/libc_pthread_create_too_many_args.rs:LL:CC
|
LL | panic!()
| ^^^^^^^^ callee has more arguments than expected
Expand Down
4 changes: 2 additions & 2 deletions tests/fail-dep/concurrency/libc_pthread_join_detached.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: Undefined Behavior: trying to join a detached thread
--> $DIR/libc_pthread_join_detached.rs:LL:CC
--> tests/fail-dep/concurrency/libc_pthread_join_detached.rs:LL:CC
|
LL | assert_eq!(libc::pthread_join(native, ptr::null_mut()), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trying to join a detached thread
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: BACKTRACE:
= note: inside `main` at $DIR/libc_pthread_join_detached.rs:LL:CC
= note: inside `main` at tests/fail-dep/concurrency/libc_pthread_join_detached.rs:LL:CC

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
4 changes: 2 additions & 2 deletions tests/fail-dep/concurrency/libc_pthread_join_joined.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: Undefined Behavior: trying to join an already joined thread
--> $DIR/libc_pthread_join_joined.rs:LL:CC
--> tests/fail-dep/concurrency/libc_pthread_join_joined.rs:LL:CC
|
LL | assert_eq!(libc::pthread_join(native, ptr::null_mut()), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trying to join an already joined thread
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: BACKTRACE:
= note: inside `main` at $DIR/libc_pthread_join_joined.rs:LL:CC
= note: inside `main` at tests/fail-dep/concurrency/libc_pthread_join_joined.rs:LL:CC

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
4 changes: 2 additions & 2 deletions tests/fail-dep/concurrency/libc_pthread_join_main.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: Undefined Behavior: trying to join a detached thread
--> $DIR/libc_pthread_join_main.rs:LL:CC
--> tests/fail-dep/concurrency/libc_pthread_join_main.rs:LL:CC
|
LL | assert_eq!(libc::pthread_join(thread_id, ptr::null_mut()), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trying to join a detached thread
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: BACKTRACE:
= note: inside closure at $DIR/libc_pthread_join_main.rs:LL:CC
= note: inside closure at tests/fail-dep/concurrency/libc_pthread_join_main.rs:LL:CC

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
4 changes: 2 additions & 2 deletions tests/fail-dep/concurrency/libc_pthread_join_multiple.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: Undefined Behavior: trying to join an already joined thread
--> $DIR/libc_pthread_join_multiple.rs:LL:CC
--> tests/fail-dep/concurrency/libc_pthread_join_multiple.rs:LL:CC
|
LL | ... assert_eq!(libc::pthread_join(native_copy, ptr::null_mut()), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trying to join an already joined thread
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: BACKTRACE:
= note: inside closure at $DIR/libc_pthread_join_multiple.rs:LL:CC
= note: inside closure at tests/fail-dep/concurrency/libc_pthread_join_multiple.rs:LL:CC

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
4 changes: 2 additions & 2 deletions tests/fail-dep/concurrency/libc_pthread_join_self.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: Undefined Behavior: trying to join itself
--> $DIR/libc_pthread_join_self.rs:LL:CC
--> tests/fail-dep/concurrency/libc_pthread_join_self.rs:LL:CC
|
LL | assert_eq!(libc::pthread_join(native, ptr::null_mut()), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trying to join itself
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: BACKTRACE:
= note: inside closure at $DIR/libc_pthread_join_self.rs:LL:CC
= note: inside closure at tests/fail-dep/concurrency/libc_pthread_join_self.rs:LL:CC

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
6 changes: 3 additions & 3 deletions tests/fail-dep/concurrency/unwind_top_of_stack.stderr
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
WARNING: the flag `-Zmiri-disable-abi-check` is deprecated and planned to be removed.
If you have a use-case for it, please file an issue.
thread '<unnamed>' panicked at $DIR/unwind_top_of_stack.rs:LL:CC:
thread '<unnamed>' panicked at tests/fail-dep/concurrency/unwind_top_of_stack.rs:LL:CC:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: Undefined Behavior: unwinding past the topmost frame of the stack
--> $DIR/unwind_top_of_stack.rs:LL:CC
--> tests/fail-dep/concurrency/unwind_top_of_stack.rs:LL:CC
|
LL | / extern "C-unwind" fn thread_start(_null: *mut libc::c_void) -> *mut libc::c_void {
LL | |
Expand All @@ -15,7 +15,7 @@ LL | | }
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: BACKTRACE:
= note: inside `thread_start` at $DIR/unwind_top_of_stack.rs:LL:CC
= note: inside `thread_start` at tests/fail-dep/concurrency/unwind_top_of_stack.rs:LL:CC

error: aborting due to 1 previous error

2 changes: 1 addition & 1 deletion tests/fail-dep/concurrency/windows_join_detached.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ LL | let rc = unsafe { c::WaitForSingleObject(self.handle.as_raw_handle(
= note: inside `std::thread::JoinInner::<'_, ()>::join` at RUSTLIB/std/src/thread/mod.rs:LL:CC
= note: inside `std::thread::JoinHandle::<()>::join` at RUSTLIB/std/src/thread/mod.rs:LL:CC
note: inside `main`
--> $DIR/windows_join_detached.rs:LL:CC
--> $DIR/concurrency/windows_join_detached.rs:LL:CC
|
LL | thread.join().unwrap();
| ^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/fail-dep/concurrency/windows_join_main.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: deadlock: the evaluated program deadlocked
--> $DIR/windows_join_main.rs:LL:CC
--> $DIR/concurrency/windows_join_main.rs:LL:CC
|
LL | assert_eq!(WaitForSingleObject(MAIN_THREAD, INFINITE), WAIT_OBJECT_0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program deadlocked
Expand Down
4 changes: 2 additions & 2 deletions tests/fail-dep/concurrency/windows_join_self.stderr
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
error: deadlock: the evaluated program deadlocked
--> $DIR/windows_join_self.rs:LL:CC
--> $DIR/concurrency/windows_join_self.rs:LL:CC
|
LL | assert_eq!(WaitForSingleObject(native, INFINITE), WAIT_OBJECT_0);
| ^ the evaluated program deadlocked
|
= note: inside closure at $DIR/windows_join_self.rs:LL:CC
= note: inside closure at $DIR/concurrency/windows_join_self.rs:LL:CC

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
6 changes: 3 additions & 3 deletions tests/fail-dep/shims/env-set_var-data-race.stderr
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `main` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here
--> $DIR/env-set_var-data-race.rs:LL:CC
--> tests/fail-dep/shims/env-set_var-data-race.rs:LL:CC
|
LL | libc::getenv(b"TZ/0".as_ptr().cast());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic write on thread `main` and (2) non-atomic read on thread `<unnamed>` at ALLOC. (2) just happened here
|
help: and (1) occurred earlier here
--> $DIR/env-set_var-data-race.rs:LL:CC
--> tests/fail-dep/shims/env-set_var-data-race.rs:LL:CC
|
LL | env::set_var("MY_RUST_VAR", "Ferris");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
= note: BACKTRACE (of the first span):
= note: inside closure at $DIR/env-set_var-data-race.rs:LL:CC
= note: inside closure at tests/fail-dep/shims/env-set_var-data-race.rs:LL:CC

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
4 changes: 2 additions & 2 deletions tests/fail-dep/shims/fs/close_stdout.stderr
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
error: unsupported operation: cannot close stdout
--> $DIR/close_stdout.rs:LL:CC
--> tests/fail-dep/shims/fs/close_stdout.rs:LL:CC
|
LL | libc::close(1);
| ^^^^^^^^^^^^^^ cannot close stdout
|
= help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
= note: BACKTRACE:
= note: inside `main` at $DIR/close_stdout.rs:LL:CC
= note: inside `main` at tests/fail-dep/shims/fs/close_stdout.rs:LL:CC

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down
4 changes: 2 additions & 2 deletions tests/fail-dep/shims/fs/isolated_stdin.stderr
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
error: unsupported operation: `read` from stdin not available when isolation is enabled
--> $DIR/isolated_stdin.rs:LL:CC
--> tests/fail-dep/shims/fs/isolated_stdin.rs:LL:CC
|
LL | libc::read(0, bytes.as_mut_ptr() as *mut libc::c_void, 512);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `read` from stdin not available when isolation is enabled
|
= help: pass the flag `-Zmiri-disable-isolation` to disable isolation;
= help: or pass `-Zmiri-isolation-error=warn` to configure Miri to return an error code from isolated operations (if supported for that operation) and continue with a warning
= note: BACKTRACE:
= note: inside `main` at $DIR/isolated_stdin.rs:LL:CC
= note: inside `main` at tests/fail-dep/shims/fs/isolated_stdin.rs:LL:CC

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Expand Down