forked from openssh/openssh-portable
-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable Appverifier tests #191
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a6578b6
Enable Appverifier tests and fix of #839
bingbing8 00de18a
Fix sftp isues found in app verifier and enable sftp in app verifier …
bingbing8 37f1839
minor updates
bingbing8 a58bbbd
enabled Postmortem Debugging
bingbing8 75b156f
added clean up of PostmortemDebugging
bingbing8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ $Script:UnitTestResultsFile = Join-Path $TestDataPath $UnitTestResultsFileName | |
$Script:TestSetupLogFile = Join-Path $TestDataPath $TestSetupLogFileName | ||
$Script:E2ETestDirectory = Join-Path $repositoryRoot.FullName -ChildPath "regress\pesterTests" | ||
$Script:WindowsInBox = $false | ||
$Script:EnableAppVerifier = $true | ||
|
||
<# | ||
.Synopsis | ||
|
@@ -32,8 +33,9 @@ function Set-OpenSSHTestEnvironment | |
param | ||
( | ||
[string] $OpenSSHBinPath, | ||
[string] $TestDataPath = "$env:SystemDrive\OpenSSHTests", | ||
[Boolean] $DebugMode = $false | ||
[string] $TestDataPath = "$env:SystemDrive\OpenSSHTests", | ||
[Boolean] $DebugMode = $false, | ||
[Switch] $NoAppVerifier | ||
) | ||
|
||
if($PSBoundParameters.ContainsKey("Verbose")) | ||
|
@@ -51,7 +53,7 @@ function Set-OpenSSHTestEnvironment | |
$Script:UnitTestResultsFile = Join-Path $TestDataPath "UnitTestResults.txt" | ||
$Script:TestSetupLogFile = Join-Path $TestDataPath "TestSetupLog.txt" | ||
$Script:UnitTestDirectory = Get-UnitTestDirectory | ||
|
||
$Script:EnableAppVerifier = -not ($NoAppVerifier.IsPresent) | ||
|
||
$Global:OpenSSHTestInfo = @{ | ||
"Target"= "localhost"; # test listener name | ||
|
@@ -67,6 +69,7 @@ function Set-OpenSSHTestEnvironment | |
"E2ETestDirectory" = $Script:E2ETestDirectory # the directory of E2E tests | ||
"UnitTestDirectory" = $Script:UnitTestDirectory # the directory of unit tests | ||
"DebugMode" = $DebugMode # run openssh E2E in debug mode | ||
"EnableAppVerifier" = $Script:EnableAppVerifier | ||
} | ||
|
||
#if user does not set path, pick it up | ||
|
@@ -237,6 +240,22 @@ WARNING: Following changes will be made to OpenSSH configuration | |
cmd /c "ssh-add -D 2>&1 >> $Script:TestSetupLogFile" | ||
Repair-UserKeyPermission -FilePath $testPriKeypath -confirm:$false | ||
cmd /c "ssh-add $testPriKeypath 2>&1 >> $Script:TestSetupLogFile" | ||
|
||
#Enable AppVerifier | ||
if($EnableAppVerifier) | ||
{ | ||
<#$folderName = "x86" | ||
if($env:PROCESSOR_ARCHITECTURE -ieq "AMD64") | ||
{ | ||
$folderName = "x64" | ||
}#> | ||
& $env:windir\System32\appverif.exe -disable * -for * | ||
Get-ChildItem "$($script:OpenSSHBinPath)\*.exe" -Exclude sftp.exe | % { | ||
& $env:windir\System32\appverif.exe -verify $_.Name | out-null | ||
#reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\AeDebug" /v "Debugger" /t REG_SZ /d "`"${env:ProgramFiles(x86)}\Windows Kits\8.1\Debuggers\$folderName\Debuggers\windbg.exe`" -p %ld -e %ld -g" /f | ||
} | ||
} | ||
|
||
Backup-OpenSSHTestInfo | ||
} | ||
#TODO - this is Windows specific. Need to be in PAL | ||
|
@@ -294,6 +313,11 @@ function Install-OpenSSHTestDependencies | |
Write-Log -Message "Installing Pester..." | ||
choco install Pester -y --force --limitoutput 2>&1 >> $Script:TestSetupLogFile | ||
} | ||
|
||
if(($Script:EnableAppVerifier -or (($OpenSSHTestInfo -ne $null) -and ($OpenSSHTestInfo["EnableAppVerifier"]))) -and (-not (Test-path $env:windir\System32\appverif.exe))) | ||
{ | ||
choco install appverifier -y --force --limitoutput 2>&1 >> $Script:TestSetupLogFile | ||
} | ||
} | ||
|
||
function Install-OpenSSHUtilsModule | ||
|
@@ -396,6 +420,11 @@ function Clear-OpenSSHTestEnvironment | |
Get-ChildItem "$sshBinPath\sshtest*hostkey*.pub"| % { | ||
ssh-add-hostkey.ps1 -Delete_key $_.FullName | ||
} | ||
|
||
if($Global:OpenSSHTestInfo["EnableAppVerifier"] -and (Test-path $env:windir\System32\appverif.exe)) | ||
{ | ||
& $env:windir\System32\appverif.exe -disable * -for * | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this do ? can you put in some comments please? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This just clean up the applications in application verifier. |
||
} | ||
|
||
Remove-Item $sshBinPath\sshtest*hostkey* -Force -ErrorAction SilentlyContinue | ||
#Restore sshd_config | ||
|
@@ -442,7 +471,7 @@ function Clear-OpenSSHTestEnvironment | |
{ | ||
Write-Log -Message "Uninstalling Module OpenSSHUtils..." | ||
Uninstall-OpenSSHUtilsModule | ||
} | ||
} | ||
} | ||
|
||
<# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please delete this before you push your changes upstream
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to keep them to save time in case people want to set Postmortem Debugging when things got broken or even want to enable it in the future. :)