Files
runner-images/images/win/scripts/Tests/MSYS2.Tests.ps1
Maxim Lobanov a2d76d2a0e Add Windows Server 2022 image templates (#3929)
* add windows2022 image template

Co-authored-by: Aleksandr Chebotov <v-aleche@microsoft.com>
Co-authored-by: Mikhail Timofeev <48208649+miketimofeev@users.noreply.github.com>
Co-authored-by: Aleksandr Chebotov <47745270+al-cheb@users.noreply.github.com>
Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>
2021-08-23 11:13:14 +03:00

72 lines
1.9 KiB
PowerShell

BeforeAll {
$msys2Dir = "C:\msys64\usr\bin"
$originalPath = $env:PATH
}
Describe "MSYS2 packages" {
BeforeEach {
$env:PATH = "$msys2Dir;$env:PATH"
}
It "msys2Dir exists" {
$msys2Dir | Should -Exist
}
$TestCases = @(
@{ ToolName = "bash.exe" }
)
if ((Test-IsWin16) -or (Test-IsWin19)) {
$TestCases += @(
@{ ToolName = "tar.exe" }
@{ ToolName = "make.exe" }
)
}
It "<ToolName> is installed in <msys2Dir>" -TestCases $TestCases {
(Get-Command "$ToolName").Source | Should -BeLike "$msys2Dir*"
}
It "<ToolName> is avaialable" -TestCases $TestCases {
"$ToolName" | Should -ReturnZeroExitCodeWithParam
}
AfterEach {
$env:PATH = $originalPath
}
}
$mingwTypes = (Get-ToolsetContent).MsysPackages.mingw
foreach ($mingwType in $mingwTypes) {
Describe "$($mingwType.arch) packages" {
$tools = $mingwType.runtime_packages
$execDir = Join-Path "C:\msys64" $mingwType.exec_dir | Join-Path -ChildPath "bin"
foreach ($tool in $tools) {
Context "$($tool.name) package"{
$executables = $tool.executables | ForEach-Object {
@{
ExecName = $_
ExecDir = $execDir
}
}
BeforeEach {
$env:PATH = "$execDir;$env:PATH"
}
It "<ExecName> is installed in <ExecDir>" -TestCases $executables {
(Get-Command "$ExecName").Source | Should -BeLike "$ExecDir*"
}
It "<ExecName> is available" -TestCases $executables {
"$ExecName" | Should -ReturnZeroExitCodeWithParam
}
AfterEach {
$env:PATH = $originalPath
}
}
}
}
}