Skip to content
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

Fix integration tests #33575

Merged
merged 4 commits into from Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 27 additions & 0 deletions eng/build-utils.ps1
Expand Up @@ -287,3 +287,30 @@ function Make-BootstrapBuild() {

return $dir
}

Add-Type -AssemblyName 'System.Drawing'
Add-Type -AssemblyName 'System.Windows.Forms'
function Capture-Screenshot($path) {
$width = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Width
$height = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Height

$bitmap = New-Object System.Drawing.Bitmap $width, $height
try {
$graphics = [System.Drawing.Graphics]::FromImage($bitmap)
try {
$graphics.CopyFromScreen( `
[System.Windows.Forms.Screen]::PrimaryScreen.Bounds.X, `
[System.Windows.Forms.Screen]::PrimaryScreen.Bounds.Y, `
0, `
0, `
$bitmap.Size, `
[System.Drawing.CopyPixelOperation]::SourceCopy)
} finally {
$graphics.Dispose()
}

$bitmap.Save($path, [System.Drawing.Imaging.ImageFormat]::Png)
} finally {
$bitmap.Dispose()
}
}
43 changes: 42 additions & 1 deletion eng/build.ps1
Expand Up @@ -370,7 +370,7 @@ function TestUsingOptimizedRunner() {
if ($ci) {
$args += " -xml"
if ($testVsi) {
$args += " -timeout:120"
$args += " -timeout:110"
} else {
$args += " -timeout:65"
}
Expand Down Expand Up @@ -505,6 +505,47 @@ try {
if ($ci) {
List-Processes
Prepare-TempDir

if ($testVsi) {
$screenshotPath = (Join-Path $LogDir "StartingBuild.png")
try {
Capture-Screenshot $screenshotPath
}
catch {
Write-Host "Screenshot failed; attempting to connect to the console"

# Keep the session open so we have a UI to interact with
$quserItems = ((quser $env:USERNAME | select -Skip 1) -split '\s+')
$sessionid = $quserItems[2]
if ($sessionid -eq 'Disc') {
# When the session isn't connected, the third value is 'Disc' instead of the ID
$sessionid = $quserItems[1]
}

if ($quserItems[1] -eq 'console') {
Write-Host "Disconnecting from console before attempting reconnection"
try {
tsdiscon
sharwell marked this conversation as resolved.
Show resolved Hide resolved
} catch {
# ignore
}

# Disconnection is asynchronous, so wait a few seconds for it to complete
Start-Sleep -Seconds 3
query user
}

Write-Host "tscon $sessionid /dest:console"
tscon $sessionid /dest:console

# Connection is asynchronous, so wait a few seconds for it to complete
Start-Sleep 3
query user
sharwell marked this conversation as resolved.
Show resolved Hide resolved

# Make sure we can capture a screenshot. An exception at this point will fail-fast the build.
Capture-Screenshot $screenshotPath
}
}
}

if ($bootstrap) {
Expand Down
Expand Up @@ -213,8 +213,8 @@ Inherits Attribute
VisualStudio.Editor.Verify.TextContains(@"
Import System;

Public Class CustomAttribute
Inherits Attribute
Public Class CustomAttribute
Inherits Attribute
End Class");
}

Expand Down Expand Up @@ -333,7 +333,7 @@ Inherits Attribute
Import System;

Public Class CustomAttribute
Inherits Attribute
Inherits Attribute
End Class");
}

Expand All @@ -359,7 +359,7 @@ Inherits Attribute
Import System;

Public Class CustomAttribute
Inherits Attribute
Inherits Attribute
sharwell marked this conversation as resolved.
Show resolved Hide resolved
End Class");
}
}
Expand Down
Expand Up @@ -324,6 +324,9 @@ private static Process StartNewVisualStudioProcess(string installationPath, int
// Disable roaming settings to avoid interference from the online user profile
Process.Start(vsRegEditExeFile, $"set \"{installationPath}\" {Settings.Default.VsRootSuffix} HKCU \"ApplicationPrivateSettings\\Microsoft\\VisualStudio\" RoamingEnabled string \"1*System.Boolean*False\"").WaitForExit();

// Disable async completion for 16.0 Preview 3 testing
sharwell marked this conversation as resolved.
Show resolved Hide resolved
Process.Start(vsRegEditExeFile, $"set \"{installationPath}\" {Settings.Default.VsRootSuffix} HKCU \"ApplicationPrivateSettings\\WindowManagement\\Options\" UseAsyncCompletion string \"1*System.Int32*-1\"").WaitForExit();

// Disable text editor error reporting because it pops up a dialog. We want to either fail fast in our
// custom handler or fail silently and continue testing.
Process.Start(vsRegEditExeFile, $"set \"{installationPath}\" {Settings.Default.VsRootSuffix} HKCU \"Text Editor\" \"Report Exceptions\" dword 0").WaitForExit();
Expand Down