Reduce the console output of build (#54)

1. Reduce the console output of build
2. move to use powershell core 6.0.0.14
3. one minor fix in pester tests.

* Update the path of unittest results and build log. suppress the warning message.

* limitoutput of choco installation.

* fix of quotes

* remove redundant log

* Set x64 Release build as default
This commit is contained in:
Yanbing 2017-01-13 12:03:42 -08:00 committed by Manoj Ampalam
parent 50e4499fe0
commit 2017ffdff0
5 changed files with 169 additions and 122 deletions

View File

@ -11,12 +11,12 @@ init:
build_script:
- ps: |
Import-Module $env:APPVEYOR_BUILD_FOLDER\contrib\win32\openssh\AppVeyor.psm1
Import-Module $env:APPVEYOR_BUILD_FOLDER\contrib\win32\openssh\AppVeyor.psm1 -WarningAction SilentlyContinue
Invoke-AppVeyorBuild
after_build:
- ps: |
Import-Module $env:APPVEYOR_BUILD_FOLDER\contrib\win32\openssh\AppVeyor.psm1
Import-Module $env:APPVEYOR_BUILD_FOLDER\contrib\win32\openssh\AppVeyor.psm1 -WarningAction SilentlyContinue
Install-OpenSSH
- ps: Write-Verbose "Restart computer ..."
- ps: Restart-Computer -ComputerName localhost -Force
@ -25,19 +25,19 @@ after_build:
before_test:
- ps: |
Import-Module $env:APPVEYOR_BUILD_FOLDER\contrib\win32\openssh\AppVeyor.psm1
Import-Module $env:APPVEYOR_BUILD_FOLDER\contrib\win32\openssh\AppVeyor.psm1 -WarningAction SilentlyContinue
Install-TestDependencies
test_script:
- cmd: |
"%ProgramFiles%\PowerShell\6.0.0.12\powershell.exe" -Command "Import-Module \"%APPVEYOR_BUILD_FOLDER%\contrib\win32\openssh\AppVeyor.psm1\";Run-OpenSSHTests"
"%ProgramFiles%\PowerShell\6.0.0.14\powershell.exe" -Command "Import-Module \"%APPVEYOR_BUILD_FOLDER%\contrib\win32\openssh\AppVeyor.psm1\" -WarningAction SilentlyContinue;Run-OpenSSHTests"
after_test:
- ps: |
Import-Module $env:APPVEYOR_BUILD_FOLDER\contrib\win32\openssh\AppVeyor.psm1
Import-Module $env:APPVEYOR_BUILD_FOLDER\contrib\win32\openssh\AppVeyor.psm1 -WarningAction SilentlyContinue
Upload-OpenSSHTestResults
on_finish:
- ps: |
Import-Module $env:APPVEYOR_BUILD_FOLDER\contrib\win32\openssh\AppVeyor.psm1
Import-Module $env:APPVEYOR_BUILD_FOLDER\contrib\win32\openssh\AppVeyor.psm1 -WarningAction SilentlyContinue
Publish-Artifact

View File

@ -1,6 +1,26 @@
$ErrorActionPreference = 'Stop'
Import-Module $PSScriptRoot\build.psm1
$repoRoot = Get-RepositoryRoot
$script:logFile = join-path $repoRoot.FullName "appveyorlog.log"
<#
Called by Write-BuildMsg to write to the build log, if it exists.
#>
function Write-Log
{
param
(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string] $Message
)
# write it to the log file, if present.
if (-not ([string]::IsNullOrEmpty($script:logFile)))
{
Add-Content -Path $script:logFile -Value $Message
}
}
# Sets a build variable
Function Set-BuildVariable
@ -66,10 +86,8 @@ function Invoke-AppVeyorFull
# Implements the AppVeyor 'build_script' step
function Invoke-AppVeyorBuild
{
Start-SSHBuild -Configuration Release -NativeHostArch x64 -Verbose
Start-SSHBuild -Configuration Debug -NativeHostArch x64 -Verbose
Start-SSHBuild -Configuration Release -NativeHostArch x86 -Verbose
Start-SSHBuild -Configuration Debug -NativeHostArch x86 -Verbose
Start-SSHBuild -Configuration Release -NativeHostArch x64
Start-SSHBuild -Configuration Debug -NativeHostArch x86
}
<#
@ -84,7 +102,7 @@ function Invoke-MSIEXEC
[string] $InstallFile
)
Write-Verbose "Installing $InstallFile..."
Write-Log -Message "Installing $InstallFile..."
$arguments = @(
"/i"
"`"$InstallFile`""
@ -93,10 +111,10 @@ function Invoke-MSIEXEC
)
$process = Start-Process -FilePath msiexec.exe -ArgumentList $arguments -Wait -PassThru
if ($process.ExitCode -eq 0){
Write-Output "$InstallFile has been successfully installed"
Write-Log -Message "$InstallFile has been successfully installed."
}
else {
Write-Output "installer exit code $($process.ExitCode) for file $($InstallFile)"
Write-Log -Message "installer exit code $($process.ExitCode) for file $($InstallFile)"
}
return $process.ExitCode
@ -110,11 +128,11 @@ function Install-PSCoreFromGithub
{
$downloadLocation = Download-PSCoreMSI
Write-Output "Installing PSCore ..."
Write-Log -Message "Installing PSCore ..."
if(-not [string]::IsNullOrEmpty($downloadLocation))
{
$processExitCode = Invoke-MSIEXEC -InstallFile $downloadLocation
Write-Output "Process exitcode: $processExitCode"
Write-Log -Message "Process exitcode: $processExitCode"
}
}
@ -125,27 +143,27 @@ function Install-PSCoreFromGithub
function Get-PSCoreMSIDownloadURL
{
$osversion = [String][Environment]::OSVersion.Version
Write-Host "osversion:$osversion"
if($osversion.StartsWith("6"))
{
if ($($env:PROCESSOR_ARCHITECTURE).Contains('64'))
{
return 'https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.12/PowerShell_6.0.0.12-alpha.12-win81-x64.msi'
return 'https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.14/PowerShell_6.0.0.14-alpha.14-win81-x64.msi'
}
else
{
return ''
return 'https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.14/PowerShell_6.0.0.14-alpha.14-win7-x86.msi'
}
}
elseif ($osversion.Contains("10.0"))
{
if ($($env:PROCESSOR_ARCHITECTURE).Contains('64'))
{
return 'https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.12/PowerShell_6.0.0.12-alpha.12-win10-x64.msi'
return 'https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.14/PowerShell_6.0.0.14-alpha.14-win10-x64.msi'
}
else
{
return ''
return 'https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.14/PowerShell_6.0.0.14-alpha.14-win7-x86.msi'
}
}
}
@ -159,13 +177,13 @@ function Download-PSCoreMSI
$url = Get-PSCoreMSIDownloadURL
if([string]::IsNullOrEmpty($url))
{
Write-Output "url is empty"
Write-Log -Message "url is empty"
return ''
}
$parsed = $url.Substring($url.LastIndexOf("/") + 1)
if(-not (Test-path "$env:SystemDrive\PScore" -PathType Container))
{
New-Item -ItemType Directory -Force -Path "$env:SystemDrive\PScore" | out-null
$null = New-Item -ItemType Directory -Force -Path "$env:SystemDrive\PScore" | out-null
}
$downloadLocation = "$env:SystemDrive\PScore\$parsed"
if(-not (Test-path $downloadLocation -PathType Leaf))
@ -197,15 +215,14 @@ function Install-TestDependencies
$isModuleAvailable = Get-Module 'Pester' -ListAvailable
if (-not ($isModuleAvailable))
{
Write-Output 'Installing Pester...'
choco install Pester -y --force
Write-Log -Message "Installing Pester..."
choco install Pester -y --force --limitoutput
}
if ( -not (Test-Path "$env:ProgramData\chocolatey\lib\sysinternals\tools" ) ) {
Write-Output "sysinternals not present. Installing sysinternals."
choco install sysinternals -y
Write-Log -Message "sysinternals not present. Installing sysinternals."
choco install sysinternals -y --force --limitoutput
}
Write-Output "Installing pscore..."
Install-PSCoreFromGithub
}
<#
@ -219,8 +236,8 @@ function Install-OpenSSH
(
[string] $OpenSSHDir = "$env:SystemDrive\OpenSSH",
[ValidateSet('Debug', 'Release')]
[string]$Configuration = "Debug",
[ValidateSet('Debug', 'Release', '')]
[string]$Configuration = "",
[ValidateSet('x86', 'x64', '')]
[string]$NativeHostArch = ""
@ -272,8 +289,8 @@ function Build-Win32OpenSSHPackage
(
[string] $OpenSSHDir = "$env:SystemDrive\OpenSSH",
[ValidateSet('Debug', 'Release')]
[string]$Configuration = "Debug",
[ValidateSet('Debug', 'Release', '')]
[string]$Configuration = "",
[ValidateSet('x86', 'x64', '')]
[string]$NativeHostArch = ""
@ -281,14 +298,14 @@ function Build-Win32OpenSSHPackage
if (-not (Test-Path -Path $OpenSSHDir -PathType Container))
{
New-Item -Path $OpenSSHDir -ItemType Directory -Force -ErrorAction Stop
$null = New-Item -Path $OpenSSHDir -ItemType Directory -Force -ErrorAction Stop
}
[string] $platform = $env:PROCESSOR_ARCHITECTURE
if(-not [String]::IsNullOrEmpty($NativeHostArch))
{
$folderName = $NativeHostArch
if($NativeHostArch -eq 'x86')
if($NativeHostArch -ieq 'x86')
{
$folderName = "Win32"
}
@ -305,8 +322,25 @@ function Build-Win32OpenSSHPackage
}
}
if([String]::IsNullOrEmpty($Configuration))
{
if( $folderName -ieq "Win32" )
{
$RealConfiguration = "Debug"
}
else
{
$RealConfiguration = "Release"
}
}
else
{
$RealConfiguration = $Configuration
}
[System.IO.DirectoryInfo] $repositoryRoot = Get-RepositoryRoot
$sourceDir = Join-Path $repositoryRoot.FullName -ChildPath "bin\$folderName\$Configuration"
$sourceDir = Join-Path $repositoryRoot.FullName -ChildPath "bin\$folderName\$RealConfiguration"
Copy-Item -Path "$sourceDir\*" -Destination $OpenSSHDir -Include *.exe,*.dll -Exclude *unittest*.* -Force -ErrorAction Stop
$sourceDir = Join-Path $repositoryRoot.FullName -ChildPath "contrib\win32\openssh"
Copy-Item -Path "$sourceDir\*" -Destination $OpenSSHDir -Include *.ps1,sshd_config -Exclude AnalyzeCodeDiff.ps1 -Force -ErrorAction Stop
@ -315,7 +349,7 @@ function Build-Win32OpenSSHPackage
$rktoolsPath = "${env:ProgramFiles(x86)}\Windows Resource Kits\Tools\ntrights.exe"
if (-not (Test-Path -Path $rktoolsPath))
{
Write-Information -MessageData "$packageName not present. Installing $packageName."
Write-Log -Message "$packageName not present. Installing $packageName."
choco install $packageName -y --force
}
@ -327,7 +361,7 @@ function Build-Win32OpenSSHPackage
$packageFolder = $env:APPVEYOR_BUILD_FOLDER
}
$package = "$packageFolder\Win32OpenSSH$Configuration$folderName.zip"
$package = "$packageFolder\Win32OpenSSH$RealConfiguration$folderName.zip"
$allPackage = "$packageFolder\Win32OpenSSH*.zip"
if (Test-Path $allPackage)
{
@ -349,8 +383,8 @@ function Deploy-OpenSSHTests
(
[string] $OpenSSHTestDir = "$env:SystemDrive\OpenSSH",
[ValidateSet('Debug', 'Release')]
[string]$Configuration = "Debug",
[ValidateSet('Debug', 'Release', '')]
[string]$Configuration = "",
[ValidateSet('x86', 'x64', '')]
[string]$NativeHostArch = ""
@ -358,7 +392,7 @@ function Deploy-OpenSSHTests
if (-not (Test-Path -Path $OpenSSHTestDir -PathType Container))
{
New-Item -Path $OpenSSHTestDir -ItemType Directory -Force -ErrorAction Stop
$null = New-Item -Path $OpenSSHTestDir -ItemType Directory -Force -ErrorAction Stop
}
[string] $platform = $env:PROCESSOR_ARCHITECTURE
@ -382,15 +416,30 @@ function Deploy-OpenSSHTests
}
}
if([String]::IsNullOrEmpty($Configuration))
{
if( $folderName -ieq "Win32" )
{
$RealConfiguration = "Debug"
}
else
{
$RealConfiguration = "Release"
}
}
else
{
$RealConfiguration = $Configuration
}
[System.IO.DirectoryInfo] $repositoryRoot = Get-RepositoryRoot
$sourceDir = Join-Path $repositoryRoot.FullName -ChildPath "regress\pesterTests"
Copy-Item -Path "$sourceDir\*" -Destination $OpenSSHTestDir -Include *.ps1,*.psm1 -Force -ErrorAction Stop
$sourceDir = Join-Path $repositoryRoot.FullName -ChildPath "bin\$folderName\$Configuration"
$sourceDir = Join-Path $repositoryRoot.FullName -ChildPath "bin\$folderName\$RealConfiguration"
Copy-Item -Path "$sourceDir\*" -Destination $OpenSSHTestDir -Exclude ssh-agent.exe, sshd.exe -Force -ErrorAction Stop
}
@ -420,9 +469,7 @@ function Add-BuildLog
if (Test-Path -Path $buildLog)
{
Write-Output "Adding $buildLog to local artifacts"
$null = $artifacts.Add($buildLog)
Write-Output "Adding $buildLog to local artifacts- completed"
}
else
{
@ -450,13 +497,9 @@ function Add-Artifact
$files = Get-ChildItem -Path $FileToAdd -ErrorAction Ignore
if ($files -ne $null)
{
$files | % {
Write-Output "Adding $($_.FullName) to local artifacts"
$null = $artifacts.Add($_.FullName)
Write-Output "Adding $($_.FullName) to local artifacts- completed"
}
}
else
{
@ -480,13 +523,11 @@ function Publish-Artifact
}
Add-Artifact -artifacts $artifacts -FileToAdd "$packageFolder\Win32OpenSSH*.zip"
Add-Artifact -artifacts $artifacts -FileToAdd "$packageFolder\OpenSSH\UnitTestResults.txt"
Add-Artifact -artifacts $artifacts -FileToAdd "$env:SystemDrive\OpenSSH\UnitTestResults.txt"
Add-Artifact -artifacts $artifacts -FileToAdd "$script:logFile"
# Get the build.log file for each build configuration
#Add-BuildLog -artifacts $artifacts -buildLog (Get-BuildLogFile -root $repoRoot.FullName -Configuration Release -NativeHostArch x86)
#Add-BuildLog -artifacts $artifacts -buildLog (Get-BuildLogFile -root $repoRoot.FullName -Configuration Debug -NativeHostArch x86)
#Add-BuildLog -artifacts $artifacts -buildLog (Get-BuildLogFile -root $repoRoot.FullName -Configuration Release -NativeHostArch x64)
Add-BuildLog -artifacts $artifacts -buildLog (Get-BuildLogFile -root $repoRoot.FullName -Configuration Debug -NativeHostArch x64)
Add-BuildLog -artifacts $artifacts -buildLog (Get-BuildLogFile -root $repoRoot.FullName)
foreach ($artifact in $artifacts)
{
@ -506,10 +547,10 @@ function Run-OpenSSHPesterTest
# Discover all CI tests and run them.
Push-Location $testRoot
Write-Output "Running OpenSSH Pester tests..."
Write-Log -Message "Running OpenSSH Pester tests..."
$testFolders = Get-ChildItem *.tests.ps1 -Recurse | ForEach-Object{ Split-Path $_.FullName} | Sort-Object -Unique
Invoke-Pester $testFolders -OutputFormat NUnitXml -OutputFile $outputXml -Tag 'CI'
Invoke-Pester $testFolders -OutputFormat NUnitXml -OutputFile $outputXml -Tag 'CI'
Pop-Location
}
@ -523,7 +564,7 @@ function Run-OpenSSHUnitTest
# Discover all CI tests and run them.
Push-Location $testRoot
Write-Output "Running OpenSSH unit tests..."
Write-Log -Message "Running OpenSSH unit tests..."
if (Test-Path $unitTestOutputFile)
{
Remove-Item -Path $unitTestOutputFile -Force -ErrorAction SilentlyContinue
@ -534,13 +575,13 @@ function Run-OpenSSHUnitTest
if ($unitTestFiles -ne $null)
{
$unitTestFiles | % {
Write-Output "Running OpenSSH unit $($_.FullName)..."
Write-Log -Message "Running OpenSSH unit $($_.FullName)..."
& $_.FullName >> $unitTestOutputFile
$errorCode = $LASTEXITCODE
if ($errorCode -ne 0)
{
$testFailed = $true
Write-Output "$($_.FullName) test failed for OpenSSH.`nExitCode: $error"
Write-Log -Message "$($_.FullName) test failed for OpenSSH.`nExitCode: $error"
}
}
@ -615,5 +656,4 @@ function Upload-OpenSSHTestResults
{
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFile))
}
}

View File

@ -134,15 +134,14 @@ function Write-BuildMsg
#>
function Start-SSHBootstrap
{
[bool] $silent = -not $script:Verbose
Set-StrictMode -Version Latest
Write-BuildMsg -AsInfo -Message "Checking tools and dependencies"
Write-BuildMsg -AsInfo -Message "Checking tools and dependencies" -Silent:$silent
$machinePath = [Environment]::GetEnvironmentVariable('Path', 'MACHINE')
$newMachineEnvironmentPath = $machinePath
# NOTE: Unless -Verbose is specified, most informational output will only go to the log file.
[bool] $silent = -not $script:Verbose
# Install chocolatey
$chocolateyPath = "$env:AllUsersProfile\chocolatey\bin"
if(Get-Command "choco" -ErrorAction SilentlyContinue)
@ -151,18 +150,18 @@ function Start-SSHBootstrap
}
else
{
Write-BuildMsg -AsInfo -Message "Chocolatey not present. Installing chocolatey."
Write-BuildMsg -AsInfo -Message "Chocolatey not present. Installing chocolatey." -Silent:$silent
Invoke-Expression ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
if (-not ($machinePath.ToLower().Contains($chocolateyPath.ToLower())))
{
Write-BuildMsg -AsVerbose -Message "Adding $chocolateyPath to Path environment variable"
Write-BuildMsg -AsVerbose -Message "Adding $chocolateyPath to Path environment variable" -Silent:$silent
$newMachineEnvironmentPath += ";$chocolateyPath"
$env:Path += ";$chocolateyPath"
}
else
{
Write-BuildMsg -AsVerbose -Message "$chocolateyPath already present in Path environment variable"
Write-BuildMsg -AsVerbose -Message "$chocolateyPath already present in Path environment variable" -Silent:$silent
}
}
@ -170,7 +169,7 @@ function Start-SSHBootstrap
$gitCmdPath = "$env:ProgramFiles\git\cmd"
if (-not ($machinePath.ToLower().Contains($gitCmdPath.ToLower())))
{
Write-BuildMsg -AsVerbose -Message "Adding $gitCmdPath to Path environment variable"
Write-BuildMsg -AsVerbose -Message "Adding $gitCmdPath to Path environment variable" -Silent:$silent
$newMachineEnvironmentPath = "$gitCmdPath;$newMachineEnvironmentPath"
}
else
@ -186,7 +185,7 @@ function Start-SSHBootstrap
if (-not ($machinePath.ToLower().Contains($nativeMSBuildPath.ToLower())))
{
Write-BuildMsg -AsVerbose -Message "Adding $nativeMSBuildPath to Path environment variable"
Write-BuildMsg -AsVerbose -Message "Adding $nativeMSBuildPath to Path environment variable" -Silent:$silent
$newMachineEnvironmentPath += ";$nativeMSBuildPath"
$env:Path += ";$nativeMSBuildPath"
}
@ -207,8 +206,8 @@ function Start-SSHBootstrap
if (-not (Test-Path -Path $nasmPath -PathType Container))
{
Write-BuildMsg -AsInfo -Message "$packageName not present. Installing $packageName."
choco install $packageName -y --force --execution-timeout 10000
Write-BuildMsg -AsInfo -Message "$packageName not present. Installing $packageName." -Silent:$silent
choco install $packageName -y --force --limitoutput --execution-timeout 10000
}
else
{
@ -221,9 +220,9 @@ function Start-SSHBootstrap
if ($null -eq $VSPackageInstalled)
{
Write-BuildMsg -AsInfo -Message "$packageName not present. Installing $packageName."
Write-BuildMsg -AsInfo -Message "$packageName not present. Installing $packageName." -Silent:$silent
$adminFilePath = "$script:OpenSSHRoot\contrib\win32\openssh\VSWithBuildTools.xml"
choco install $packageName -packageParameters "--AdminFile $adminFilePath" -y --force --execution-timeout 10000
choco install $packageName -packageParameters "--AdminFile $adminFilePath" -y --force --limitoutput --execution-timeout 10000
}
else
{
@ -236,8 +235,8 @@ function Start-SSHBootstrap
if (-not (Test-Path -Path $sdkPath))
{
Write-BuildMsg -AsInfo -Message "Windows 8.1 SDK not present. Installing $packageName."
choco install $packageName -y --force
Write-BuildMsg -AsInfo -Message "Windows 8.1 SDK not present. Installing $packageName." -Silent:$silent
choco install $packageName -y --limitoutput --force
}
else
{
@ -262,7 +261,7 @@ function Start-SSHBootstrap
$item = Get-Item(Join-Path -Path $env:VS140COMNTOOLS -ChildPath '../../vc')
$script:vcPath = $item.FullName
Write-BuildMsg -AsVerbose -Message "vcPath: $script:vcPath"
Write-BuildMsg -AsVerbose -Message "vcPath: $script:vcPath" -Silent:$silent
if ((Test-Path -Path "$script:vcPath\vcvarsall.bat") -eq $false)
{
Write-BuildMsg -AsError -ErrorAction Stop -Message "Could not find Visual Studio vcvarsall.bat at" + $script:vcPath
@ -271,15 +270,17 @@ function Start-SSHBootstrap
function Clone-Win32OpenSSH
{
[bool] $silent = -not $script:Verbose
$win32OpenSSHPath = join-path $script:gitRoot "Win32-OpenSSH"
if (-not (Test-Path -Path $win32OpenSSHPath -PathType Container))
{
Write-BuildMsg -AsInfo -Message "clone repo Win32-OpenSSH"
Write-BuildMsg -AsInfo -Message "clone repo Win32-OpenSSH" -Silent:$silent
Push-Location $gitRoot
git clone -q --recursive https://github.com/PowerShell/Win32-OpenSSH.git $win32OpenSSHPath
Pop-Location
}
Write-BuildMsg -AsInfo -Message "pull latest from repo Win32-OpenSSH"
Write-BuildMsg -AsInfo -Message "pull latest from repo Win32-OpenSSH" -Silent:$silent
Push-Location $win32OpenSSHPath
git fetch -q origin
git checkout -qf L1-Prod
@ -288,8 +289,10 @@ function Clone-Win32OpenSSH
function Copy-OpenSSLSDK
{
[bool] $silent = -not $script:Verbose
$sourcePath = Join-Path $script:gitRoot "Win32-OpenSSH\contrib\win32\openssh\OpenSSLSDK"
Write-BuildMsg -AsInfo -Message "copying $sourcePath"
Write-BuildMsg -AsInfo -Message "copying $sourcePath" -Silent:$silent
Copy-Item -Container -Path $sourcePath -Destination $PSScriptRoot -Recurse -Force -ErrorAction SilentlyContinue -ErrorVariable e
if($e -ne $null)
{
@ -306,7 +309,7 @@ function Start-SSHBuild
[string]$NativeHostArch = "x64",
[ValidateSet('Debug', 'Release', '')]
[string]$Configuration = "Debug"
[string]$Configuration = "Release"
)
Set-StrictMode -Version Latest
$script:BuildLogFile = $null
@ -322,6 +325,7 @@ function Start-SSHBuild
{
$script:Verbose = ($PSBoundParameters['Verbose']).IsPresent
}
[bool] $silent = -not $script:Verbose
$script:BuildLogFile = Get-BuildLogFile -root $repositoryRoot.FullName -Configuration $Configuration -NativeHostArch $NativeHostArch
if (Test-Path -Path $script:BuildLogFile)
@ -329,8 +333,7 @@ function Start-SSHBuild
Remove-Item -Path $script:BuildLogFile
}
Write-BuildMsg -AsInfo -Message "Starting Open SSH build."
Write-BuildMsg -AsInfo -Message "Build Log: $($script:BuildLogFile)"
Write-BuildMsg -AsInfo -Message "Starting Open SSH build; Build Log: $($script:BuildLogFile)"
Start-SSHBootstrap
@ -338,20 +341,19 @@ function Start-SSHBuild
Copy-OpenSSLSDK
$msbuildCmd = "msbuild.exe"
$solutionFile = Get-SolutionFile -root $repositoryRoot.FullName
$cmdMsg = @("${solutionFile}", "/p:Platform=${NativeHostArch}", "/p:Configuration=${Configuration}", "/fl", "/flp:LogFile=${script:BuildLogFile}`;Append`;Verbosity=diagnostic")
$cmdMsg = @("${solutionFile}", "/p:Platform=${NativeHostArch}", "/p:Configuration=${Configuration}", "/noconlog", "/nologo", "/fl", "/flp:LogFile=${script:BuildLogFile}`;Append`;Verbosity=diagnostic")
#$cmdMsg = @("${solutionFile}", "/p:Platform=${NativeHostArch}", "/p:Configuration=${Configuration}", "/nologo", "/fl", "/flp:LogFile=${script:BuildLogFile}`;Append`;Verbosity=diagnostic")
Write-Information -MessageData $msbuildCmd
Write-Information -MessageData $cmdMsg
& $msbuildCmd $cmdMsg
$errorCode = $LASTEXITCODE
if ($errorCode -ne 0)
{
Write-BuildMsg -AsError -ErrorAction Stop -Message "Build failed for OpenSSH.`nExitCode: $error"
Write-BuildMsg -AsError -ErrorAction Stop -Message "Build failed for OpenSSH.`nExitCode: $error."
}
Write-BuildMsg -AsVerbose -Message "Finished Open SSH build."
Write-BuildMsg -AsInfo -Message "SSH build passed."
}
function Get-BuildLogFile
@ -366,7 +368,7 @@ function Get-BuildLogFile
[string]$NativeHostArch = "x64",
[ValidateSet('Debug', 'Release', '')]
[string]$Configuration = "Debug"
[string]$Configuration = "Release"
)
return Join-Path -Path $root -ChildPath "contrib\win32\openssh\OpenSSH$($Configuration)$($NativeHostArch).log"
@ -414,4 +416,4 @@ function Get-RepositoryRoot
throw new-object System.IO.DirectoryNotFoundException("Could not find the root of the GIT repository")
}
Export-ModuleMember -Function Start-SSHBuild, Get-RepositoryRoot, Get-BuildLogFile, Clone-Win32OpenSSH, Copy-OpenSSLSDK
Export-ModuleMember -Function Start-SSHBuild, Get-RepositoryRoot, Get-BuildLogFile, Clone-Win32OpenSSH, Copy-OpenSSLSDK, Write-BuildMsg

View File

@ -225,6 +225,11 @@ Class Machine
[void] CleanupClient() {
Remove-item -path $($this.ClientKeyDirectory) -force -Recurse -ea silentlycontinue
$sshPath = split-path $this.knownHostOfCurrentUser -Parent
if(Test-Path $sshPath -PathType Container )
{
Remove-item -path $sshPath -force -Recurse
}
$this.CleanupPasswordSetting()
}

View File

@ -210,10 +210,10 @@ Describe "Tests for scp command" -Tags "CI" {
$client.CleanupPasswordSetting()
}
It 'File copy with -p and -v options: <Title> ' -TestCases:$testData {
It 'File copy with -p options: <Title> ' -TestCases:$testData {
param([string]$Title, $Source, $Destination)
.\scp -v -p $Source $Destination
.\scp -p $Source $Destination
#validate file content. DestPath is the path to the file.
$equal = @(Compare-Object (Get-ChildItem -path $SourceFilePath) (Get-ChildItem -path $DestinationFilePath) -Property Name, Length, LastWriteTime.DateTime).Length -eq 0
$equal | Should Be $true
@ -222,7 +222,7 @@ Describe "Tests for scp command" -Tags "CI" {
It 'Directory recursive copy with -p and -v options: <Title> ' -TestCases:$testData1 {
param([string]$Title, $Source, $Destination)
.\scp -r -v $Source $Destination
.\scp -r -p $Source $Destination
$equal = @(Compare-Object (Get-Item -path $SourceDir ) (Get-Item -path (join-path $DestinationDir $SourceDirName) ) -Property Name, Length, LastWriteTime.DateTime).Length -eq 0
$equal | Should Be $true