Skip to content

Commit 20862e4

Browse files
committed
Auto merge of rust-lang#3881 - RalfJung:miri-run, r=RalfJung
./miri run: directly run binary instead of using 'cargo run' This avoids re-building miri without dev dependencies, so it makes `./miri run` a lot faster if `./miri test` was already executed before.
2 parents d5ad772 + 03f14f0 commit 20862e4

File tree

5 files changed

+144
-55
lines changed

5 files changed

+144
-55
lines changed

src/tools/miri/ci/ci.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ time ./miri install
2626
# We enable all features to make sure the Stacked Borrows consistency check runs.
2727
echo "Building debug version of Miri"
2828
export CARGO_EXTRA_FLAGS="$CARGO_EXTRA_FLAGS --all-features"
29-
time ./miri build --all-targets # the build that all the `./miri test` below will use
29+
time ./miri build # the build that all the `./miri test` below will use
3030

3131
endgroup
3232

src/tools/miri/miri-script/Cargo.lock

Lines changed: 88 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a"
6161

6262
[[package]]
6363
name = "errno"
64-
version = "0.3.8"
64+
version = "0.3.9"
6565
source = "registry+https://github.com/rust-lang/crates.io-index"
66-
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
66+
checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
6767
dependencies = [
6868
"libc",
6969
"windows-sys 0.52.0",
@@ -98,6 +98,12 @@ dependencies = [
9898
"either",
9999
]
100100

101+
[[package]]
102+
name = "itoa"
103+
version = "1.0.11"
104+
source = "registry+https://github.com/rust-lang/crates.io-index"
105+
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
106+
101107
[[package]]
102108
name = "libc"
103109
version = "0.2.153"
@@ -117,9 +123,15 @@ dependencies = [
117123

118124
[[package]]
119125
name = "linux-raw-sys"
120-
version = "0.4.13"
126+
version = "0.4.14"
121127
source = "registry+https://github.com/rust-lang/crates.io-index"
122-
checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
128+
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
129+
130+
[[package]]
131+
name = "memchr"
132+
version = "2.7.4"
133+
source = "registry+https://github.com/rust-lang/crates.io-index"
134+
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
123135

124136
[[package]]
125137
name = "miri-script"
@@ -131,6 +143,7 @@ dependencies = [
131143
"itertools",
132144
"path_macro",
133145
"rustc_version",
146+
"serde_json",
134147
"shell-words",
135148
"walkdir",
136149
"which",
@@ -204,9 +217,9 @@ dependencies = [
204217

205218
[[package]]
206219
name = "rustix"
207-
version = "0.38.31"
220+
version = "0.38.34"
208221
source = "registry+https://github.com/rust-lang/crates.io-index"
209-
checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949"
222+
checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
210223
dependencies = [
211224
"bitflags 2.4.2",
212225
"errno",
@@ -215,6 +228,12 @@ dependencies = [
215228
"windows-sys 0.52.0",
216229
]
217230

231+
[[package]]
232+
name = "ryu"
233+
version = "1.0.18"
234+
source = "registry+https://github.com/rust-lang/crates.io-index"
235+
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
236+
218237
[[package]]
219238
name = "same-file"
220239
version = "1.0.6"
@@ -230,6 +249,38 @@ version = "1.0.22"
230249
source = "registry+https://github.com/rust-lang/crates.io-index"
231250
checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca"
232251

252+
[[package]]
253+
name = "serde"
254+
version = "1.0.210"
255+
source = "registry+https://github.com/rust-lang/crates.io-index"
256+
checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
257+
dependencies = [
258+
"serde_derive",
259+
]
260+
261+
[[package]]
262+
name = "serde_derive"
263+
version = "1.0.210"
264+
source = "registry+https://github.com/rust-lang/crates.io-index"
265+
checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
266+
dependencies = [
267+
"proc-macro2",
268+
"quote",
269+
"syn",
270+
]
271+
272+
[[package]]
273+
name = "serde_json"
274+
version = "1.0.128"
275+
source = "registry+https://github.com/rust-lang/crates.io-index"
276+
checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
277+
dependencies = [
278+
"itoa",
279+
"memchr",
280+
"ryu",
281+
"serde",
282+
]
283+
233284
[[package]]
234285
name = "shell-words"
235286
version = "1.1.0"
@@ -347,7 +398,7 @@ version = "0.52.0"
347398
source = "registry+https://github.com/rust-lang/crates.io-index"
348399
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
349400
dependencies = [
350-
"windows-targets 0.52.3",
401+
"windows-targets 0.52.6",
351402
]
352403

353404
[[package]]
@@ -367,17 +418,18 @@ dependencies = [
367418

368419
[[package]]
369420
name = "windows-targets"
370-
version = "0.52.3"
421+
version = "0.52.6"
371422
source = "registry+https://github.com/rust-lang/crates.io-index"
372-
checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f"
423+
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
373424
dependencies = [
374-
"windows_aarch64_gnullvm 0.52.3",
375-
"windows_aarch64_msvc 0.52.3",
376-
"windows_i686_gnu 0.52.3",
377-
"windows_i686_msvc 0.52.3",
378-
"windows_x86_64_gnu 0.52.3",
379-
"windows_x86_64_gnullvm 0.52.3",
380-
"windows_x86_64_msvc 0.52.3",
425+
"windows_aarch64_gnullvm 0.52.6",
426+
"windows_aarch64_msvc 0.52.6",
427+
"windows_i686_gnu 0.52.6",
428+
"windows_i686_gnullvm",
429+
"windows_i686_msvc 0.52.6",
430+
"windows_x86_64_gnu 0.52.6",
431+
"windows_x86_64_gnullvm 0.52.6",
432+
"windows_x86_64_msvc 0.52.6",
381433
]
382434

383435
[[package]]
@@ -388,9 +440,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
388440

389441
[[package]]
390442
name = "windows_aarch64_gnullvm"
391-
version = "0.52.3"
443+
version = "0.52.6"
392444
source = "registry+https://github.com/rust-lang/crates.io-index"
393-
checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6"
445+
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
394446

395447
[[package]]
396448
name = "windows_aarch64_msvc"
@@ -400,9 +452,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
400452

401453
[[package]]
402454
name = "windows_aarch64_msvc"
403-
version = "0.52.3"
455+
version = "0.52.6"
404456
source = "registry+https://github.com/rust-lang/crates.io-index"
405-
checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f"
457+
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
406458

407459
[[package]]
408460
name = "windows_i686_gnu"
@@ -412,9 +464,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
412464

413465
[[package]]
414466
name = "windows_i686_gnu"
415-
version = "0.52.3"
467+
version = "0.52.6"
468+
source = "registry+https://github.com/rust-lang/crates.io-index"
469+
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
470+
471+
[[package]]
472+
name = "windows_i686_gnullvm"
473+
version = "0.52.6"
416474
source = "registry+https://github.com/rust-lang/crates.io-index"
417-
checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb"
475+
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
418476

419477
[[package]]
420478
name = "windows_i686_msvc"
@@ -424,9 +482,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
424482

425483
[[package]]
426484
name = "windows_i686_msvc"
427-
version = "0.52.3"
485+
version = "0.52.6"
428486
source = "registry+https://github.com/rust-lang/crates.io-index"
429-
checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58"
487+
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
430488

431489
[[package]]
432490
name = "windows_x86_64_gnu"
@@ -436,9 +494,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
436494

437495
[[package]]
438496
name = "windows_x86_64_gnu"
439-
version = "0.52.3"
497+
version = "0.52.6"
440498
source = "registry+https://github.com/rust-lang/crates.io-index"
441-
checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614"
499+
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
442500

443501
[[package]]
444502
name = "windows_x86_64_gnullvm"
@@ -448,9 +506,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
448506

449507
[[package]]
450508
name = "windows_x86_64_gnullvm"
451-
version = "0.52.3"
509+
version = "0.52.6"
452510
source = "registry+https://github.com/rust-lang/crates.io-index"
453-
checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c"
511+
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
454512

455513
[[package]]
456514
name = "windows_x86_64_msvc"
@@ -460,9 +518,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
460518

461519
[[package]]
462520
name = "windows_x86_64_msvc"
463-
version = "0.52.3"
521+
version = "0.52.6"
464522
source = "registry+https://github.com/rust-lang/crates.io-index"
465-
checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6"
523+
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
466524

467525
[[package]]
468526
name = "xshell"

src/tools/miri/miri-script/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ xshell = "0.2.6"
2323
rustc_version = "0.4"
2424
dunce = "1.0.4"
2525
directories = "5"
26+
serde_json = "1"

src/tools/miri/miri-script/src/commands.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -494,23 +494,21 @@ impl Command {
494494
flags: Vec<String>,
495495
) -> Result<()> {
496496
let mut e = MiriEnv::new()?;
497+
498+
// Preparation: get a sysroot, and get the miri binary.
499+
let miri_sysroot = e.build_miri_sysroot(/* quiet */ !verbose, target.as_deref())?;
500+
let miri_bin =
501+
e.build_get_binary(".").context("failed to get filename of miri executable")?;
502+
497503
// More flags that we will pass before `flags`
498504
// (because `flags` may contain `--`).
499505
let mut early_flags = Vec::<OsString>::new();
500-
501-
// Add target, edition to flags.
502506
if let Some(target) = &target {
503507
early_flags.push("--target".into());
504508
early_flags.push(target.into());
505509
}
506-
if verbose {
507-
early_flags.push("--verbose".into());
508-
}
509510
early_flags.push("--edition".into());
510511
early_flags.push(edition.as_deref().unwrap_or("2021").into());
511-
512-
// Prepare a sysroot, add it to the flags. (Also builds cargo-miri, which we need.)
513-
let miri_sysroot = e.build_miri_sysroot(/* quiet */ !verbose, target.as_deref())?;
514512
early_flags.push("--sysroot".into());
515513
early_flags.push(miri_sysroot.into());
516514

@@ -523,18 +521,19 @@ impl Command {
523521
let run_miri = |e: &MiriEnv, seed_flag: Option<String>| -> Result<()> {
524522
// The basic command that executes the Miri driver.
525523
let mut cmd = if dep {
524+
// We invoke the test suite as that has all the logic for running with dependencies.
526525
e.cargo_cmd(".", "test")
527526
.args(&["--test", "ui"])
528527
.args(quiet_flag)
529528
.arg("--")
530529
.args(&["--miri-run-dep-mode"])
531530
} else {
532-
e.cargo_cmd(".", "run").args(quiet_flag).arg("--")
531+
cmd!(e.sh, "{miri_bin}")
533532
};
534533
cmd.set_quiet(!verbose);
535534
// Add Miri flags
536535
let mut cmd = cmd.args(&miri_flags).args(&seed_flag).args(&early_flags).args(&flags);
537-
// For `--dep` we also need to set the env var.
536+
// For `--dep` we also need to set the target in the env var.
538537
if dep {
539538
if let Some(target) = &target {
540539
cmd = cmd.env("MIRI_TEST_TARGET", target);

0 commit comments

Comments
 (0)