Skip to content

Commit 273cdab

Browse files
committed
Auto merge of #2909 - osiewicz:rewrite-miri-script-in-rust-2883, r=RalfJung
Rewrite miri script in rust This is a sketch of a rewrite of miri script in Rust. It does not include changes made in #2908 yet. Environment variables are not properly propagated yet, which is something I plan to address. This PR is mostly a heads-up about the ongoing effort and it's state. It's definitely not the cleanest code I've seen in my life, but my first goal was feature/interface parity. I will iterate on it a bit before marking it as ready. I wonder though how this should be integrated/tested. Are you aware of anyone using `./miri` in their scripts? I guess we should keep existing `miri` script in place and let it run miri-script package directly? CI should probably `cargo check` this package as well. Fixes #2883
2 parents defbb66 + e5b358a commit 273cdab

File tree

11 files changed

+1016
-361
lines changed

11 files changed

+1016
-361
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ jobs:
130130
- name: clippy
131131
run: ./miri clippy -- -D warnings
132132
- name: rustdoc
133-
run: RUSTDOCFLAGS="-Dwarnings" cargo doc --document-private-items
133+
run: RUSTDOCFLAGS="-Dwarnings" ./miri cargo doc --document-private-items
134134

135135
# These jobs doesn't actually test anything, but they're only used to tell
136136
# bors the build completed, as there is no practical way to detect when a

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ evaluation error was originally raised.
107107
### UI testing
108108

109109
We use ui-testing in Miri, meaning we generate `.stderr` and `.stdout` files for the output
110-
produced by Miri. You can use `./miri bless` to automatically (re)generate these files when
110+
produced by Miri. You can use `./miri test --bless` to automatically (re)generate these files when
111111
you add new tests or change how Miri presents certain output.
112112

113113
Note that when you also use `MIRIFLAGS` to change optimizations and similar, the ui output

cargo-miri/src/phases.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,7 @@ pub fn phase_runner(mut binary_args: impl Iterator<Item = String>, phase: Runner
538538
}
539539
// Respect `MIRIFLAGS`.
540540
if let Ok(a) = env::var("MIRIFLAGS") {
541-
// This code is taken from `RUSTFLAGS` handling in cargo.
542-
let args = a.split(' ').map(str::trim).filter(|s| !s.is_empty()).map(str::to_string);
541+
let args = flagsplit(&a);
543542
cmd.args(args);
544543
}
545544

cargo-miri/src/util.rs

+5
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ pub fn cargo() -> Command {
114114
Command::new(env::var_os("CARGO").unwrap_or_else(|| OsString::from("cargo")))
115115
}
116116

117+
pub fn flagsplit(flags: &str) -> Vec<String> {
118+
// This code is taken from `RUSTFLAGS` handling in cargo.
119+
flags.split(' ').map(str::trim).filter(|s| !s.is_empty()).map(str::to_string).collect()
120+
}
121+
117122
/// Execute the `Command`, where possible by replacing the current process with a new process
118123
/// described by the `Command`. Then exit this process with the exit code of the new process.
119124
pub fn exec(mut cmd: Command) -> ! {

0 commit comments

Comments
 (0)