未验证 提交 22286daa 编写于 作者: S Sam Harwell 提交者: GitHub

Merge pull request #35603 from sharwell/hosted-pool

Use the hosted pool for integration tests
......@@ -24,7 +24,9 @@ pr:
jobs:
- job: VS_Integration
pool: dotnet-external-vs2019-preview
pool:
name: NetCorePublic-Pool
queue: buildpool.windows.10.amd64.vs2019.pre.open
strategy:
maxParallel: 4
matrix:
......@@ -68,6 +70,15 @@ jobs:
continueOnError: true
condition: not(succeeded())
- task: PublishBuildArtifacts@1
displayName: Publish Secondary Logs
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log2\$(_configuration)'
ArtifactName: '$(System.JobAttempt)-Secondary Logs $(_configuration) $(_completionName) $(Build.BuildNumber)'
publishLocation: Container
continueOnError: true
condition: not(succeeded())
- task: PublishBuildArtifacts@1
displayName: Publish Screenshots
inputs:
......
......@@ -345,6 +345,8 @@ function TestUsingOptimizedRunner() {
$env:ROSLYN_TEST_LEGACY_COMPLETION = "true"
}
$secondaryLogDir = Join-Path (Join-Path $ArtifactsDir "log2") $configuration
Create-Directory $secondaryLogDir
$testResultsDir = Join-Path $ArtifactsDir "TestResults\$configuration"
$binDir = Join-Path $ArtifactsDir "bin"
$runTests = GetProjectOutputBinary "RunTests.exe"
......@@ -358,6 +360,7 @@ function TestUsingOptimizedRunner() {
$args = "`"$xunitDir`""
$args += " `"-out:$testResultsDir`""
$args += " `"-logs:$LogDir`""
$args += " `"-secondaryLogs:$secondaryLogDir`""
$args += " -nocache"
$args += " -tfm:net472"
......
......@@ -149,6 +149,8 @@ public string WarningsNotAsErrors
get { return (string)_store[nameof(WarningsNotAsErrors)]; }
}
public string NullableContextOptions { get { return null; } set { } }
public string Nullable
{
set { _store[nameof(Nullable)] = value; }
......
......@@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using EnvDTE;
......@@ -16,6 +17,7 @@ namespace Roslyn.Compilers.Extension
{
[ProvideAutoLoad(UIContextGuids.SolutionExists, PackageAutoLoadFlags.BackgroundLoad)]
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
[Guid("31C0675E-87A4-4061-A0DD-A4E510FCCF97")]
public sealed class CompilerPackage : AsyncPackage
{
public static string RoslynHive = null;
......
......@@ -80,6 +80,7 @@ private bool Execute(EncapsulateFieldCommandArgs args, IUIThreadOperationScope w
}
waitScope.AllowCancellation = false;
cancellationToken = waitScope.Context.UserCancellationToken;
var finalSolution = result.GetSolutionAsync(cancellationToken).WaitAndGetResult(cancellationToken);
......
......@@ -91,6 +91,11 @@ internal class Options
/// </summary>
public string LogFilesOutputDirectory { get; set; }
/// <summary>
/// Directory to hold secondary dump files created while running tests.
/// </summary>
public string LogFilesSecondaryOutputDirectory { get; set; }
internal static Options Parse(string[] args)
{
if (args == null || args.Any(a => a == null) || args.Length < 2)
......@@ -154,6 +159,11 @@ bool isOption(string argument, string optionName, out string value)
opt.LogFilesOutputDirectory = logsPath;
index++;
}
else if (isOption(current, "-secondaryLogs", out string secondaryLogsPath))
{
opt.LogFilesSecondaryOutputDirectory = secondaryLogsPath;
index++;
}
else if (isOption(current, "-display", out value))
{
if (Enum.TryParse(value, ignoreCase: true, result: out Display display))
......@@ -238,6 +248,9 @@ bool isOption(string argument, string optionName, out string value)
opt.LogFilesOutputDirectory = opt.TestResultXmlOutputDirectory;
}
// If we weren't passed both -secondaryLogs and -logs but just -logs (or -out), use the same value for -secondaryLogs too.
opt.LogFilesSecondaryOutputDirectory ??= opt.LogFilesOutputDirectory;
opt.Assemblies = args.Skip(index).ToList();
return allGood ? opt : null;
}
......
......@@ -11,22 +11,27 @@ namespace RunTests
{
private const string KeyProcDumpFilePath = "ProcDumpFilePath";
private const string KeyProcDumpDirectory = "ProcDumpOutputPath";
private const string KeyProcDumpSecondaryDirectory = "ProcDumpSecondaryOutputPath";
internal string ProcDumpFilePath { get; }
internal string DumpDirectory { get; }
internal string SecondaryDumpDirectory { get; }
internal ProcDumpInfo(string procDumpFilePath, string dumpDirectory)
internal ProcDumpInfo(string procDumpFilePath, string dumpDirectory, string secondaryDumpDirectory)
{
Debug.Assert(Path.IsPathRooted(procDumpFilePath));
Debug.Assert(Path.IsPathRooted(dumpDirectory));
Debug.Assert(Path.IsPathRooted(secondaryDumpDirectory));
ProcDumpFilePath = procDumpFilePath;
DumpDirectory = dumpDirectory;
SecondaryDumpDirectory = secondaryDumpDirectory;
}
internal void WriteEnvironmentVariables(Dictionary<string, string> environment)
{
environment[KeyProcDumpFilePath] = ProcDumpFilePath;
environment[KeyProcDumpDirectory] = DumpDirectory;
environment[KeyProcDumpSecondaryDirectory] = SecondaryDumpDirectory;
}
internal static ProcDumpInfo? ReadFromEnvironment()
......@@ -35,13 +40,14 @@ internal void WriteEnvironmentVariables(Dictionary<string, string> environment)
var procDumpFilePath = Environment.GetEnvironmentVariable(KeyProcDumpFilePath);
var dumpDirectory = Environment.GetEnvironmentVariable(KeyProcDumpDirectory);
var secondaryDumpDirectory = Environment.GetEnvironmentVariable(KeyProcDumpSecondaryDirectory);
if (!validate(procDumpFilePath) || !validate(dumpDirectory))
if (!validate(procDumpFilePath) || !validate(dumpDirectory) || !validate(secondaryDumpDirectory))
{
return null;
}
return new ProcDumpInfo(procDumpFilePath, dumpDirectory);
return new ProcDumpInfo(procDumpFilePath, dumpDirectory, secondaryDumpDirectory);
}
}
......
......@@ -20,6 +20,11 @@ namespace RunTests
{
internal sealed partial class Program
{
private static readonly ImmutableHashSet<string> PrimaryProcessNames = ImmutableHashSet.Create(
StringComparer.OrdinalIgnoreCase,
"devenv",
"xunit.console.x86");
internal const int ExitSuccess = 0;
internal const int ExitFailure = 1;
......@@ -223,10 +228,12 @@ async Task DumpProcess(Process targetProcess, string procDumpExeFilePath, string
var procDumpInfo = GetProcDumpInfo(options);
if (procDumpInfo != null)
{
var dumpDir = procDumpInfo.Value.DumpDirectory;
var counter = 0;
foreach (var proc in ProcessUtil.GetProcessTree(Process.GetCurrentProcess()).OrderBy(x => x.ProcessName))
{
var dumpDir = PrimaryProcessNames.Contains(proc.ProcessName)
? procDumpInfo.Value.DumpDirectory
: procDumpInfo.Value.SecondaryDumpDirectory;
var dumpFilePath = Path.Combine(dumpDir, $"{proc.ProcessName}-{counter}.dmp");
await DumpProcess(proc, procDumpInfo.Value.ProcDumpFilePath, dumpFilePath);
counter++;
......@@ -244,7 +251,7 @@ async Task DumpProcess(Process targetProcess, string procDumpExeFilePath, string
{
if (!string.IsNullOrEmpty(options.ProcDumpDirectory))
{
return new ProcDumpInfo(Path.Combine(options.ProcDumpDirectory, "procdump.exe"), options.LogFilesOutputDirectory);
return new ProcDumpInfo(Path.Combine(options.ProcDumpDirectory, "procdump.exe"), options.LogFilesOutputDirectory, options.LogFilesSecondaryOutputDirectory);
}
return null;
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
......@@ -61,9 +62,9 @@ internal class PreviewEngine : ForegroundThreadAffinitizedObject, IVsPreviewChan
{
_topLevelName = topLevelItemName;
_topLevelGlyph = topLevelGlyph;
_title = title;
_helpString = helpString;
_description = description;
_title = title ?? throw new ArgumentNullException(nameof(title));
_helpString = helpString ?? throw new ArgumentNullException(nameof(helpString));
_description = description ?? throw new ArgumentNullException(nameof(description));
_newSolution = newSolution.WithMergedLinkedFileChangesAsync(oldSolution, cancellationToken: CancellationToken.None).Result;
_oldSolution = oldSolution;
_diffSelector = componentModel.GetService<ITextDifferencingSelectorService>();
......
......@@ -33,7 +33,7 @@ static void Main(string[] args)
}
}";
[WpfFact]
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/35701")]
[Trait(Traits.Feature, Traits.Features.EncapsulateField)]
public void EncapsulateThroughCommand()
{
......
......@@ -28,7 +28,7 @@ Sub Main()
End Sub
End Module";
[WpfFact]
[WpfFact(Skip = "https://github.com/dotnet/roslyn/issues/35701")]
[Trait(Traits.Feature, Traits.Features.EncapsulateField)]
public void EncapsulateThroughCommand()
{
......
......@@ -16,12 +16,21 @@ namespace Microsoft.VisualStudio.IntegrationTest.Setup
[ProvideAutoLoad(UIContextGuids80.SolutionExists, PackageAutoLoadFlags.BackgroundLoad)]
public sealed class IntegrationTestServicePackage : AsyncPackage
{
private static readonly Guid s_compilerPackage = new Guid("31C0675E-87A4-4061-A0DD-A4E510FCCF97");
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
{
await base.InitializeAsync(cancellationToken, progress).ConfigureAwait(true);
await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
cancellationToken.ThrowIfCancellationRequested();
var shell = (IVsShell)await GetServiceAsync(typeof(SVsShell));
ErrorHandler.ThrowOnFailure(shell.IsPackageInstalled(s_compilerPackage, out var installed));
if (installed != 0)
{
await ((IVsShell7)shell).LoadPackageAsync(s_compilerPackage);
}
IntegrationTestServiceCommands.Initialize(this);
}
}
......
......@@ -14,17 +14,21 @@ public Dialog_OutOfProc(VisualStudioInstance visualStudioInstance)
public void VerifyOpen(string dialogName)
{
using var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout);
// FindDialog will wait until the dialog is open, so the return value is unused.
DialogHelpers.FindDialogByName(GetMainWindowHWnd(), dialogName, isOpen: true, CancellationToken.None);
DialogHelpers.FindDialogByName(GetMainWindowHWnd(), dialogName, isOpen: true, cancellationTokenSource.Token);
// Wait for application idle to ensure the dialog is fully initialized
VisualStudioInstance.WaitForApplicationIdle(CancellationToken.None);
VisualStudioInstance.WaitForApplicationIdle(cancellationTokenSource.Token);
}
public void VerifyClosed(string dialogName)
{
using var cancellationTokenSource = new CancellationTokenSource(Helper.HangMitigatingTimeout);
// FindDialog will wait until the dialog is closed, so the return value is unused.
DialogHelpers.FindDialogByName(GetMainWindowHWnd(), dialogName, isOpen: false, CancellationToken.None);
DialogHelpers.FindDialogByName(GetMainWindowHWnd(), dialogName, isOpen: false, cancellationTokenSource.Token);
}
public void Click(string dialogName, string buttonName)
......
......@@ -11,6 +11,7 @@
using System.Threading.Tasks;
using EnvDTE;
using Microsoft.VisualStudio.Setup.Configuration;
using Microsoft.Win32;
using RunTests;
using Process = System.Diagnostics.Process;
......@@ -332,6 +333,18 @@ private static Process StartNewVisualStudioProcess(string installationPath, int
var useAsyncCompletionSetting = usingAsyncCompletion ? 1 : -1;
Process.Start(vsRegEditExeFile, $"set \"{installationPath}\" {Settings.Default.VsRootSuffix} HKCU \"ApplicationPrivateSettings\\WindowManagement\\Options\" UseAsyncCompletion string \"1*System.Int32*{useAsyncCompletionSetting}\"").WaitForExit();
var disabledFlights = Registry.GetValue(@"HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\ABExp\LocalTest", "DisabledFlights", Array.Empty<string>()) as string[] ?? Array.Empty<string>();
if (usingAsyncCompletion)
{
disabledFlights = disabledFlights.Where(flight => !string.Equals(flight, "completionapi", StringComparison.OrdinalIgnoreCase)).ToArray();
}
else if (!disabledFlights.Contains("completionapi", StringComparer.OrdinalIgnoreCase))
{
disabledFlights = disabledFlights.Concat(new[] { "completionapi" }).ToArray();
}
Registry.SetValue(@"HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\ABExp\LocalTest", "DisabledFlights", disabledFlights, RegistryValueKind.MultiString);
// 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();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册