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

when Miri tests are not passing, do not add Miri component #66053

Merged
merged 4 commits into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ name = "build-manifest"
version = "0.1.0"
dependencies = [
"serde",
"serde_json",
"toml",
]

Expand Down
1 change: 1 addition & 0 deletions src/tools/build-manifest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ edition = "2018"
[dependencies]
toml = "0.5"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
24 changes: 23 additions & 1 deletion src/tools/build-manifest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@
//! via `x.py dist hash-and-sign`; the cmdline arguments are set up
//! by rustbuild (in `src/bootstrap/dist.rs`).

#![feature(try_blocks)]
#![deny(warnings)]

use toml;
use serde::Serialize;

use std::collections::BTreeMap;
use std::env;
use std::fs;
use std::fs::{self, File};
use std::io::{self, Read, Write};
use std::path::{PathBuf, Path};
use std::process::{Command, Stdio};
use std::collections::HashMap;

static HOSTS: &[&str] = &[
"aarch64-unknown-linux-gnu",
Expand Down Expand Up @@ -366,6 +368,7 @@ impl Builder {
self.lldb_git_commit_hash = self.git_commit_hash("lldb", "x86_64-unknown-linux-gnu");
self.miri_git_commit_hash = self.git_commit_hash("miri", "x86_64-unknown-linux-gnu");

self.check_toolstate();
self.digest_and_sign();
let manifest = self.build_manifest();
self.write_channel_files(&self.rust_release, &manifest);
Expand All @@ -375,6 +378,25 @@ impl Builder {
}
}

/// If a tool does not pass its tests, don't ship it.
/// Right now, we do this only for Miri.
fn check_toolstate(&mut self) {
let toolstates: Option<HashMap<String, String>> = try {
let toolstates = File::open(self.input.join("toolstates-linux.json")).ok()?;
serde_json::from_reader(&toolstates).ok()?
};
RalfJung marked this conversation as resolved.
Show resolved Hide resolved
let toolstates = toolstates.unwrap_or_else(|| {
println!("WARNING: `toolstates-linux.json` missing; assuming all tools failed");
HashMap::default() // Use empty map if anything went wrong.
pietroalbini marked this conversation as resolved.
Show resolved Hide resolved
});
// Mark some tools as missing based on toolstate.
if toolstates.get("miri").map(|s| &*s as &str) != Some("test-pass") {
println!("Miri tests are not passing, removing component");
self.miri_version = None;
self.miri_git_commit_hash = None;
}
}

/// Hash all files, compute their signatures, and collect the hashes in `self.digests`.
fn digest_and_sign(&mut self) {
for file in t!(self.input.read_dir()).map(|e| t!(e).path()) {
Expand Down