From 1320fad8b086ae3c187a702c17918999891584b9 Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Sun, 5 Oct 2025 20:28:06 -0700 Subject: [PATCH 1/2] Revert "Narrowly fix Test-Packages.ps1 and Analyze-Code.ps1 (#3106)" This reverts commit 2cc1aec2bc3b38923e7e71dd041cb339a1fcabdd. --- eng/scripts/Analyze-Code.ps1 | 81 +++++------------------------------ eng/scripts/Test-Packages.ps1 | 24 ++--------- 2 files changed, 13 insertions(+), 92 deletions(-) diff --git a/eng/scripts/Analyze-Code.ps1 b/eng/scripts/Analyze-Code.ps1 index b631d984fd..10c0b3109f 100755 --- a/eng/scripts/Analyze-Code.ps1 +++ b/eng/scripts/Analyze-Code.ps1 @@ -20,48 +20,18 @@ Analyzing code with "@ if ($CheckWasm) { - # Temporary fix to exit immediately on failure. LogError should Write-Error - # instead - $command = "rustup target add wasm32-unknown-unknown" - Invoke-LoggedCommand $command - if ($LastExitCode) { - Write-Error "Failed to execute $command" - } + Invoke-LoggedCommand "rustup target add wasm32-unknown-unknown" } if ($Deny) { - # Temporary fix to exit immediately on failure. LogError should Write-Error - # instead - $command = "cargo install cargo-deny --locked" - Invoke-LoggedCommand $command - if ($LastExitCode) { - Write-Error "Failed to execute $command" - } + Invoke-LoggedCommand "cargo install cargo-deny --locked" } -# Temporary fix to exit immediately on failure. LogError should Write-Error -# instead -$command = "cargo check --package azure_core --all-features --all-targets --keep-going" -Invoke-LoggedCommand $command -if ($LastExitCode) { - Write-Error "Failed to execute $command" -} +Invoke-LoggedCommand "cargo check --package azure_core --all-features --all-targets --keep-going" -# Temporary fix to exit immediately on failure. LogError should Write-Error -# instead -$command = "cargo fmt --all -- --check" -Invoke-LoggedCommand $command -if ($LastExitCode) { - Write-Error "Failed to execute $command" -} +Invoke-LoggedCommand "cargo fmt --all -- --check" -# Temporary fix to exit immediately on failure. LogError should Write-Error -# instead -$command = "cargo clippy --workspace --all-features --all-targets --keep-going --no-deps" -Invoke-LoggedCommand $command -if ($LastExitCode) { - Write-Error "Failed to execute $command" -} +Invoke-LoggedCommand "cargo clippy --workspace --all-features --all-targets --keep-going --no-deps" if ($CheckWasm) { # Save the original RUSTFLAGS to restore later @@ -69,35 +39,17 @@ if ($CheckWasm) { # This is needed to ensure that the `getrandom` crate uses the `wasm_js` backend $env:RUSTFLAGS = ${env:RUSTFLAGS} + ' --cfg getrandom_backend="wasm_js"' - # Temporary fix to exit immediately on failure. LogError should Write-Error - # instead - $command = "cargo clippy --target=wasm32-unknown-unknown --workspace --keep-going --no-deps" - Invoke-LoggedCommand $command - if ($LastExitCode) { - Write-Error "Failed to execute $command" - } + Invoke-LoggedCommand "cargo clippy --target=wasm32-unknown-unknown --workspace --keep-going --no-deps" # Restore the original RUSTFLAGS, since the getrandom config option can only be set for wasm32-unknown-unknown builds. $env:RUSTFLAGS = $OriginalRustFlags } if ($Deny) { - # Temporary fix to exit immediately on failure. LogError should Write-Error - # instead - $command = "cargo deny --all-features check" - Invoke-LoggedCommand $command - if ($LastExitCode) { - Write-Error "Failed to execute $command" - } + Invoke-LoggedCommand "cargo deny --all-features check" } -# Temporary fix to exit immediately on failure. LogError should Write-Error -# instead -$command = "cargo doc --workspace --no-deps --all-features" -Invoke-LoggedCommand $command -if ($LastExitCode) { - Write-Error "Failed to execute $command" -} +Invoke-LoggedCommand "cargo doc --workspace --no-deps --all-features" # Verify package dependencies $verifyDependenciesScript = Join-Path $RepoRoot 'eng' 'scripts' 'verify-dependencies.rs' -Resolve @@ -105,14 +57,7 @@ $verifyDependenciesScript = Join-Path $RepoRoot 'eng' 'scripts' 'verify-dependen if (!$SkipPackageAnalysis) { if (!(Test-Path $PackageInfoDirectory)) { Write-Host "Analyzing workspace`n" - # Temporary fix to exit immediately on failure. LogError should Write-Error - # instead - $command = "&$verifyDependenciesScript $RepoRoot/Cargo.toml" - $result = Invoke-LoggedCommand $command - if ($LastExitCode) { - Write-Error "Failed to execute $command" - } - return $result + return Invoke-LoggedCommand "&$verifyDependenciesScript $RepoRoot/Cargo.toml" } $packagesToTest = Get-ChildItem $PackageInfoDirectory -Filter "*.json" -Recurse @@ -121,12 +66,6 @@ if (!$SkipPackageAnalysis) { foreach ($package in $packagesToTest) { Write-Host "Analyzing package '$($package.Name)' in directory '$($package.DirectoryPath)'`n" - # Temporary fix to exit immediately on failure. LogError should Write-Error - # instead - $command = "&$verifyDependenciesScript $($package.DirectoryPath)/Cargo.toml" - Invoke-LoggedCommand $command - if ($LastExitCode) { - Write-Error "Failed to execute $command" - } + Invoke-LoggedCommand "&$verifyDependenciesScript $($package.DirectoryPath)/Cargo.toml" } } diff --git a/eng/scripts/Test-Packages.ps1 b/eng/scripts/Test-Packages.ps1 index 1d24d11fa2..a9515d9f8d 100755 --- a/eng/scripts/Test-Packages.ps1 +++ b/eng/scripts/Test-Packages.ps1 @@ -56,31 +56,13 @@ foreach ($package in $packagesToTest) { Write-Host "`n`nTesting package: '$($package.Name)'`n" - # Temporary fix to exit immediately on failure. LogError should Write-Error - # instead - $command = "cargo build --keep-going" - Invoke-LoggedCommand $command -GroupOutput - if ($LastExitCode) { - Write-Error "Failed to execute $command" - } + Invoke-LoggedCommand "cargo build --keep-going" -GroupOutput Write-Host "`n`n" - # Temporary fix to exit immediately on failure. LogError should Write-Error - # instead - $command = "cargo test --doc --no-fail-fast" - Invoke-LoggedCommand $command -GroupOutput - if ($LastExitCode) { - Write-Error "Failed to execute $command" - } + Invoke-LoggedCommand "cargo test --doc --no-fail-fast" -GroupOutput Write-Host "`n`n" - # Temporary fix to exit immediately on failure. LogError should Write-Error - # instead - $command = "cargo test --all-targets --no-fail-fast" - Invoke-LoggedCommand $command -GroupOutput - if ($LastExitCode) { - Write-Error "Failed to execute $command" - } + Invoke-LoggedCommand "cargo test --all-targets --no-fail-fast" -GroupOutput Write-Host "`n`n" $cleanupScript = Join-Path $packageDirectory "Test-Cleanup.ps1" From b477ed5cb1ab1e1379c079468d29893019b0b37c Mon Sep 17 00:00:00 2001 From: Daniel Jurek Date: Sun, 5 Oct 2025 20:47:42 -0700 Subject: [PATCH 2/2] Contrive a failure --- sdk/core/azure_core/tests/core_error_http_response.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/core/azure_core/tests/core_error_http_response.rs b/sdk/core/azure_core/tests/core_error_http_response.rs index 2e888e5585..c2ecb07d42 100644 --- a/sdk/core/azure_core/tests/core_error_http_response.rs +++ b/sdk/core/azure_core/tests/core_error_http_response.rs @@ -44,7 +44,7 @@ async fn deconstruct_raw_response() -> Result<(), Box> { assert_eq!(status, &StatusCode::BadRequest); assert_eq!(error_code.as_deref(), Some("BadParameter")); assert!( - matches!(raw_response, Some(r) if str::from_utf8(r.body())?.contains("Unknown parameter")) + matches!(raw_response, Some(r) if str::from_utf8(r.body())?.contains("test-failure")) ); Ok(())