Skip to content

Commit 67f168e

Browse files
committed
Update win 10 sdk tests to capture and inspect output
1 parent 13e2b9c commit 67f168e

File tree

2 files changed

+35
-6
lines changed

2 files changed

+35
-6
lines changed

.buildkite/pipeline.yml

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,14 @@ steps:
124124
- label: ":windows: install_windows_10_sdk Tests - Standard version file"
125125
command: |
126126
echo '20348' > .windows-10-sdk-version
127-
bin/install_windows_10_sdk.ps1 -DryRun
127+
$output = bin/install_windows_10_sdk.ps1 -DryRun
128+
$exitCode = $LASTEXITCODE
129+
if ($exitCode -ne 0) {
130+
echo "Unexpected failure. Exit code: $exitCode"
131+
echo "Output:"
132+
echo $output
133+
exit 1
134+
}
128135
agents:
129136
queue: windows
130137
notify:
@@ -133,8 +140,19 @@ steps:
133140

134141
- label: ":windows: install_windows_10_sdk Tests - Version file with new lines"
135142
command: |
136-
echo "20348\n\n" > .windows-10-sdk-version
137-
bin/install_windows_10_sdk.ps1 -DryRun
143+
echo "20348`n`n" > .windows-10-sdk-version
144+
$output = bin/install_windows_10_sdk.ps1 -DryRun
145+
$exitCode = $LASTEXITCODE
146+
if ($exitCode -ne 0) {
147+
echo "Unexpected failure. Exit code: $exitCode"
148+
echo "Output:"
149+
echo $output
150+
exit 1
151+
}
152+
if (($output -notmatch "[!] Invalid version file format") -and ($output -notmatch "Expected exactly one non-empty line")) {
153+
echo "Failure message did not match expectation."
154+
exit 1
155+
}
138156
agents:
139157
queue: windows
140158
notify:
@@ -144,7 +162,18 @@ steps:
144162
- label: ":windows: install_windows_10_sdk Tests - Version file with a word"
145163
command: |
146164
echo "not an integer" > .windows-10-sdk-version
147-
bin/install_windows_10_sdk.ps1 -DryRun
165+
$output = bin/install_windows_10_sdk.ps1 -DryRun
166+
$exitCode = $LASTEXITCODE
167+
if ($exitCode -ne 1) {
168+
echo "Expected exit code 1, got: $exitCode"
169+
echo "Output:"
170+
echo $output
171+
exit 1
172+
}
173+
if (($output -notmatch "[!] Invalid version file format") -and ($output -notmatch "Expected an integer, got:'")) {
174+
echo "Failure message did not match expectation."
175+
exit 1
176+
}
148177
agents:
149178
queue: windows
150179
notify:

bin/install_windows_10_sdk.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if ($windows10SDKVersion.Count -ne 1) {
2424
}
2525

2626
if ($windows10SDKVersion -notmatch '^\d+$') {
27-
Write-Output "[!] Invalid version format."
27+
Write-Output "[!] Invalid version file format."
2828
Write-Output "Expected an integer, got: '$windows10SDKVersion'"
2929
exit 1
3030
}
@@ -49,7 +49,7 @@ If (-not (Test-Path $buildToolsPath)) {
4949
Write-Output "[!] Failed to download Visual Studio Build Tools"
5050
Exit 1
5151
} else {
52-
Write-Output "Successfully downloaded Visual Studio Build Toosl at $buildToolsPath."
52+
Write-Output "Successfully downloaded Visual Studio Build Tools at $buildToolsPath."
5353
}
5454

5555
# Install the Windows SDK and other required components

0 commit comments

Comments
 (0)