提交 83999b70 编写于 作者: S Sam Harwell

Enable async completion for integration tests

上级 04864663
......@@ -22,16 +22,24 @@ jobs:
- job: Windows_VisualStudio_Integration_Tests
pool: dotnet-external-vs2019-preview
strategy:
maxParallel: 2
maxParallel: 4
matrix:
debug:
_configuration: Debug
_useLegacyCompletion: false
release:
_configuration: Release
_useLegacyCompletion: false
debug_legacy:
_configuration: Debug
_useLegacyCompletion: true
release_legacy:
_configuration: Release
_useLegacyCompletion: true
timeoutInMinutes: 135
steps:
- script: eng/cibuild.cmd -configuration $(_configuration) -prepareMachine -testVsi
- script: eng/cibuild.cmd -configuration $(_configuration) -prepareMachine -testVsi -testLegacyCompletion:$$(_useLegacyCompletion)
displayName: Build and Test
- task: PublishTestResults@1
......@@ -40,14 +48,14 @@ jobs:
testRunner: XUnit
testResultsFiles: $(Build.SourcesDirectory)\artifacts\TestResults\$(_configuration)\*.xml
mergeTestResults: true
testRunTitle: 'Windows Visual Studio Integration $(_configuration)'
testRunTitle: 'Windows Visual Studio Integration $(_configuration)_$(_useLegacyCompletion)'
condition: always()
- task: PublishBuildArtifacts@1
displayName: Publish Logs
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\log\$(_configuration)'
ArtifactName: 'Windows Visual Studio Integration $(_configuration)'
ArtifactName: 'Windows Visual Studio Integration $(_configuration)_$(_useLegacyCompletion)'
publishLocation: Container
continueOnError: true
condition: not(succeeded())
......@@ -56,7 +64,7 @@ jobs:
displayName: Publish Screenshots
inputs:
PathtoPublish: '$(Build.SourcesDirectory)\artifacts\bin\Microsoft.VisualStudio.LanguageServices.IntegrationTests\$(_configuration)\net472\xUnitResults'
ArtifactName: 'Screenshots $(_configuration)'
ArtifactName: 'Screenshots $(_configuration)_$(_useLegacyCompletion)'
publishLocation: Container
continueOnError: true
condition: not(succeeded())
......@@ -57,6 +57,7 @@ param (
[switch][Alias('test')]$testDesktop,
[switch]$testCoreClr,
[switch]$testIOperation,
[switch]$testLegacyCompletion,
[parameter(ValueFromRemainingArguments=$true)][string[]]$properties)
......@@ -87,6 +88,7 @@ function Print-Usage() {
Write-Host " -testCoreClr Run CoreClr unit tests"
Write-Host " -testVsi Run all integration tests"
Write-Host " -testIOperation Run extra checks to validate IOperations"
Write-Host " -testLegacyCompletion Run integration tests with legacy completion"
Write-Host ""
Write-Host "Advanced settings:"
Write-Host " -ci Set when running on CI server"
......@@ -325,6 +327,10 @@ function TestUsingOptimizedRunner() {
$env:ROSLYN_TEST_IOPERATION = "true"
}
if ($testLegacyCompletion) {
$env:ROSLYN_TEST_LEGACY_COMPLETION = "true"
}
$testResultsDir = Join-Path $ArtifactsDir "TestResults\$configuration"
$binDir = Join-Path $ArtifactsDir "bin"
$runTests = GetProjectOutputBinary "RunTests.exe"
......@@ -397,6 +403,9 @@ function TestUsingOptimizedRunner() {
if ($testIOperation) {
Remove-Item env:\ROSLYN_TEST_IOPERATION
}
if ($testLegacyCompletion) {
Remove-Item env:\ROSLYN_TEST_LEGACY_COMPLETION
}
}
}
......
// 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 Roslyn.Test.Utilities;
namespace Microsoft.VisualStudio.IntegrationTest.Utilities
{
/// <summary>
/// Marks a test that should only run when async completion is enabled.
/// </summary>
public sealed class AsyncCompletionCondition : ExecutionCondition
{
public static AsyncCompletionCondition Instance { get; } = new AsyncCompletionCondition();
public override bool ShouldSkip => !LegacyCompletionCondition.Instance.ShouldSkip;
public override string SkipReason => "The test only runs when async completion is enabled.";
}
}
// 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 Roslyn.Test.Utilities;
namespace Microsoft.VisualStudio.IntegrationTest.Utilities
{
/// <summary>
/// Marks a test that should only run when legacy completion is enabled.
/// </summary>
public sealed class LegacyCompletionCondition : ExecutionCondition
{
public static LegacyCompletionCondition Instance { get; } = new LegacyCompletionCondition();
public override bool ShouldSkip => string.Equals(Environment.GetEnvironmentVariable("ROSLYN_TEST_LEGACY_COMPLETION"), "true", StringComparison.OrdinalIgnoreCase);
public override string SkipReason => "The test only runs when legacy completion is enabled.";
}
}
......@@ -324,8 +324,10 @@ 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
Process.Start(vsRegEditExeFile, $"set \"{installationPath}\" {Settings.Default.VsRootSuffix} HKCU \"ApplicationPrivateSettings\\WindowManagement\\Options\" UseAsyncCompletion string \"1*System.Int32*-1\"").WaitForExit();
// Enable or disable async completion as necessary for integration testing
var usingAsyncCompletion = LegacyCompletionCondition.Instance.ShouldSkip;
var useAsyncCompletionSetting = usingAsyncCompletion ? 1 : -1;
Process.Start(vsRegEditExeFile, $"set \"{installationPath}\" {Settings.Default.VsRootSuffix} HKCU \"ApplicationPrivateSettings\\WindowManagement\\Options\" UseAsyncCompletion string \"1*System.Int32*{useAsyncCompletionSetting}\"").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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册