fix pester tests

This commit is contained in:
Aleksandr Chebotov
2020-09-23 10:41:23 +03:00
parent 2148a2bd2f
commit ed62416e84
3 changed files with 19 additions and 14 deletions

View File

@@ -6,14 +6,18 @@ New-Item -Path $shellPath -ItemType Directory | Out-Null
New-Item -ItemType SymbolicLink -Path "$shellPath\bash.exe" -Target "C:\msys64\usr\bin\bash.exe" | Out-Null
New-Item -ItemType SymbolicLink -Path "$shellPath\sh.exe" -Target "C:\msys64\usr\bin\sh.exe" | Out-Null
# winbash <--> C:\Windows\System32\bash.exe
New-Item -ItemType SymbolicLink -Path "$shellPath\winbash.exe" -Target "$env:SystemRoot\System32\bash.exe" | Out-Null
# WSL is available on Windows Server 2019
if (Test-IsWin19)
{
# winbash <--> C:\Windows\System32\bash.exe
New-Item -ItemType SymbolicLink -Path "$shellPath\winbash.exe" -Target "$env:SystemRoot\System32\bash.exe" | Out-Null
}
# git4bash <--> C:\Program Files\Git\bin\bash.exe
New-Item -ItemType SymbolicLink -Path "$shellPath\git4bash.exe" -Target "$env:ProgramFiles\Git\bin\bash.exe" | Out-Null
# MSYS2 <--> C:\msys64\usr\bin\bash.exe
New-Item -ItemType SymbolicLink -Path "$shellPath\msys2.exe" -Target "C:\msys64\usr\bin\bash.exe" | Out-Null
New-Item -ItemType SymbolicLink -Path "$shellPath\msys2bash.exe" -Target "C:\msys64\usr\bin\bash.exe" | Out-Null
# Add shells to PATH
Add-MachinePathItem $shellPath

View File

@@ -12,15 +12,12 @@ $dash = "-" * 40
# Downloading msys2
$msys2Release = "https://api.github.com/repos/msys2/msys2-installer/releases/latest"
$msys2Uri = ((Invoke-RestMethod $msys2Release).assets | Where-Object {
$_.name -match "x86_64" -and $_.name.EndsWith("tar.xz") }).browser_download_url
$_.name -match "x86_64" -and $_.name.EndsWith("sfx.exe") }).browser_download_url
$msys2File = Start-DownloadWithRetry -Url $msys2Uri
# extract tar.xz to C:\
# extract sfx.exe to C:\
Write-Host "Starting msys2 extraction"
$tempPath = Join-Path $env:Temp msys
Extract-7Zip -Path $msys2File -DestinationPath $tempPath
$tarPath = Resolve-Path $tempPath\msys*.tar
Extract-7Zip -Path $tarPath -DestinationPath C:\
& $msys2File -y -oC:\
Write-Host "Finished extraction"
# Add msys2 bin tools folders to PATH temporary
@@ -83,7 +80,4 @@ $pathValue = Get-ItemPropertyValue -Path $regEnvKey -Name 'Path'
$pathValue += ";C:\msys64\mingw64\bin;C:\msys64\usr\bin"
Set-ItemProperty -Path $regEnvKey -Name 'Path' -Value $pathValue
# Rename python
Rename-Item "C:\msys64\usr\bin\python.exe" -NewName "_python.exe"
Invoke-PesterTests -TestFile "MSYS2"