From f82315a37e02e8815e09a001779e2843a64f5591 Mon Sep 17 00:00:00 2001 From: hyd-dev Date: Wed, 3 Feb 2021 00:33:42 +0800 Subject: [PATCH 1/2] Don't release Miri if its tests only failed on Windows --- .github/workflows/ci.yml | 1 + src/ci/github-actions/ci.yml | 1 + src/tools/build-manifest/src/main.rs | 25 ++++++++++++------------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f10b6ca7ea94d..13b312afa37e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index 9eea6243dfa57..5b9b7795c1bdb 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -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. diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 73a4cbd07924f..9eeeb409d44e0 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -257,21 +257,20 @@ 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> = - File::open(self.input.join("toolstates-linux.json")) + for file in &["toolstates-linux.json", "toolstates-windows.json"] { + let toolstates: Option> = 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; + } } } From f87afe54b87586a80b9a2b8e0193c933ef763e6d Mon Sep 17 00:00:00 2001 From: hyd-dev Date: Sun, 7 Feb 2021 00:20:55 +0800 Subject: [PATCH 2/2] Extend the comment of `check_toolstate()` to clarify that the tool won't be shipped on all targets --- src/tools/build-manifest/src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 9eeeb409d44e0..d7c2fb8c8b893 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -254,7 +254,10 @@ 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) { for file in &["toolstates-linux.json", "toolstates-windows.json"] {