Test Fixes on down level OS (#279)

* Test Fixes on downlevel machines
1. Test fix to run on win7 and win8
2. Add -onecore parameter to start-opensshpackage in build helper script
3. Add copying of libcrypto.dll and libcrypto.pdb
4. Update the build number on appveyor.yml
This commit is contained in:
Yanbing 2018-03-01 15:11:55 -08:00 committed by GitHub
parent f46d8d1b30
commit 50a4badb79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 39 additions and 25 deletions

View File

@ -1,4 +1,4 @@
version: 1.0.0.0.{build}
version: 7.6.0.0.{build}
image: Visual Studio 2015
branches:
@ -6,7 +6,8 @@ branches:
- latestw_all
init:
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- ps: |
[Environment]::OSVersion | fl *
build_script:
- ps: |
@ -34,6 +35,6 @@ after_test:
Publish-OpenSSHTestResults
on_finish:
- ps: |
- ps: |
Import-Module $env:APPVEYOR_BUILD_FOLDER\contrib\win32\openssh\AppveyorHelper.psm1
Publish-Artifact

View File

@ -344,7 +344,8 @@ function Start-OpenSSHPackage
# Copy payload to DestinationPath instead of packaging
[string]$DestinationPath = "",
[switch]$NoOpenSSL
[switch]$NoOpenSSL,
[switch]$OneCore
)
[System.IO.DirectoryInfo] $repositoryRoot = Get-RepositoryRoot
@ -406,7 +407,16 @@ function Start-OpenSSHPackage
$libreSSLSDKPath = Join-Path $PSScriptRoot $script:libreSSLSDKStr
if (-not $NoOpenSSL.IsPresent)
{
Copy-Item -Path $(Join-Path $libreSSLSDKPath "$NativeHostArch\libcrypto.dll") -Destination $packageDir -Force -ErrorAction Stop
if($OneCore)
{
Copy-Item -Path $(Join-Path $libreSSLSDKPath "Onecore\$NativeHostArch\libcrypto.dll") -Destination $packageDir -Force -ErrorAction Stop
Copy-Item -Path $(Join-Path $libreSSLSDKPath "Onecore\$NativeHostArch\libcrypto.pdb") -Destination $symbolsDir -Force -ErrorAction Stop
}
else
{
Copy-Item -Path $(Join-Path $libreSSLSDKPath "$NativeHostArch\libcrypto.dll") -Destination $packageDir -Force -ErrorAction Stop
Copy-Item -Path $(Join-Path $libreSSLSDKPath "$NativeHostArch\libcrypto.pdb") -Destination $symbolsDir -Force -ErrorAction Stop
}
}
if ($DestinationPath -ne "") {
@ -446,7 +456,7 @@ function Start-OpenSSHPackage
}
else
{
Write-BuildMsg -AsInfo -Message "Packaged Symbols not compressed."
Write-BuildMsg -AsInfo -Message "Packaged Symbols not compressed."
}
}
Remove-Item $symbolsDir -Recurse -Force -ErrorAction SilentlyContinue

View File

@ -26,9 +26,11 @@ Describe "Tests for authorized_keys file permission" -Tags "CI" {
$ssouserProfile = $OpenSSHTestInfo["SSOUserProfile"]
$opensshbinpath = $OpenSSHTestInfo['OpenSSHBinPath']
Remove-Item -Path (Join-Path $testDir "*$sshLogName") -Force -ErrorAction SilentlyContinue
$platform = Get-Platform
$skip = ($platform -eq [PlatformType]::Windows) -and ($PSVersionTable.PSVersion.Major -le 2)
if(($platform -eq [PlatformType]::Windows) -and ($psversiontable.BuildVersion.Major -le 6))
#skip when the task schedular (*-ScheduledTask) cmdlets does not exist
$ts = (get-command get-ScheduledTask -ErrorAction SilentlyContinue)
$skip = $ts -eq $null
if(($platform -eq [PlatformType]::Windows) -and ([Environment]::OSVersion.Version.Major -le 6))
{
#suppress the firewall blocking dialogue on win7
netsh advfirewall firewall add rule name="sshd" program="$($OpenSSHTestInfo['OpenSSHBinPath'])\sshd.exe" protocol=any action=allow dir=in

View File

@ -22,11 +22,7 @@ Describe "E2E scenarios for certificate authentication" -Tags "CI" {
$null = New-Item $testDir -ItemType directory -Force -ErrorAction SilentlyContinue
}
$user_key = Join-Path $testDir "cert_auth_user_key"
$keypassphrase = "testpassword"
$platform = Get-Platform
$skip = ($platform -eq [PlatformType]::Windows) -and ($PSVersionTable.PSVersion.Major -le 2)
$keypassphrase = "testpassword"
}
BeforeEach {

View File

@ -22,7 +22,7 @@ Describe "Tests for host keys file permission" -Tags "CI" {
$script:logNum = 0
Remove-Item -Path (Join-Path $testDir "*$logName") -Force -ErrorAction SilentlyContinue
$platform = Get-Platform
$skip = ($platform -eq [PlatformType]::Windows) -and ($PSVersionTable.PSVersion.Major -le 2)
$skip = ($platform -eq [PlatformType]::Windows) -and ([Environment]::OSVersion.Version.Major -le 6) -and ([Environment]::OSVersion.Version.Minor -lt 2)
if(($platform -eq [PlatformType]::Windows) -and ($psversiontable.BuildVersion.Major -le 6))
{
#suppress the firewall blocking dialogue on win7
@ -77,12 +77,12 @@ Describe "Tests for host keys file permission" -Tags "CI" {
$logPath = Join-Path $testDir "$tC.$tI.$logName"
}
AfterAll {
AfterEach {
if(Test-path $hostKeyFilePath -PathType Leaf) {
Repair-SshdHostKeyPermission -filepath $hostKeyFilePath -confirm:$false
}
$tC++
}
}
AfterAll { $tC++ }
It "$tC.$tI-Host keys-positive (both public and private keys are owned by admin groups and running process can access to public key file)" {
Repair-FilePermission -Filepath $hostKeyFilePath -Owners $adminsSid -FullAccessNeeded $adminsSid,$systemSid -confirm:$false
@ -149,6 +149,7 @@ Describe "Tests for host keys file permission" -Tags "CI" {
$logPath | Should Contain "key_load_private: bad permissions"
}
#skip on win7 because Set-Acl failed due to issue on win7 when user does not have write permission on the file
It "$tC.$tI-Host keys-negative (the running process does not have read access to public key)" -skip:$skip {
#setup to have ssouser as owner and grant it full control
Repair-FilePermission -Filepath $hostKeyFilePath -Owners $systemSid -FullAccessNeeded $systemSid,$adminsSid -confirm:$false

View File

@ -16,6 +16,7 @@ Describe "E2E scenarios for port forwarding" -Tags "CI" {
$null = New-Item $testDir -ItemType directory -Force -ErrorAction SilentlyContinue
}
$platform = Get-Platform
#skip on ps 2 becase non-interactive cmd require a ENTER before it returns on ps2
$skip = ($platform -eq [PlatformType]::Windows) -and ($PSVersionTable.PSVersion.Major -le 2)
}

View File

@ -28,6 +28,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
$acl.SetAccessRule($accessRule)
Set-Acl -Path $testDir -AclObject $acl
$platform = Get-Platform
#skip on ps 2 becase non-interactive cmd require a ENTER before it returns on ps2
$skip = ($platform -eq [PlatformType]::Windows) -and ($PSVersionTable.PSVersion.Major -le 2)
<#$testData = @(
@ -147,7 +148,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
$o | Should Be "1234"
}
It "$tC.$tI - stdin from PS object" {
It "$tC.$tI - stdin from PS object" -skip:$skip {
# execute this script that dumps the length of input data, on the remote end
$str = "begin {} process { Write-Output `$input.Length} end { }"
$EncodedText =[Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($str))
@ -157,7 +158,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
$o | Should Be "8"
}
It "$tC.$tI - stream file in and out" {
It "$tC.$tI - stream file in and out" -skip:$skip {
# prep a file of size > 10KB (https://github.com/PowerShell/Win32-OpenSSH/issues/908 was caught with such file size)
$str = ""
(1..100) | foreach {$str += "1234567890"}
@ -191,7 +192,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
Remove-ItemProperty -Path $dfltShellRegPath -Name $dfltShellCmdOptionRegKeyName -ErrorAction SilentlyContinue
}
It "$tC.$tI - default shell as powershell" {
It "$tC.$tI - default shell as powershell" -skip:$skip {
$shell_path = (Get-Command powershell.exe -ErrorAction SilentlyContinue).path
if($shell_path -ne $null) {
ConfigureDefaultShell -default_shell_path $shell_path -default_shell_cmd_option_val "/c"
@ -201,7 +202,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
}
}
It "$tC.$tI - default shell as cmd" {
It "$tC.$tI - default shell as cmd" -skip:$skip {
$shell_path = (Get-Command cmd.exe -ErrorAction SilentlyContinue).path
if($shell_path -ne $null) {
ConfigureDefaultShell -default_shell_path $shell_path -default_shell_cmd_option_val "/c"

View File

@ -112,13 +112,15 @@ Describe "Tests of sshd_config" -Tags "CI" {
}
}
}
$platform = Get-Platform
$skip = ($platform -eq [PlatformType]::Windows) -and ($PSVersionTable.PSVersion.Major -le 2)
#skip when the task schedular (*-ScheduledTask) cmdlets does not exist
$ts = (get-command get-ScheduledTask -ErrorAction SilentlyContinue)
$skip = $ts -eq $null
if(-not $skip)
{
Stop-SSHDTestDaemon
}
if(($platform -eq [PlatformType]::Windows) -and ($psversiontable.BuildVersion.Major -le 6))
if(($platform -eq [PlatformType]::Windows) -and ([Environment]::OSVersion.Version.Major -le 6))
{
#suppress the firewall blocking dialogue on win7
netsh advfirewall firewall add rule name="sshd" program="$($OpenSSHTestInfo['OpenSSHBinPath'])\sshd.exe" protocol=any action=allow dir=in