Auto merge of #81666 - hyd-dev:miri-windows-test-fail, r=Mark-Simulacrum

Don't release Miri if its tests only failed on Windows

Extends #66053 to Windows, so the released Miri won't be broken if its tests only fail on Windows.

Relevant Zulip thread: https://rust-lang.zulipchat.com/#narrow/stream/269128-miri/topic/Miri.20is.20still.20available.20in.20rustup.20today.3F
This commit is contained in:
bors 2021-02-13 13:47:02 +00:00
commit 7e0241c637
3 changed files with 18 additions and 14 deletions

View File

@ -349,6 +349,7 @@ jobs:
env:
SCRIPT: src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstate/toolstates.json"
DEPLOY_TOOLSTATES_JSON: toolstates-windows.json
os: windows-latest-xl
- name: i686-mingw-1
env:

View File

@ -531,6 +531,7 @@ jobs:
env:
SCRIPT: src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh x.py /tmp/toolstate/toolstates.json windows
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --save-toolstates=/tmp/toolstate/toolstates.json
DEPLOY_TOOLSTATES_JSON: toolstates-windows.json
<<: *job-windows-xl
# 32/64-bit MinGW builds.

View File

@ -254,24 +254,26 @@ impl Builder {
t!(self.checksums.store_cache());
}
/// If a tool does not pass its tests, don't ship it.
/// If a tool does not pass its tests on *any* of Linux and Windows, don't ship
/// it on *all* targets, because tools like Miri can "cross-run" programs for
/// different targets, for example, run a program for `x86_64-pc-windows-msvc`
/// on `x86_64-unknown-linux-gnu`.
/// Right now, we do this only for Miri.
fn check_toolstate(&mut self) {
let toolstates: Option<HashMap<String, String>> =
File::open(self.input.join("toolstates-linux.json"))
for file in &["toolstates-linux.json", "toolstates-windows.json"] {
let toolstates: Option<HashMap<String, String>> = File::open(self.input.join(file))
.ok()
.and_then(|f| serde_json::from_reader(&f).ok());
let toolstates = toolstates.unwrap_or_else(|| {
println!(
"WARNING: `toolstates-linux.json` missing/malformed; \
assuming all tools failed"
);
HashMap::default() // Use empty map if anything went wrong.
});
// 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.versions.disable_version(&PkgType::Miri);
let toolstates = toolstates.unwrap_or_else(|| {
println!("WARNING: `{}` missing/malformed; assuming all tools failed", file);
HashMap::default() // Use empty map if anything went wrong.
});
// 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.versions.disable_version(&PkgType::Miri);
break;
}
}
}