Upload unit test as artifacts (#337)
Update vsts scripts to upload unit tests as artifacts
This commit is contained in:
parent
92f363bef1
commit
4ac87b4991
|
@ -14,18 +14,22 @@ param (
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Push-location $repolocation
|
Push-location $repolocation
|
||||||
Import-Module "$repolocation\contrib\win32\openssh\OpenSSHBuildHelper.psm1" -Force
|
Import-Module "$repolocation\contrib\win32\openssh\OpenSSHBuildHelper.psm1" -Force
|
||||||
|
$UnitTestFolder = "Unittests-$NativeHostArch"
|
||||||
$Bucket = "OpenSSH-$NativeHostArch"
|
$Bucket = "OpenSSH-$NativeHostArch"
|
||||||
if($NativeHostArch -ieq 'x86') {
|
if($NativeHostArch -ieq 'x86') {
|
||||||
$Bucket = "OpenSSH-Win32"
|
$Bucket = "OpenSSH-Win32"
|
||||||
|
$UnitTestFolder = "Unittests-Win32"
|
||||||
}
|
}
|
||||||
elseif($NativeHostArch -ieq 'x64') {
|
elseif($NativeHostArch -ieq 'x64') {
|
||||||
$Bucket = "OpenSSH-Win64"
|
$Bucket = "OpenSSH-Win64"
|
||||||
|
$UnitTestFolder = "Unittests-Win64"
|
||||||
}
|
}
|
||||||
Write-Verbose "Start-OpenSSHBuild -NativeHostArch $NativeHostArch -Configuration $Configuration -NoOpenSSL:$NoOpenSSL -Onecore:$OneCore -Verbose " -Verbose
|
Write-Verbose "Start-OpenSSHBuild -NativeHostArch $NativeHostArch -Configuration $Configuration -NoOpenSSL:$NoOpenSSL -Onecore:$OneCore -Verbose " -Verbose
|
||||||
Start-OpenSSHBuild -NativeHostArch $NativeHostArch -Configuration $Configuration -NoOpenSSL:$NoOpenSSL -Onecore:$OneCore -Verbose
|
Start-OpenSSHBuild -NativeHostArch $NativeHostArch -Configuration $Configuration -NoOpenSSL:$NoOpenSSL -Onecore:$OneCore -Verbose
|
||||||
Write-Verbose "Start-OpenSSHPackage -NativeHostArch $NativeHostArch -Configuration $Configuration -NoOpenSSL:$NoOpenSSL -Onecore:$OneCore -DestinationPath $repolocation\$($Bucket)_symbols" -verbose
|
Write-Verbose "Start-OpenSSHPackage -NativeHostArch $NativeHostArch -Configuration $Configuration -NoOpenSSL:$NoOpenSSL -Onecore:$OneCore -DestinationPath $repolocation\$($Bucket)_symbols" -verbose
|
||||||
Start-OpenSSHPackage -NativeHostArch $NativeHostArch -Configuration $Configuration -NoOpenSSL:$NoOpenSSL -Onecore:$OneCore -DestinationPath "$repolocation\$($Bucket)_symbols"
|
Start-OpenSSHPackage -NativeHostArch $NativeHostArch -Configuration $Configuration -NoOpenSSL:$NoOpenSSL -Onecore:$OneCore -DestinationPath "$repolocation\$($Bucket)_symbols"
|
||||||
|
Copy-OpenSSHUnitTests -NativeHostArch $NativeHostArch -Configuration $Configuration -DestinationPath "$repolocation\UnitTests"
|
||||||
if(-not (Test-Path $destination))
|
if(-not (Test-Path $destination))
|
||||||
{
|
{
|
||||||
New-Item -Path $destination -ItemType Directory -Force -ErrorAction Stop| Out-Null
|
New-Item -Path $destination -ItemType Directory -Force -ErrorAction Stop| Out-Null
|
||||||
|
@ -33,8 +37,10 @@ try
|
||||||
#copy the build log
|
#copy the build log
|
||||||
$buildLog = Get-BuildLogFile -NativeHostArch $NativeHostArch -Configuration $Configuration -root $repolocation
|
$buildLog = Get-BuildLogFile -NativeHostArch $NativeHostArch -Configuration $Configuration -root $repolocation
|
||||||
Write-Verbose "Copying $buildLog to $repolocation\$($Bucket)_symbols" -verbose
|
Write-Verbose "Copying $buildLog to $repolocation\$($Bucket)_symbols" -verbose
|
||||||
Copy-Item -Path $buildLog -Destination "$($Bucket)_symbols\" -Force -ErrorAction SilentlyContinue
|
Copy-Item -Path $buildLog -Destination "$($Bucket)_symbols\" -Force -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
$unitTestPaths = Get-ChildItem "$repolocation\UnitTests\*" -Directory
|
||||||
|
Compress-Archive -path $unitTestPaths.FullName -DestinationPath "$repolocation\$($Bucket)_symbols\$UnitTestFolder"
|
||||||
Compress-Archive -path "$repolocation\$($Bucket)_symbols\*" -DestinationPath "$destination\$($Bucket)_symbols"
|
Compress-Archive -path "$repolocation\$($Bucket)_symbols\*" -DestinationPath "$destination\$($Bucket)_symbols"
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
|
@ -457,6 +457,57 @@ function Start-OpenSSHPackage
|
||||||
Remove-Item $symbolsDir -Recurse -Force -ErrorAction SilentlyContinue
|
Remove-Item $symbolsDir -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Copy-OpenSSHUnitTests
|
||||||
|
{
|
||||||
|
[CmdletBinding(SupportsShouldProcess=$false)]
|
||||||
|
param
|
||||||
|
(
|
||||||
|
[ValidateSet('x86', 'x64', 'arm64', 'arm')]
|
||||||
|
[string]$NativeHostArch = "x64",
|
||||||
|
|
||||||
|
[ValidateSet('Debug', 'Release')]
|
||||||
|
[string]$Configuration = "Release",
|
||||||
|
|
||||||
|
# Copy unittests to DestinationPath
|
||||||
|
[string]$DestinationPath = ""
|
||||||
|
)
|
||||||
|
|
||||||
|
[System.IO.DirectoryInfo] $repositoryRoot = Get-RepositoryRoot
|
||||||
|
$repositoryRoot = Get-Item -Path $repositoryRoot.FullName
|
||||||
|
$folderName = $NativeHostArch
|
||||||
|
if($NativeHostArch -ieq 'x86')
|
||||||
|
{
|
||||||
|
$folderName = "Win32"
|
||||||
|
}
|
||||||
|
$buildDir = Join-Path $repositoryRoot ("bin\" + $folderName + "\" + $Configuration)
|
||||||
|
$unittestsDir = Join-Path $buildDir "unittests"
|
||||||
|
$unitTestFolders = Get-ChildItem -Directory $buildDir\unittest-*
|
||||||
|
|
||||||
|
if ($DestinationPath -ne "") {
|
||||||
|
if (-not (Test-Path $DestinationPath -PathType Container)) {
|
||||||
|
New-Item -ItemType Directory $DestinationPath -Force | Out-Null
|
||||||
|
}
|
||||||
|
foreach ($folder in $unitTestFolders) {
|
||||||
|
Copy-Item $folder.FullName $DestinationPath\$($folder.Name) -Recurse -Force
|
||||||
|
Write-BuildMsg -AsInfo -Message "Copied $($folder.FullName) to $DestinationPath\$($folder.Name)."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(Test-Path ($unittestsDir + '.zip') -PathType Leaf) {
|
||||||
|
Remove-Item ($unittestsDir + '.zip') -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
if(get-command Compress-Archive -ErrorAction SilentlyContinue)
|
||||||
|
{
|
||||||
|
Compress-Archive -Path $unitTestFolders.FullName -DestinationPath ($unittestsDir + '.zip')
|
||||||
|
Write-BuildMsg -AsInfo -Message "Packaged unittests - '$unittestsDir.zip'"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write-BuildMsg -AsInfo -Message "Packaged unittests not compressed."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function Start-OpenSSHBuild
|
function Start-OpenSSHBuild
|
||||||
{
|
{
|
||||||
[CmdletBinding(SupportsShouldProcess=$false)]
|
[CmdletBinding(SupportsShouldProcess=$false)]
|
||||||
|
@ -657,4 +708,4 @@ function Get-SolutionFile
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Export-ModuleMember -Function Start-OpenSSHBuild, Get-BuildLogFile, Start-OpenSSHPackage
|
Export-ModuleMember -Function Start-OpenSSHBuild, Get-BuildLogFile, Start-OpenSSHPackage, Copy-OpenSSHUnitTests
|
||||||
|
|
|
@ -72,7 +72,7 @@ try
|
||||||
if($SignedFilesPath)
|
if($SignedFilesPath)
|
||||||
{
|
{
|
||||||
Write-Verbose "SignedFilesPath: $SignedFilesPath" -Verbose
|
Write-Verbose "SignedFilesPath: $SignedFilesPath" -Verbose
|
||||||
$files = Get-ChildItem -Path $SignedFilesPath\* -Recurse -File | Select-Object -ExpandProperty FullName
|
$files = Get-ChildItem -Path $SignedFilesPath\* -File | Select-Object -ExpandProperty FullName
|
||||||
#Count the remaining file not signed files.
|
#Count the remaining file not signed files.
|
||||||
Get-ChildItem -Path $BuildPath\* -Recurse -File | % {
|
Get-ChildItem -Path $BuildPath\* -Recurse -File | % {
|
||||||
$src = $_.FullName
|
$src = $_.FullName
|
||||||
|
@ -88,7 +88,7 @@ try
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#did not run codesign, so publish the plain binaries
|
#did not run codesign, so publish the plain binaries
|
||||||
$files = Get-ChildItem -Path $BuildPath\* -Recurse -File | Select-Object -ExpandProperty FullName
|
$files = Get-ChildItem -Path $BuildPath\* -File | Select-Object -ExpandProperty FullName
|
||||||
}
|
}
|
||||||
$Bucket = (Split-Path $BuildPath -Leaf).Replace("_symbols", "")
|
$Bucket = (Split-Path $BuildPath -Leaf).Replace("_symbols", "")
|
||||||
|
|
||||||
|
@ -111,6 +111,10 @@ try
|
||||||
$artifactname = "$folderName-$leafFileName"
|
$artifactname = "$folderName-$leafFileName"
|
||||||
Write-Host "##vso[artifact.upload containerfolder=$folderName;artifactname=$artifactname]$fileName"
|
Write-Host "##vso[artifact.upload containerfolder=$folderName;artifactname=$artifactname]$fileName"
|
||||||
}
|
}
|
||||||
|
elseif($extension -ieq '.zip')
|
||||||
|
{
|
||||||
|
Write-Host "##vso[artifact.upload artifactname=$leafFileName]$fileName"
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$artifactname = "$Bucket-$leafFileName"
|
$artifactname = "$Bucket-$leafFileName"
|
||||||
|
@ -132,4 +136,4 @@ catch
|
||||||
finally{
|
finally{
|
||||||
Write-VstsTaskState
|
Write-VstsTaskState
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
|
@ -30,6 +30,7 @@ Describe "Tests for authorized_keys file permission" -Tags "CI" {
|
||||||
#skip when the task schedular (*-ScheduledTask) cmdlets does not exist
|
#skip when the task schedular (*-ScheduledTask) cmdlets does not exist
|
||||||
$ts = (get-command get-ScheduledTask -ErrorAction SilentlyContinue)
|
$ts = (get-command get-ScheduledTask -ErrorAction SilentlyContinue)
|
||||||
$skip = $ts -eq $null
|
$skip = $ts -eq $null
|
||||||
|
$platform = Get-Platform
|
||||||
if(($platform -eq [PlatformType]::Windows) -and ([Environment]::OSVersion.Version.Major -le 6))
|
if(($platform -eq [PlatformType]::Windows) -and ([Environment]::OSVersion.Version.Major -le 6))
|
||||||
{
|
{
|
||||||
#suppress the firewall blocking dialogue on win7
|
#suppress the firewall blocking dialogue on win7
|
||||||
|
@ -40,6 +41,7 @@ Describe "Tests for authorized_keys file permission" -Tags "CI" {
|
||||||
AfterEach { $tI++ }
|
AfterEach { $tI++ }
|
||||||
|
|
||||||
AfterAll {
|
AfterAll {
|
||||||
|
$platform = Get-Platform
|
||||||
if(($platform -eq [PlatformType]::Windows) -and ($psversiontable.BuildVersion.Major -le 6))
|
if(($platform -eq [PlatformType]::Windows) -and ($psversiontable.BuildVersion.Major -le 6))
|
||||||
{
|
{
|
||||||
netsh advfirewall firewall delete rule name="sshd" program="$($OpenSSHTestInfo['OpenSSHBinPath'])\sshd.exe" protocol=any dir=in
|
netsh advfirewall firewall delete rule name="sshd" program="$($OpenSSHTestInfo['OpenSSHBinPath'])\sshd.exe" protocol=any dir=in
|
||||||
|
|
Loading…
Reference in New Issue