Skip to content

Commit 0f51d96

Browse files
committed
Update tests for ARM64
1 parent 8984e51 commit 0f51d96

17 files changed

Lines changed: 247 additions & 45 deletions

.github/workflows/validate-module.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
runs-on: ${{ matrix.os }}
5151
strategy:
5252
matrix:
53-
os: [windows-2022, windows-2025]
53+
os: [windows-2022, windows-2025, windows-11-arm]
5454

5555
steps:
5656
- uses: actions/checkout@v4

tests/Install-Mdt.ps1

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,47 @@
22
Downloads and installs the Microsoft Deployment Toolkit for testing MDT functions
33
#>
44

5-
# Download the MDT Workbench
6-
$OutFile = $([System.IO.Path]::Combine($env:RUNNER_TEMP, "MicrosoftDeploymentToolkit_x64.msi"))
7-
if (-not(Test-Path -Path $OutFile)) {
8-
Write-Host "Downloading and installing the Microsoft Deployment Toolkit"
9-
$Url = "https://download.microsoft.com/download/3/3/9/339BE62D-B4B8-4956-B58D-73C4685FC492/MicrosoftDeploymentToolkit_x64.msi"
10-
$ProgressPreference = [System.Management.Automation.ActionPreference]::SilentlyContinue
11-
$params = @{
12-
Uri = $Url
13-
OutFile = $OutFile
14-
UseBasicParsing = $true
5+
# Check if the script is running in x64 environment
6+
if ($Env:PROCESSOR_ARCHITECTURE -eq "AMD64") {
7+
8+
# Download the MDT Workbench
9+
$OutFile = $([System.IO.Path]::Combine($env:RUNNER_TEMP, "MicrosoftDeploymentToolkit_x64.msi"))
10+
if (-not(Test-Path -Path $OutFile)) {
11+
Write-Host "Downloading and installing the Microsoft Deployment Toolkit"
12+
$Url = "https://download.microsoft.com/download/3/3/9/339BE62D-B4B8-4956-B58D-73C4685FC492/MicrosoftDeploymentToolkit_x64.msi"
13+
$ProgressPreference = [System.Management.Automation.ActionPreference]::SilentlyContinue
14+
$params = @{
15+
Uri = $Url
16+
OutFile = $OutFile
17+
UseBasicParsing = $true
18+
}
19+
Invoke-WebRequest @params
1520
}
16-
Invoke-WebRequest @params
17-
}
1821

19-
# Install the Microsoft Deployment Toolkit
20-
$MdtModule = "$Env:ProgramFiles\Microsoft Deployment Toolkit\Bin\MicrosoftDeploymentToolkit.psd1"
21-
if (-not(Test-Path -Path $MdtModule)) {
22-
$params = @{
23-
FilePath = "$env:SystemRoot\System32\msiexec.exe"
24-
ArgumentList = "/package $OutFile /quiet"
25-
NoNewWindow = $true
26-
Wait = $true
27-
PassThru = $false
22+
# Install the Microsoft Deployment Toolkit
23+
$MdtModule = "$Env:ProgramFiles\Microsoft Deployment Toolkit\Bin\MicrosoftDeploymentToolkit.psd1"
24+
if (-not(Test-Path -Path $MdtModule)) {
25+
$params = @{
26+
FilePath = "$env:SystemRoot\System32\msiexec.exe"
27+
ArgumentList = "/package $OutFile /quiet"
28+
NoNewWindow = $true
29+
Wait = $true
30+
PassThru = $false
31+
}
32+
Start-Process @params
2833
}
29-
Start-Process @params
30-
}
3134

32-
# Create a deployment share for testing
33-
$Path = "$Env:RUNNER_TEMP\Deployment"
34-
if (-not(Test-Path -Path "$Path\Control\CustomSettings.ini")) {
35-
Import-Module -Name "$Env:ProgramFiles\Microsoft Deployment Toolkit\Bin\MicrosoftDeploymentToolkit.psd1"
36-
New-Item -Path $Path -ItemType "Directory" -ErrorAction "SilentlyContinue" | Out-Null
37-
$params = @{
38-
Name = "DS020"
39-
PSProvider = "MDTProvider"
40-
Root = $Path
41-
Description = "MDT Deployment Share"
35+
# Create a deployment share for testing
36+
$Path = "$Env:RUNNER_TEMP\Deployment"
37+
if (-not(Test-Path -Path "$Path\Control\CustomSettings.ini")) {
38+
Import-Module -Name "$Env:ProgramFiles\Microsoft Deployment Toolkit\Bin\MicrosoftDeploymentToolkit.psd1"
39+
New-Item -Path $Path -ItemType "Directory" -ErrorAction "SilentlyContinue" | Out-Null
40+
$params = @{
41+
Name = "DS020"
42+
PSProvider = "MDTProvider"
43+
Root = $Path
44+
Description = "MDT Deployment Share"
45+
}
46+
New-PSDrive @params | Add-MDTPersistentDrive
4247
}
43-
New-PSDrive @params | Add-MDTPersistentDrive
4448
}

tests/Manifest.Tests.ps1

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@
88
param ()
99

1010
BeforeDiscovery {
11-
$ValidateReleases = @("2017", "2019", "2022")
11+
$ValidateReleasesAmd64 = @("2017", "2019", "2022")
12+
$ValidateReleasesArm64 = @("2022")
1213
}
1314

14-
Describe -Name "VcRedist manifest tests" -ForEach $ValidateReleases {
15+
Describe -Name "VcRedist manifest tests AMD64" -ForEach $ValidateReleasesAmd64 {
1516
BeforeAll {
17+
$isAmd64 = $env:PROCESSOR_ARCHITECTURE -eq "AMD64"
18+
if (-not $isAmd64) {
19+
Write-Host "Skipping tests: Not running on AMD64 architecture."
20+
Skip "Not running on ARM64 architecture."
21+
}
22+
1623
Get-InstalledVcRedist | Uninstall-VcRedist -Confirm:$false
1724
}
1825

@@ -47,3 +54,46 @@ Describe -Name "VcRedist manifest tests" -ForEach $ValidateReleases {
4754
}
4855
}
4956
}
57+
58+
Describe -Name "VcRedist manifest tests ARM64" -ForEach $ValidateReleasesArm64 {
59+
BeforeAll {
60+
$isArm64 = $env:PROCESSOR_ARCHITECTURE -eq "ARM64"
61+
if (-not $isArm64) {
62+
Write-Host "Skipping tests: Not running on ARM64 architecture."
63+
Skip "Not running on ARM64 architecture."
64+
}
65+
66+
Get-InstalledVcRedist | Uninstall-VcRedist -Confirm:$false
67+
}
68+
69+
Context "Validate manifest" {
70+
BeforeAll {
71+
$VcManifest = "$env:GITHUB_WORKSPACE\VcRedist\VisualCRedistributables.json"
72+
Write-Host -ForegroundColor "Cyan" "`tGetting manifest from: $VcManifest."
73+
$CurrentManifest = Get-Content -Path $VcManifest | ConvertFrom-Json
74+
$VcRedist = $_
75+
76+
$Path = $([System.IO.Path]::Combine($env:RUNNER_TEMP, "Downloads"))
77+
New-Item -Path $Path -ItemType "Directory" -ErrorAction "SilentlyContinue" > $null
78+
Save-VcRedist -VcList (Get-VcList -Release $VcRedist) -Path $Path
79+
80+
$Architectures = @("arm64")
81+
}
82+
83+
Context "Compare manifest version against installed version for <VcRedist>" -ForEach $Architectures {
84+
BeforeEach {
85+
$VcList = Get-VcList -Release $VcRedist | Save-VcRedist -Path $([System.IO.Path]::Combine($env:RUNNER_TEMP, "Downloads"))
86+
Install-VcRedist -VcList $VcList -Silent
87+
$InstalledVcRedists = Get-InstalledVcRedist
88+
89+
$ManifestVcRedist = $CurrentManifest.Supported | Where-Object { $_.Release -eq $VcRedist }
90+
$InstalledItem = $InstalledVcRedists | Where-Object { ($VcRedist -eq $ManifestVcRedist.Release) -and ($_ -eq $ManifestVcRedist.Architecture) }
91+
}
92+
93+
# If the manifest version of the VcRedist is lower than the installed version, the manifest is out of date
94+
It "$($ManifestVcRedist.Release) $($ManifestVcRedist.Architecture) version should be current" {
95+
[System.Version]$InstalledItem.Version -gt [System.Version]$ManifestVcRedist.Version | Should -Be $false
96+
}
97+
}
98+
}
99+
}

tests/Private/Edit-MdtDrive.Tests.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ BeforeDiscovery {
1111
}
1212

1313
InModuleScope VcRedist {
14+
BeforeAll {
15+
$isAmd64 = $env:PROCESSOR_ARCHITECTURE -eq "AMD64"
16+
if (-not $isAmd64) {
17+
Write-Host "Skipping tests: Not running on AMD64 architecture."
18+
Skip "Not running on ARM64 architecture."
19+
}
20+
}
21+
1422
Describe -Name "Edit-MdtDrive" {
1523
Context "Validate Edit-MdtDrive" {
1624
It "Should not throw when sent a valid string" {

tests/Private/Get-Bitness.Tests.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ BeforeDiscovery {
1111
}
1212

1313
InModuleScope VcRedist {
14+
BeforeAll {
15+
$isAmd64 = $env:PROCESSOR_ARCHITECTURE -eq "AMD64"
16+
if (-not $isAmd64) {
17+
Write-Host "Skipping tests: Not running on AMD64 architecture."
18+
Skip "Not running on ARM64 architecture."
19+
}
20+
}
21+
1422
Describe -Name "Get-Bitness" {
1523
Context "Get-Bitness returns the architecture" {
1624
It "Returns x64 when run on a 64-bit machine" {

tests/Private/Import-MdtModule.Tests.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ BeforeDiscovery {
1111
}
1212

1313
InModuleScope VcRedist {
14+
BeforeAll {
15+
$isAmd64 = $env:PROCESSOR_ARCHITECTURE -eq "AMD64"
16+
if (-not $isAmd64) {
17+
Write-Host "Skipping tests: Not running on AMD64 architecture."
18+
Skip "Not running on ARM64 architecture."
19+
}
20+
}
21+
1422
Describe -Name "Import-MdtModule without MDT installed" {
1523
Context "Import-MdtModule without MDT installed" {
1624
It "Should throw when MDT is not installed" {

tests/Private/Invoke-Process.Tests.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ BeforeDiscovery {
1111
}
1212

1313
InModuleScope VcRedist {
14+
BeforeAll {
15+
$isAmd64 = $env:PROCESSOR_ARCHITECTURE -eq "AMD64"
16+
if (-not $isAmd64) {
17+
Write-Host "Skipping tests: Not running on AMD64 architecture."
18+
Skip "Not running on ARM64 architecture."
19+
}
20+
}
21+
1422
Describe -Name "Invoke-Process" {
1523
Context "Invoke-Process works as expected" {
1624
It "Should run the command without throwing an exception" {

tests/Private/New-MdtApplicationFolder.Tests.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ BeforeDiscovery {
1212

1313
InModuleScope VcRedist {
1414
BeforeAll {
15+
$isAmd64 = $env:PROCESSOR_ARCHITECTURE -eq "AMD64"
16+
if (-not $isAmd64) {
17+
Write-Host "Skipping tests: Not running on AMD64 architecture."
18+
Skip "Not running on ARM64 architecture."
19+
}
20+
1521
# Install the MDT Workbench
1622
& "$env:GITHUB_WORKSPACE\tests\Install-Mdt.ps1"
1723
Import-Module -Name "$Env:ProgramFiles\Microsoft Deployment Toolkit\Bin\MicrosoftDeploymentToolkit.psd1"

tests/Private/New-MdtDrive.Tests.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ BeforeDiscovery {
1111
}
1212

1313
InModuleScope -ModuleName "VcRedist" {
14+
BeforeAll {
15+
$isAmd64 = $env:PROCESSOR_ARCHITECTURE -eq "AMD64"
16+
if (-not $isAmd64) {
17+
Write-Host "Skipping tests: Not running on AMD64 architecture."
18+
Skip "Not running on ARM64 architecture."
19+
}
20+
}
21+
1422
Describe -Name "New-MdtDrive" {
1523
BeforeAll {
1624
# Install the MDT Workbench

tests/Public/Import-VcConfigMgrApplication.Tests.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ BeforeDiscovery {
1313

1414
Describe -Name "Validate Import-VcConfigMgrApplication" -ForEach $SupportedReleases {
1515
BeforeAll {
16+
$isAmd64 = $env:PROCESSOR_ARCHITECTURE -eq "AMD64"
17+
if (-not $isAmd64) {
18+
Write-Host "Skipping tests: Not running on AMD64 architecture."
19+
Skip "Not running on AMD64 architecture."
20+
}
21+
1622
$Release = $_
1723
$Path = $([System.IO.Path]::Combine($env:RUNNER_TEMP, "Downloads"))
1824
New-Item -Path $Path -ItemType "Directory" -ErrorAction "SilentlyContinue" | Out-Null

0 commit comments

Comments
 (0)