Skip to content

Commit c8ab286

Browse files
authored
Revert "Narrowly fix Test-Packages.ps1 and Analyze-Code.ps1" (Azure#3112)
Reverts Azure#3106 Example failure (test and analyze failures expected): https://dev.azure.com/azure-sdk/public/_build/results?buildId=5418072&view=results Example success: https://dev.azure.com/azure-sdk/public/_build/results?buildId=5418071&view=results
1 parent c0f389e commit c8ab286

File tree

2 files changed

+15
-106
lines changed

2 files changed

+15
-106
lines changed

eng/scripts/Analyze-Code.ps1

Lines changed: 12 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -21,109 +21,48 @@ Analyzing code with
2121
"@
2222

2323
if ($CheckWasm) {
24-
# Temporary fix to exit immediately on failure. LogError should Write-Error
25-
# instead
26-
$command = "rustup target add wasm32-unknown-unknown"
27-
Invoke-LoggedCommand $command
28-
if ($LastExitCode) {
29-
Write-Error "Failed to execute $command"
30-
}
24+
Invoke-LoggedCommand "rustup target add wasm32-unknown-unknown"
3125
}
3226

3327
if ($Deny) {
34-
# Temporary fix to exit immediately on failure. LogError should Write-Error
35-
# instead
36-
$command = "cargo install cargo-deny --locked"
37-
Invoke-LoggedCommand $command
38-
if ($LastExitCode) {
39-
Write-Error "Failed to execute $command"
40-
}
28+
Invoke-LoggedCommand "cargo install cargo-deny --locked"
4129
}
4230

43-
# Temporary fix to exit immediately on failure. LogError should Write-Error
44-
# instead
45-
$command = "cargo check --package azure_core --all-features --all-targets --keep-going"
46-
Invoke-LoggedCommand $command
47-
if ($LastExitCode) {
48-
Write-Error "Failed to execute $command"
49-
}
31+
Invoke-LoggedCommand "cargo check --package azure_core --all-features --all-targets --keep-going"
5032

51-
# Temporary fix to exit immediately on failure. LogError should Write-Error
52-
# instead
53-
$command = "cargo fmt --all -- --check"
54-
Invoke-LoggedCommand $command
55-
if ($LastExitCode) {
56-
Write-Error "Failed to execute $command"
57-
}
33+
Invoke-LoggedCommand "cargo fmt --all -- --check"
5834

59-
# Temporary fix to exit immediately on failure. LogError should Write-Error
60-
# instead
61-
$command = "cargo clippy --workspace --all-features --all-targets --keep-going --no-deps"
62-
Invoke-LoggedCommand $command
63-
if ($LastExitCode) {
64-
Write-Error "Failed to execute $command"
65-
}
35+
Invoke-LoggedCommand "cargo clippy --workspace --all-features --all-targets --keep-going --no-deps"
6636

6737
if ($CheckWasm) {
6838
# Save the original RUSTFLAGS to restore later
6939
$OriginalRustFlags = $env:RUSTFLAGS
7040
# This is needed to ensure that the `getrandom` crate uses the `wasm_js` backend
7141
$env:RUSTFLAGS = ${env:RUSTFLAGS} + ' --cfg getrandom_backend="wasm_js"'
7242

73-
# Temporary fix to exit immediately on failure. LogError should Write-Error
74-
# instead
75-
$command = "cargo clippy --target=wasm32-unknown-unknown --workspace --keep-going --no-deps"
76-
Invoke-LoggedCommand $command
77-
if ($LastExitCode) {
78-
Write-Error "Failed to execute $command"
79-
}
43+
Invoke-LoggedCommand "cargo clippy --target=wasm32-unknown-unknown --workspace --keep-going --no-deps"
8044

8145
# Restore the original RUSTFLAGS, since the getrandom config option can only be set for wasm32-unknown-unknown builds.
8246
$env:RUSTFLAGS = $OriginalRustFlags
8347
}
8448

8549
if ($Deny) {
86-
# Temporary fix to exit immediately on failure. LogError should Write-Error
87-
# instead
88-
$command = "cargo deny --all-features check"
89-
Invoke-LoggedCommand $command
90-
if ($LastExitCode) {
91-
Write-Error "Failed to execute $command"
92-
}
50+
Invoke-LoggedCommand "cargo deny --all-features check"
9351
}
9452

95-
# Temporary fix to exit immediately on failure. LogError should Write-Error
96-
# instead
97-
$command = "cargo doc --workspace --no-deps --all-features"
98-
Invoke-LoggedCommand $command
99-
if ($LastExitCode) {
100-
Write-Error "Failed to execute $command"
101-
}
53+
Invoke-LoggedCommand "cargo doc --workspace --no-deps --all-features"
10254

10355
# Verify package dependencies
10456
$verifyDependenciesScript = Join-Path $RepoRoot 'eng' 'scripts' 'verify-dependencies.rs' -Resolve
10557

10658
if (!$SkipPackageAnalysis) {
10759
if (!(Test-Path $PackageInfoDirectory)) {
10860
Write-Host "Analyzing workspace`n"
109-
# Temporary fix to exit immediately on failure. LogError should Write-Error
110-
# instead
111-
$command = "&$verifyDependenciesScript $RepoRoot/Cargo.toml"
112-
$result = Invoke-LoggedCommand $command
113-
if ($LastExitCode) {
114-
Write-Error "Failed to execute $command"
115-
}
116-
return $result
61+
return Invoke-LoggedCommand "&$verifyDependenciesScript $RepoRoot/Cargo.toml"
11762
}
11863

11964
if ($Toolchain -eq 'nightly') {
120-
# Temporary fix to exit immediately on failure. LogError should Write-Error
121-
# instead
122-
$command = "cargo install --locked cargo-docs-rs"
123-
Invoke-LoggedCommand $command
124-
if ($LastExitCode) {
125-
Write-Error "Failed to execute $command"
126-
}
65+
Invoke-LoggedCommand "cargo install --locked cargo-docs-rs"
12766
}
12867

12968
$packagesToTest = Get-ChildItem $PackageInfoDirectory -Filter "*.json" -Recurse
@@ -132,22 +71,10 @@ if (!$SkipPackageAnalysis) {
13271

13372
foreach ($package in $packagesToTest) {
13473
Write-Host "Analyzing package '$($package.Name)' in directory '$($package.DirectoryPath)'`n"
135-
# Temporary fix to exit immediately on failure. LogError should Write-Error
136-
# instead
137-
$command = "&$verifyDependenciesScript $($package.DirectoryPath)/Cargo.toml"
138-
Invoke-LoggedCommand $command
139-
if ($LastExitCode) {
140-
Write-Error "Failed to execute $command"
141-
}
74+
Invoke-LoggedCommand "&$verifyDependenciesScript $($package.DirectoryPath)/Cargo.toml"
14275

14376
if ($Toolchain -eq 'nightly') {
144-
# Temporary fix to exit immediately on failure. LogError should Write-Error
145-
# instead
146-
$command = "cargo +nightly docs-rs --package $($package.Name)"
147-
Invoke-LoggedCommand $command
148-
if ($LastExitCode) {
149-
Write-Error "Failed to execute $command"
150-
}
77+
Invoke-LoggedCommand "cargo +nightly docs-rs --package $($package.Name)"
15178
}
15279
}
15380
}

eng/scripts/Test-Packages.ps1

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,31 +56,13 @@ foreach ($package in $packagesToTest) {
5656

5757
Write-Host "`n`nTesting package: '$($package.Name)'`n"
5858

59-
# Temporary fix to exit immediately on failure. LogError should Write-Error
60-
# instead
61-
$command = "cargo build --keep-going"
62-
Invoke-LoggedCommand $command -GroupOutput
63-
if ($LastExitCode) {
64-
Write-Error "Failed to execute $command"
65-
}
59+
Invoke-LoggedCommand "cargo build --keep-going" -GroupOutput
6660
Write-Host "`n`n"
6761

68-
# Temporary fix to exit immediately on failure. LogError should Write-Error
69-
# instead
70-
$command = "cargo test --doc --no-fail-fast"
71-
Invoke-LoggedCommand $command -GroupOutput
72-
if ($LastExitCode) {
73-
Write-Error "Failed to execute $command"
74-
}
62+
Invoke-LoggedCommand "cargo test --doc --no-fail-fast" -GroupOutput
7563
Write-Host "`n`n"
7664

77-
# Temporary fix to exit immediately on failure. LogError should Write-Error
78-
# instead
79-
$command = "cargo test --all-targets --no-fail-fast"
80-
Invoke-LoggedCommand $command -GroupOutput
81-
if ($LastExitCode) {
82-
Write-Error "Failed to execute $command"
83-
}
65+
Invoke-LoggedCommand "cargo test --all-targets --no-fail-fast" -GroupOutput
8466
Write-Host "`n`n"
8567

8668
$cleanupScript = Join-Path $packageDirectory "Test-Cleanup.ps1"

0 commit comments

Comments
 (0)