From 2edfe8d07031db40a74656e0430ca1abe0c1a83b Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 20 Feb 2024 13:24:50 -0800 Subject: [PATCH] Add workaround for RUSTUP_WINDOWS_PATH_ADD_BIN. On Windows, rustup has an issue with recursive cargo invocations. This commit can be removed once https://github.com/rust-lang/rustup/issues/3036 is resolved. --- .github/workflows/main.yml | 3 ++- crates/cargo-test-macro/src/lib.rs | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f8381b393599..249faea5c71b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -116,6 +116,8 @@ jobs: CARGO_PROFILE_TEST_DEBUG: 1 CARGO_INCREMENTAL: 0 CARGO_PUBLIC_NETWORK_TESTS: 1 + # Workaround for https://github.com/rust-lang/rustup/issues/3036 + RUSTUP_WINDOWS_PATH_ADD_BIN: 0 strategy: matrix: include: @@ -170,7 +172,6 @@ jobs: - name: Configure extra test environment run: echo CARGO_CONTAINER_TESTS=1 >> $GITHUB_ENV if: matrix.os == 'ubuntu-latest' - - run: cargo test -p cargo - name: Clear intermediate test output run: ci/clean-test-output.sh diff --git a/crates/cargo-test-macro/src/lib.rs b/crates/cargo-test-macro/src/lib.rs index 39f37f4e5ca9..ef59733fcd39 100644 --- a/crates/cargo-test-macro/src/lib.rs +++ b/crates/cargo-test-macro/src/lib.rs @@ -248,6 +248,13 @@ fn has_rustup_stable() -> bool { // This cannot run on rust-lang/rust CI due to the lack of rustup. return false; } + if cfg!(windows) && !is_ci() && option_env!("RUSTUP_WINDOWS_PATH_ADD_BIN").is_none() { + // There is an issue with rustup that doesn't allow recursive cargo + // invocations. Disable this on developer machines if the environment + // variable is not enabled. This can be removed once + // https://github.com/rust-lang/rustup/issues/3036 is resolved. + return false; + } check_command("cargo", &["+stable", "--version"]) }