Skip to content

Commit 50035e8

Browse files
authored
Rollup merge of #66053 - RalfJung:miri-toolstate, r=pietroalbini
when Miri tests are not passing, do not add Miri component Second attempt, this time based on the JSON files that exist since #65274. Fixes #60301 r? @pietroalbini @alexcrichton
2 parents 80404bf + 224378c commit 50035e8

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ name = "build-manifest"
208208
version = "0.1.0"
209209
dependencies = [
210210
"serde",
211+
"serde_json",
211212
"toml",
212213
]
213214

src/tools/build-manifest/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ edition = "2018"
77
[dependencies]
88
toml = "0.5"
99
serde = { version = "1.0", features = ["derive"] }
10+
serde_json = "1.0"

src/tools/build-manifest/src/main.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ use serde::Serialize;
1111

1212
use std::collections::BTreeMap;
1313
use std::env;
14-
use std::fs;
14+
use std::fs::{self, File};
1515
use std::io::{self, Read, Write};
1616
use std::path::{PathBuf, Path};
1717
use std::process::{Command, Stdio};
18+
use std::collections::HashMap;
1819

1920
static HOSTS: &[&str] = &[
2021
"aarch64-unknown-linux-gnu",
@@ -366,6 +367,7 @@ impl Builder {
366367
self.lldb_git_commit_hash = self.git_commit_hash("lldb", "x86_64-unknown-linux-gnu");
367368
self.miri_git_commit_hash = self.git_commit_hash("miri", "x86_64-unknown-linux-gnu");
368369

370+
self.check_toolstate();
369371
self.digest_and_sign();
370372
let manifest = self.build_manifest();
371373
self.write_channel_files(&self.rust_release, &manifest);
@@ -375,6 +377,25 @@ impl Builder {
375377
}
376378
}
377379

380+
/// If a tool does not pass its tests, don't ship it.
381+
/// Right now, we do this only for Miri.
382+
fn check_toolstate(&mut self) {
383+
let toolstates: Option<HashMap<String, String>> =
384+
File::open(self.input.join("toolstates-linux.json")).ok()
385+
.and_then(|f| serde_json::from_reader(&f).ok());
386+
let toolstates = toolstates.unwrap_or_else(|| {
387+
println!("WARNING: `toolstates-linux.json` missing/malformed; \
388+
assuming all tools failed");
389+
HashMap::default() // Use empty map if anything went wrong.
390+
});
391+
// Mark some tools as missing based on toolstate.
392+
if toolstates.get("miri").map(|s| &*s as &str) != Some("test-pass") {
393+
println!("Miri tests are not passing, removing component");
394+
self.miri_version = None;
395+
self.miri_git_commit_hash = None;
396+
}
397+
}
398+
378399
/// Hash all files, compute their signatures, and collect the hashes in `self.digests`.
379400
fn digest_and_sign(&mut self) {
380401
for file in t!(self.input.read_dir()).map(|e| t!(e).path()) {

0 commit comments

Comments
 (0)