Skip to content

Commit

Permalink
Update win 10 sdk tests to capture and inspect output
Browse files Browse the repository at this point in the history
  • Loading branch information
mokagio committed Feb 19, 2025
1 parent 13e2b9c commit 4701b45
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
37 changes: 33 additions & 4 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,14 @@ steps:
- label: ":windows: install_windows_10_sdk Tests - Standard version file"
command: |
echo '20348' > .windows-10-sdk-version
bin/install_windows_10_sdk.ps1 -DryRun
$output = & bin/install_windows_10_sdk.ps1 -DryRun
$exitCode = $LASTEXITCODE
if ($exitCode -ne 0) {
echo "Unexpected failure. Exit code: $exitCode"
echo "Output:"
echo $output
exit 1
}
agents:
queue: windows
notify:
Expand All @@ -133,8 +140,19 @@ steps:

- label: ":windows: install_windows_10_sdk Tests - Version file with new lines"
command: |
echo "20348\n\n" > .windows-10-sdk-version
bin/install_windows_10_sdk.ps1 -DryRun
echo "20348`n`n" > .windows-10-sdk-version
$output = & bin/install_windows_10_sdk.ps1 -DryRun
$exitCode = $LASTEXITCODE
if ($exitCode -ne 0) {
echo "Unexpected failure. Exit code: $exitCode"
echo "Output:"
echo $output
exit 1
}
if (($output -notmatch "[!] Invalid version file format") -and ($output -notmatch "Expected exactly one non-empty line")) {
echo "Failure message did not match expectation."
exit 1
}
agents:
queue: windows
notify:
Expand All @@ -144,7 +162,18 @@ steps:
- label: ":windows: install_windows_10_sdk Tests - Version file with a word"
command: |
echo "not an integer" > .windows-10-sdk-version
bin/install_windows_10_sdk.ps1 -DryRun
$output = & bin/install_windows_10_sdk.ps1 -DryRun
$exitCode = $LASTEXITCODE
if ($exitCode -ne 1) {
echo "Expected exit code 1, got: $exitCode"
echo "Output:"
echo $output
exit 1
}
if (($output -notmatch "[!] Invalid version file format") -and ($output -notmatch "Expected an integer, got:'")) {
echo "Failure message did not match expectation."
exit 1
}
agents:
queue: windows
notify:
Expand Down
4 changes: 2 additions & 2 deletions bin/install_windows_10_sdk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if ($windows10SDKVersion.Count -ne 1) {
}

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

# Install the Windows SDK and other required components
Expand Down

0 comments on commit 4701b45

Please sign in to comment.