From a0d7a1b2eea0c9f9859efc902b53e4c96bc11c39 Mon Sep 17 00:00:00 2001 From: Sarabjot Singh Date: Tue, 5 Mar 2019 18:56:44 +0530 Subject: [PATCH] Port changes to 15.9 (#1938) * Translation Layer connection timeout (#1843) * Adding the missing assemblyInfo files and updating the copyrights (#1859) * Stop trying to connect if the test host exits unexpectedly (#1853) * Running NETFramework 3.5 in compat mode (#1906) * Fixing the timeouts. (#1909) * Fixing the connection timeout (#1910) * TestPlatform.PR (#1837) --- azure-pipelines.yml | 74 ++++++++++++++++++ .../Properties/AssemblyInfo.cs | 3 +- .../Properties/AssemblyInfo.cs | 3 +- scripts/test.ps1 | 2 +- scripts/test.sh | 2 +- .../Properties/AssemblyInfo.cs | 22 ++++++ .../Properties/AssemblyInfo.cs | 22 ++++++ .../Properties/AssemblyInfo.cs | 3 +- .../DesignMode/DesignModeClient.cs | 25 ++++-- .../Properties/AssemblyInfo.cs | 3 +- .../Properties/AssemblyInfo.cs | 3 +- .../Properties/AssemblyInfo.cs | 3 +- .../SocketCommunicationManager.cs | 12 ++- .../TestRequestSender.cs | 7 +- .../Properties/AssemblyInfo.cs | 3 +- .../Client/ProxyOperationManager.cs | 4 +- .../Properties/AssemblyInfo.cs | 3 +- .../Properties/AssemblyInfo.cs | 22 ++++++ .../Properties/AssemblyInfo.cs | 3 +- .../Properties/AssemblyInfo.cs | 3 +- ...t.TestPlatform.PlatformAbstractions.csproj | Bin 3708 -> 7664 bytes .../Properties/AssemblyInfo.cs | 19 +++++ .../Properties/AssemblyInfo.cs | 22 ++++++ .../Properties/AssemblyInfo.cs | 3 +- .../Properties/AssemblyInfo.cs | 3 +- .../VsTestConsoleWrapper.cs | 41 +++++++--- .../VsTestConsoleWrapperAsync.cs | 6 +- .../Properties/AssemblyInfo.cs | 3 +- src/datacollector/Properties/AssemblyInfo.cs | 3 +- src/testhost.x86/Properties/AssemblyInfo.cs | 3 +- src/testhost/Properties/AssemblyInfo.cs | 3 +- src/vstest.console/Properties/AssemblyInfo.cs | 3 +- .../Resources/Resources.Designer.cs | 2 +- src/vstest.console/Resources/Resources.resx | 2 +- .../Resources/xlf/Resources.cs.xlf | 6 +- .../Resources/xlf/Resources.de.xlf | 6 +- .../Resources/xlf/Resources.es.xlf | 6 +- .../Resources/xlf/Resources.fr.xlf | 6 +- .../Resources/xlf/Resources.it.xlf | 6 +- .../Resources/xlf/Resources.ja.xlf | 6 +- .../Resources/xlf/Resources.ko.xlf | 6 +- .../Resources/xlf/Resources.pl.xlf | 6 +- .../Resources/xlf/Resources.pt-BR.xlf | 6 +- .../Resources/xlf/Resources.ru.xlf | 6 +- .../Resources/xlf/Resources.tr.xlf | 6 +- .../Resources/xlf/Resources.xlf | 2 +- .../Resources/xlf/Resources.zh-Hans.xlf | 6 +- .../Resources/xlf/Resources.zh-Hant.xlf | 6 +- .../TestPlatformHelpers/TestRequestManager.cs | 4 +- .../ExecutionTests.cs | 18 ----- .../TranslationLayerTests/DiscoverTests.cs | 27 ------- .../DesignMode/DesignModeClientTests.cs | 3 +- ...t.TestPlatform.Common.PlatformTests.csproj | 1 + .../Program.cs | 11 +++ .../TestRequestSenderTests.cs | 23 +++++- .../Microsoft.TestPlatform.SmokeTests.csproj | 4 +- .../VsTestConsoleWrapperTests.cs | 15 +++- .../Internal/ConsoleLoggerTests.cs | 16 +++- .../TestRequestManagerTests.cs | 11 ++- 59 files changed, 393 insertions(+), 155 deletions(-) create mode 100644 azure-pipelines.yml create mode 100644 src/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/Properties/AssemblyInfo.cs create mode 100644 src/DataCollectors/TraceDataCollector/Properties/AssemblyInfo.cs create mode 100644 src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Properties/AssemblyInfo.cs create mode 100644 src/Microsoft.TestPlatform.PlatformAbstractions/Properties/AssemblyInfo.cs create mode 100644 src/Microsoft.TestPlatform.TestHostProvider/Properties/AssemblyInfo.cs create mode 100644 test/Microsoft.TestPlatform.Common.PlatformTests/Program.cs diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000000..d77a6dfb7f --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,74 @@ +# Pipeline YAML for PR + +jobs: +- job: Windows + pool: + vmImage: 'vs2017-win2016' + variables: + buildConfiguration: 'Release' + steps: + - task: BatchScript@1 + displayName: 'Run script build.cmd' + inputs: + filename: build.cmd + arguments: '-verbose -configuration $(buildConfiguration)' + modifyEnvironment: false + failOnStandardError: true + + - task: CmdLine@1 + displayName: 'Delete stale pdb files' + inputs: + filename: del + arguments: '/S /F *.pdb' + workingFolder: '$(SystemRoot)' + continueOnError: true + condition: always() + + - task: BatchScript@1 + displayName: 'Run Unit Tests' + inputs: + filename: test.cmd + arguments: '-verbose -configuration $(buildConfiguration)' + modifyEnvironment: false + failOnStandardError: true + + - task: BatchScript@1 + displayName: 'Run Acceptance Tests' + inputs: + filename: test.cmd + arguments: '-verbose -configuration $(buildConfiguration) -p AcceptanceTests -f net451' + modifyEnvironment: false + failOnStandardError: true + + - task: BatchScript@1 + displayName: 'Run Platform Tests' + inputs: + filename: test.cmd + arguments: '-verbose -configuration $(buildConfiguration) -p platformtests' + modifyEnvironment: false + failOnStandardError: true + + - task: BatchScript@1 + displayName: 'Run Smoke Tests' + inputs: + filename: test.cmd + arguments: '-verbose -configuration $(buildConfiguration) -p smoke' + modifyEnvironment: false + failOnStandardError: true + + - task: PublishTestResults@2 + displayName: 'Publish Test Results **\*.trx' + inputs: + testResultsFormat: VSTest + testResultsFiles: '**\*.trx' + condition: succeededOrFailed() + +- job: Linux + pool: + vmImage: 'ubuntu-16.04' + variables: + buildConfiguration: 'Release' + steps: + - script: ./build.sh -c $(buildConfiguration) + displayName: './build.sh -c $(buildConfiguration)' + diff --git a/samples/Microsoft.TestPlatform.E2ETest/Properties/AssemblyInfo.cs b/samples/Microsoft.TestPlatform.E2ETest/Properties/AssemblyInfo.cs index 6c03ea7df5..3993bc0992 100644 --- a/samples/Microsoft.TestPlatform.E2ETest/Properties/AssemblyInfo.cs +++ b/samples/Microsoft.TestPlatform.E2ETest/Properties/AssemblyInfo.cs @@ -9,7 +9,8 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("Microsoft.TestPlatform.E2ETest")] [assembly: AssemblyTrademark("")] diff --git a/samples/Microsoft.TestPlatform.TranslationLayer.E2ETest/Properties/AssemblyInfo.cs b/samples/Microsoft.TestPlatform.TranslationLayer.E2ETest/Properties/AssemblyInfo.cs index 84c9f676d5..6a5306ed1c 100644 --- a/samples/Microsoft.TestPlatform.TranslationLayer.E2ETest/Properties/AssemblyInfo.cs +++ b/samples/Microsoft.TestPlatform.TranslationLayer.E2ETest/Properties/AssemblyInfo.cs @@ -9,7 +9,8 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("Microsoft.TestPlatform.TranslationLayer.E2ETest")] [assembly: AssemblyTrademark("")] diff --git a/scripts/test.ps1 b/scripts/test.ps1 index ebf2427592..c2058a54ac 100644 --- a/scripts/test.ps1 +++ b/scripts/test.ps1 @@ -237,7 +237,7 @@ function Invoke-Test $testContainerPath } } - $trxLogFileName = [System.String]::Format("Parallel_{0}_{1}", $fx, $Script:TPT_DefaultTrxFileName) + $trxLogFileName = [System.String]::Format("Parallel_{0}_{1}_{2}", $TPT_Pattern, $fx, $Script:TPT_DefaultTrxFileName) # Remove already existed trx file name as due to which warning will get generated and since we are expecting result in a particular format, that will break $fullTrxFilePath = Join-Path $Script:TPT_TestResultsDir $trxLogFileName diff --git a/scripts/test.sh b/scripts/test.sh index 24f83d7ae1..d4a7b3f0bf 100644 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -18,7 +18,6 @@ CONFIGURATION="Debug" TARGET_RUNTIME="ubuntu.16.04-x64" FAIL_FAST=false VERBOSE=false -PROJECT_NAME_PATTERNS=**Unit*bin*Debug*netcoreapp1.0*UnitTests*dll while [ $# -gt 0 ]; do lowerI="$(echo ${1:-} | awk '{print tolower($0)}')" @@ -49,6 +48,7 @@ done # # Variables # +PROJECT_NAME_PATTERNS=**Unit*bin*$CONFIGURATION*netcoreapp1.0*UnitTests*dll TP_ROOT_DIR=$(cd "$(dirname "$0")"; pwd -P) TP_TOOLS_DIR="$TP_ROOT_DIR/tools" TP_PACKAGES_DIR="$TP_ROOT_DIR/packages" diff --git a/src/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/Properties/AssemblyInfo.cs b/src/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..d053a05f57 --- /dev/null +++ b/src/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/Properties/AssemblyInfo.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] +[assembly: AssemblyProduct("Microsoft.TestPlatform.Extensions.EventLogCollector")] +[assembly: AssemblyTrademark("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("4c1f0d81-67a9-4bf3-a006-615ab4a7fcd6")] diff --git a/src/DataCollectors/TraceDataCollector/Properties/AssemblyInfo.cs b/src/DataCollectors/TraceDataCollector/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..e7212dbc3d --- /dev/null +++ b/src/DataCollectors/TraceDataCollector/Properties/AssemblyInfo.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] +[assembly: AssemblyProduct("Microsoft.VisualStudio.TraceDataCollector")] +[assembly: AssemblyTrademark("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b06e12a5-025f-42aa-8f09-c6666c65ece7")] diff --git a/src/Microsoft.TestPlatform.Build/Properties/AssemblyInfo.cs b/src/Microsoft.TestPlatform.Build/Properties/AssemblyInfo.cs index 97c2ff2b32..a1eeb3a08c 100644 --- a/src/Microsoft.TestPlatform.Build/Properties/AssemblyInfo.cs +++ b/src/Microsoft.TestPlatform.Build/Properties/AssemblyInfo.cs @@ -9,7 +9,8 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("Microsoft.TestPlatform.Build")] [assembly: AssemblyTrademark("")] diff --git a/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs b/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs index fafb7058e8..bdf1c383ad 100644 --- a/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs +++ b/src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs @@ -5,6 +5,7 @@ namespace Microsoft.VisualStudio.TestPlatform.Client.DesignMode { using System; using System.Collections.Generic; + using System.Globalization; using System.Net; using System.Threading; using System.Threading.Tasks; @@ -14,22 +15,20 @@ namespace Microsoft.VisualStudio.TestPlatform.Client.DesignMode using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.ObjectModel; + using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Helpers; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; + using CommunicationUtilitiesResources = Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Resources.Resources; + using CoreUtilitiesConstants = Microsoft.VisualStudio.TestPlatform.CoreUtilities.Constants; /// /// The design mode client. /// public class DesignModeClient : IDesignModeClient { - /// - /// The timeout for the client to connect to the server. - /// - private const int ClientListenTimeOut = 5 * 1000; - private readonly ICommunicationManager communicationManager; private readonly IDataSerializer dataSerializer; @@ -96,17 +95,27 @@ public void ConnectToClientAndProcessRequests(int port, ITestRequestManager test EqtTrace.Info("Trying to connect to server on port : {0}", port); this.communicationManager.SetupClientAsync(new IPEndPoint(IPAddress.Loopback, port)); + var connectionTimeoutInSecs = EnvironmentHelper.GetConnectionTimeout(); + // Wait for the connection to the server and listen for requests. - if (this.communicationManager.WaitForServerConnection(ClientListenTimeOut)) + if (this.communicationManager.WaitForServerConnection(connectionTimeoutInSecs * 1000)) { this.communicationManager.SendMessage(MessageType.SessionConnected); this.ProcessRequests(testRequestManager); } else { - EqtTrace.Info("Client timed out while connecting to the server."); + EqtTrace.Error("DesignModeClient : ConnectToClientAndProcessRequests : Client timed out while connecting to the server."); this.Dispose(); - throw new TimeoutException(); + throw new TimeoutException( + string.Format( + CultureInfo.CurrentUICulture, + CommunicationUtilitiesResources.ConnectionTimeoutErrorMessage, + CoreUtilitiesConstants.VstestConsoleProcessName, + "translation layer", + connectionTimeoutInSecs, + EnvironmentHelper.VstestConnectionTimeout) + ); } } diff --git a/src/Microsoft.TestPlatform.Client/Properties/AssemblyInfo.cs b/src/Microsoft.TestPlatform.Client/Properties/AssemblyInfo.cs index a75e930cc4..5724397f72 100644 --- a/src/Microsoft.TestPlatform.Client/Properties/AssemblyInfo.cs +++ b/src/Microsoft.TestPlatform.Client/Properties/AssemblyInfo.cs @@ -10,7 +10,8 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("Microsoft.VisualStudio.TestPlatform.Client")] [assembly: AssemblyTrademark("")] [assembly: NeutralResourcesLanguage("en-US")] diff --git a/src/Microsoft.TestPlatform.Common/Properties/AssemblyInfo.cs b/src/Microsoft.TestPlatform.Common/Properties/AssemblyInfo.cs index ce6e1b7a49..0920ad0844 100644 --- a/src/Microsoft.TestPlatform.Common/Properties/AssemblyInfo.cs +++ b/src/Microsoft.TestPlatform.Common/Properties/AssemblyInfo.cs @@ -10,7 +10,8 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("Microsoft.TestPlatform.Common")] [assembly: AssemblyTrademark("")] [assembly: NeutralResourcesLanguage("en-US")] diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/Properties/AssemblyInfo.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/Properties/AssemblyInfo.cs index b862171f08..ab4baa8a1d 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/Properties/AssemblyInfo.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/Properties/AssemblyInfo.cs @@ -10,7 +10,8 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("Microsoft.VisualStudio.TestPlatform.CommunicationUtilities")] [assembly: AssemblyTrademark("")] [assembly: NeutralResourcesLanguage("en-US")] diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketCommunicationManager.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketCommunicationManager.cs index bc9a5b0208..50d19c7687 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/SocketCommunicationManager.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/SocketCommunicationManager.cs @@ -11,6 +11,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities using System.Threading; using System.Threading.Tasks; using Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Interfaces; + using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Helpers; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; @@ -19,11 +20,6 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities /// public class SocketCommunicationManager : ICommunicationManager { - /// - /// Time for which the client wait for executor/runner process to start, and host server - /// - private const int CONNECTIONRETRYTIMEOUT = 50 * 1000; - /// /// The server stream read timeout constant (in microseconds). /// @@ -176,10 +172,12 @@ public async Task SetupClientAsync(IPEndPoint endpoint) Stopwatch watch = new Stopwatch(); watch.Start(); + var connectionTimeout = EnvironmentHelper.GetConnectionTimeout() * 1000; do { try { + EqtTrace.Verbose("SocketCommunicationManager : SetupClientAsync : Attempting to connect to the server."); await this.tcpClient.ConnectAsync(endpoint.Address, endpoint.Port); if (this.tcpClient.Connected) @@ -201,10 +199,10 @@ public async Task SetupClientAsync(IPEndPoint endpoint) } catch (Exception ex) { - EqtTrace.Verbose("Connection Failed with error {0}, retrying", ex.ToString()); + EqtTrace.Error("Connection Failed with error {0}, retrying", ex.ToString()); } } - while ((this.tcpClient != null) && !this.tcpClient.Connected && watch.ElapsedMilliseconds < CONNECTIONRETRYTIMEOUT); + while ((this.tcpClient != null) && !this.tcpClient.Connected && watch.ElapsedMilliseconds < connectionTimeout); } /// diff --git a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs index e16708680e..4010995275 100644 --- a/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs +++ b/src/Microsoft.TestPlatform.CommunicationUtilities/TestRequestSender.cs @@ -146,9 +146,12 @@ public bool WaitForRequestHandlerConnection(int connectionTimeout, CancellationT EqtTrace.Verbose("TestRequestSender.WaitForRequestHandlerConnection: waiting for connection with timeout: {0}", connectionTimeout); } - var waitIndex = WaitHandle.WaitAny(new WaitHandle[] { this.connected.WaitHandle, cancellationToken.WaitHandle }, connectionTimeout); + // Wait until either connection is successful, handled by connected.WaitHandle + // or operation is cancelled, handled by cancellationToken.WaitHandle + // or testhost exits unexpectedly, handled by clientExited.WaitHandle + var waitIndex = WaitHandle.WaitAny(new WaitHandle[] { this.connected.WaitHandle, cancellationToken.WaitHandle, this.clientExited.WaitHandle }, connectionTimeout); - // Return true if wait is because of waitHandle. + // Return true if connection was successful. return waitIndex == 0; } diff --git a/src/Microsoft.TestPlatform.CoreUtilities/Properties/AssemblyInfo.cs b/src/Microsoft.TestPlatform.CoreUtilities/Properties/AssemblyInfo.cs index c40d8a6162..199546d215 100644 --- a/src/Microsoft.TestPlatform.CoreUtilities/Properties/AssemblyInfo.cs +++ b/src/Microsoft.TestPlatform.CoreUtilities/Properties/AssemblyInfo.cs @@ -10,7 +10,8 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("Microsoft.TestPlatform.CoreUtilities")] [assembly: AssemblyTrademark("")] [assembly: NeutralResourcesLanguage("en-US")] diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs index fd6c67a53c..46ee5bb8bd 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs @@ -155,7 +155,8 @@ public virtual bool SetupChannel(IEnumerable sources) connTimeout *= 5; } - // Wait for a timeout for the client to connect. + // If TestHost does not launch then throw exception + // If Testhost launches, wait for connection. if (!this.testHostLaunched || !this.RequestSender.WaitForRequestHandlerConnection(connTimeout * 1000, this.CancellationTokenSource.Token)) { @@ -300,7 +301,6 @@ private void TestHostManagerHostLaunched(object sender, HostProviderEventArgs e) private void TestHostManagerHostExited(object sender, HostProviderEventArgs e) { this.testHostProcessStdError = e.Data; - this.RequestSender.OnClientProcessExit(this.testHostProcessStdError); this.testHostExited.Set(); diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Properties/AssemblyInfo.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Properties/AssemblyInfo.cs index 4dc210d517..9c0fe0ca23 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Properties/AssemblyInfo.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Properties/AssemblyInfo.cs @@ -10,7 +10,8 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("Microsoft.VisualStudio.TestPlatform.CrossPlatEngine")] [assembly: AssemblyTrademark("")] [assembly: NeutralResourcesLanguage("en-US")] diff --git a/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Properties/AssemblyInfo.cs b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..33717a5453 --- /dev/null +++ b/src/Microsoft.TestPlatform.Extensions.BlameDataCollector/Properties/AssemblyInfo.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] +[assembly: AssemblyProduct("Microsoft.TestPlatform.Extensions.BlameDataCollector")] +[assembly: AssemblyTrademark("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("716373d6-9162-4ac6-9ae7-b5a3a4286808")] diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Properties/AssemblyInfo.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Properties/AssemblyInfo.cs index ece4a60f17..737488fed7 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Properties/AssemblyInfo.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Properties/AssemblyInfo.cs @@ -9,7 +9,8 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("Microsoft.TestPlatform.Extensions.TrxLogger")] [assembly: AssemblyTrademark("")] diff --git a/src/Microsoft.TestPlatform.ObjectModel/Properties/AssemblyInfo.cs b/src/Microsoft.TestPlatform.ObjectModel/Properties/AssemblyInfo.cs index b59a059a0c..46bde3567d 100644 --- a/src/Microsoft.TestPlatform.ObjectModel/Properties/AssemblyInfo.cs +++ b/src/Microsoft.TestPlatform.ObjectModel/Properties/AssemblyInfo.cs @@ -13,7 +13,8 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("Microsoft.TestPlatfrom.ObjectModel")] [assembly: AssemblyTrademark("")] [assembly: NeutralResourcesLanguage("en-US")] diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Microsoft.TestPlatform.PlatformAbstractions.csproj b/src/Microsoft.TestPlatform.PlatformAbstractions/Microsoft.TestPlatform.PlatformAbstractions.csproj index b89400e550c2fce1a1ccde212dac68458524071c..860ea3a00f6c3675a0b701862cef9035b83a1705 100644 GIT binary patch literal 7664 zcmd^^ZExFD6vxkNB))@(kVetwwy+^!U8ZUeXcB9yHqbYfrjRDIG)W^n>Bg4_e*b&z zI@hrs_hD=WS*;!4d(Ziw=X0+u|OU*;@%#>_ot zo@5{Kd+Io@^FFoTY|g3?YX@ zdfbQbO5n23{hZ&CJ?B1g`klcwx4@V775ZpiyTGqjrUtoJG0BWNv3 z)kY?7scqJ$&>4eegiUv#Jmz=Ds=T)zW7*Q%(31xw&{JG^8>e{Dy4CYkL%p=d5rB^$z;*8jwEZO`3n4#qpDDRDPc@uZPyBrLjl$m^V-Ge2s46^U46;hgR_p zvA%>`&*^YrFW@%h*Bp(`oTtlo6k7xQXvTlVTgS~&+z%Yb>rkl2p!iaxZ#!JFtTLUr z$|my)p7kqoE^VWwm|yRQbs6A(7D-LoUnA~|91z;hXM`Mq_ajL*MFT%`?_-xy_H<^i zGOL6hd5U(H?Q>l!A(kC<@8h-$l01grfNTPmGdL&M=ojp^XAhPt!bRYt?P!Jk7rB;W z_Ovc>mQ z|286 zGPCY-t85o?tSVreSc8jTdNKg{Y1nH?Nvt971ew7qIx4LiR&=>Jf-x< zUvuey%wt8ry zc{lXY$B)W=@y)c6Q(Pr~TOEtum`mBU9nC#5W}j@@b3N8Ro;&$IH=j;Cf>p zbupRkB-2X1_YdEdeZ|WXW}=R(i^X1|Jeo(lU#l$9j5^E}+J`sKUoGVeGP-o6%BEVY z(*o@)eRTVbp&Su%u9wxHoG8xkj;vig<2|w;V(-%|Uv_zxZU^iTv|Ex_DAJQF=;AKg zy^#9=kC-E`bkN@ZpR&yR$m91k>ZRg^>Zp!OXDbO^nIb@SGUkkGalZ0JetM;oEPsyi z-_(ru$353Yd~ARJG&%-AaD@fD3D%O`T+lYM7J;){7)Tr=cA6Ih3tAf4tR+$)DQEp{eds6k z7dpCG*2U=t*%So=BO+(caOTVmhkyV1m;LEm7?2G}#RMN1eY0l};I8l(Uk;2|``!M9 z@yR)|CsOAP^BqD^!b^1)lX&uXk!VM}#CcaYJu^lOm3i6Q>zf>$_vwNP48H}O{4Rz)+9PHOLqM64$v*UI5& zT~qE+=^?k5_~{A>G>Y=Cv-AFCOrw6!>|t=~+8O9)P8R`OgHPi?4@DTU07e=@<@hvE zU|WX;_5p^%gDXyhtzyd2GTtdxHc-QE@{z1oNZO~pgXC0Ce%wiU&mBYhvvUkZw7n57 z4e)3E1--~4$YAHnb0QhYI7UV@d$)qKHAv^-YVxs2{Y@6i7O6}<(<}%bdB8RESq4%t z(6Za6oSSqKi)R1q^q13;!~&v_Y16-Dyx7hldgni1G$HoH_EC08w&z3A4klPPNxl@$ zw8^#N6ld9-nHLS^Vl&gkTx1-u@{`=w%6b2xwsL&=I2vEyJx;$qJWgz@w(A^aFz>ou za>of5oIEk^i6@15{23CtnsE$YBV4WsL&2MZ6Y8$%67InViI*~z{!O<|-50G4iY0Oyb@0CMIX_O+QM8xi!OE5N;R- zfrD&2!drQr8lH++y71O!?_<0gLNL=}644aohGE3be0{`|5r`(Uz<+g;8$rF-h1-60 z{o}y$e9fUivyy&5$(5s7N(c@zCYD3NPLqQEi%RcsjpHrnvt=wZrn5m33;du$K5Mp% zluit%D=MR6Fnt{@#hi7xALkNHV*a(|{12+23>sd}Lu~2h17{n2>d+v+yNhY7nFV;o zerGeRmqvBmy`c*T21Yd*^0u8kgOb;Sim)lZ>z>% diff --git a/src/Microsoft.TestPlatform.PlatformAbstractions/Properties/AssemblyInfo.cs b/src/Microsoft.TestPlatform.PlatformAbstractions/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..aa2352b2fa --- /dev/null +++ b/src/Microsoft.TestPlatform.PlatformAbstractions/Properties/AssemblyInfo.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] +[assembly: AssemblyProduct("Microsoft.TestPlatform.PlatformAbstractions")] +[assembly: AssemblyTrademark("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] diff --git a/src/Microsoft.TestPlatform.TestHostProvider/Properties/AssemblyInfo.cs b/src/Microsoft.TestPlatform.TestHostProvider/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..892e0ae7e4 --- /dev/null +++ b/src/Microsoft.TestPlatform.TestHostProvider/Properties/AssemblyInfo.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] +[assembly: AssemblyProduct("Microsoft.TestPlatform.TestHostRuntimeProvider")] +[assembly: AssemblyTrademark("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("83693884-04ee-4083-bae1-e7827b8f5fbc")] diff --git a/src/Microsoft.TestPlatform.Utilities/Properties/AssemblyInfo.cs b/src/Microsoft.TestPlatform.Utilities/Properties/AssemblyInfo.cs index 58a039831c..cba5140912 100644 --- a/src/Microsoft.TestPlatform.Utilities/Properties/AssemblyInfo.cs +++ b/src/Microsoft.TestPlatform.Utilities/Properties/AssemblyInfo.cs @@ -10,7 +10,8 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("Microsoft.TestPlatform.Utilities")] [assembly: AssemblyTrademark("")] [assembly: NeutralResourcesLanguage("en-US")] diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Properties/AssemblyInfo.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Properties/AssemblyInfo.cs index 1b3fd8ef37..a68e7c5899 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Properties/AssemblyInfo.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/Properties/AssemblyInfo.cs @@ -9,7 +9,8 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("Microsoft.TestPlatform.ManagedConsoleWrapper")] [assembly: AssemblyTrademark("")] diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs index f128e7cc58..b3415fda3c 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapper.cs @@ -5,14 +5,20 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer { using System.Collections.Generic; using System.Diagnostics; + using System.Globalization; using System.Linq; using Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces; + using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Helpers; using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing; using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; + using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; + using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; + using CommunicationUtilitiesResources = Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.Resources.Resources; + using CoreUtilitiesConstants = Microsoft.VisualStudio.TestPlatform.CoreUtilities.Constants; /// /// An implementation of to invoke test operations @@ -22,12 +28,12 @@ public class VsTestConsoleWrapper : IVsTestConsoleWrapper { #region Private Members - private const int ConnectionTimeout = 30 * 1000; - private readonly IProcessManager vstestConsoleProcessManager; private readonly ITranslationLayerRequestSender requestSender; + private readonly IProcessHelper processHelper; + private bool sessionStarted; /// @@ -63,7 +69,7 @@ public VsTestConsoleWrapper(string vstestConsolePath) : /// Path to the test runner vstest.console.exe. /// The parameters to be passed onto the runner process public VsTestConsoleWrapper(string vstestConsolePath, ConsoleParameters consoleParameters) : - this(new VsTestConsoleRequestSender(), new VsTestConsoleProcessManager(vstestConsolePath), consoleParameters, TestPlatformEventSource.Instance) + this(new VsTestConsoleRequestSender(), new VsTestConsoleProcessManager(vstestConsolePath), consoleParameters, TestPlatformEventSource.Instance, new ProcessHelper()) { } @@ -74,12 +80,14 @@ public VsTestConsoleWrapper(string vstestConsolePath, ConsoleParameters consoleP /// Process manager. /// The parameters to be passed onto the runner process /// Performance event source - internal VsTestConsoleWrapper(ITranslationLayerRequestSender requestSender, IProcessManager processManager, ConsoleParameters consoleParameters, ITestPlatformEventSource testPlatformEventSource) + /// Helper for process related utilities + internal VsTestConsoleWrapper(ITranslationLayerRequestSender requestSender, IProcessManager processManager, ConsoleParameters consoleParameters, ITestPlatformEventSource testPlatformEventSource, IProcessHelper processHelper) { this.requestSender = requestSender; this.vstestConsoleProcessManager = processManager; this.consoleParameters = consoleParameters; this.testPlatformEventSource = testPlatformEventSource; + this.processHelper = processHelper; this.pathToAdditionalExtensions = new List(); this.vstestConsoleProcessManager.ProcessExited += (sender, args) => this.requestSender.OnProcessExited(); @@ -263,20 +271,29 @@ private void EnsureInitialized() EqtTrace.Info("VsTestConsoleWrapper.EnsureInitialized: Process Started."); this.sessionStarted = this.WaitForConnection(); } - - if (!this.sessionStarted) - { - throw new TransationLayerException("Error connecting to Vstest Command Line"); - } } private bool WaitForConnection() { EqtTrace.Info("VsTestConsoleWrapper.WaitForConnection: Waiting for connection to command line runner."); - var connected = this.requestSender.WaitForRequestHandlerConnection(ConnectionTimeout); - this.testPlatformEventSource.TranslationLayerInitializeStop(); - return connected; + var timeout = EnvironmentHelper.GetConnectionTimeout(); + if (!this.requestSender.WaitForRequestHandlerConnection(timeout * 1000)) + { + var processName = this.processHelper.GetCurrentProcessFileName(); + throw new TransationLayerException( + string.Format( + CultureInfo.CurrentUICulture, + CommunicationUtilitiesResources.ConnectionTimeoutErrorMessage, + processName, + CoreUtilitiesConstants.VstestConsoleProcessName, + timeout, + EnvironmentHelper.VstestConnectionTimeout) + ); + } + + this.testPlatformEventSource.TranslationLayerInitializeStop(); + return true; } } } diff --git a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapperAsync.cs b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapperAsync.cs index 7d828d0c0c..67f6a8471e 100644 --- a/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapperAsync.cs +++ b/src/Microsoft.TestPlatform.VsTestConsole.TranslationLayer/VsTestConsoleWrapperAsync.cs @@ -9,6 +9,7 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer using System.Threading.Tasks; using Microsoft.TestPlatform.VsTestConsole.TranslationLayer.Interfaces; + using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Helpers; using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing; using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Tracing.Interfaces; using Microsoft.VisualStudio.TestPlatform.ObjectModel; @@ -23,8 +24,6 @@ public class VsTestConsoleWrapperAsync : IVsTestConsoleWrapperAsync { #region Private Members - private const int ConnectionTimeout = 30 * 1000; - private readonly IProcessManager vstestConsoleProcessManager; private readonly ITranslationLayerRequestSenderAsync requestSender; @@ -93,8 +92,9 @@ public async Task StartSessionAsync() { this.testPlatformEventSource.TranslationLayerInitializeStart(); + var timeout = EnvironmentHelper.GetConnectionTimeout(); // Start communication - var port = await this.requestSender.InitializeCommunicationAsync(ConnectionTimeout); + var port = await this.requestSender.InitializeCommunicationAsync(timeout * 1000); if (port > 0) { diff --git a/src/SettingsMigrator/Properties/AssemblyInfo.cs b/src/SettingsMigrator/Properties/AssemblyInfo.cs index 03f6bc2fbd..008166990b 100644 --- a/src/SettingsMigrator/Properties/AssemblyInfo.cs +++ b/src/SettingsMigrator/Properties/AssemblyInfo.cs @@ -9,7 +9,8 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("SettingsMigrator")] [assembly: AssemblyTrademark("")] diff --git a/src/datacollector/Properties/AssemblyInfo.cs b/src/datacollector/Properties/AssemblyInfo.cs index 0a9e15abc2..bc9e75ac72 100644 --- a/src/datacollector/Properties/AssemblyInfo.cs +++ b/src/datacollector/Properties/AssemblyInfo.cs @@ -9,7 +9,8 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("datacollector")] [assembly: AssemblyTrademark("")] diff --git a/src/testhost.x86/Properties/AssemblyInfo.cs b/src/testhost.x86/Properties/AssemblyInfo.cs index 4727ea5d53..a077ef9ad2 100644 --- a/src/testhost.x86/Properties/AssemblyInfo.cs +++ b/src/testhost.x86/Properties/AssemblyInfo.cs @@ -10,7 +10,8 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("Microsoft.TestHost.x86")] [assembly: AssemblyTrademark("")] [assembly: NeutralResourcesLanguage("en-US")] diff --git a/src/testhost/Properties/AssemblyInfo.cs b/src/testhost/Properties/AssemblyInfo.cs index 5adc4976d8..aff5c17e7b 100644 --- a/src/testhost/Properties/AssemblyInfo.cs +++ b/src/testhost/Properties/AssemblyInfo.cs @@ -10,7 +10,8 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("Microsoft.TestHost")] [assembly: AssemblyTrademark("")] [assembly: NeutralResourcesLanguage("en-US")] diff --git a/src/vstest.console/Properties/AssemblyInfo.cs b/src/vstest.console/Properties/AssemblyInfo.cs index f84699d51c..73f3d9c686 100644 --- a/src/vstest.console/Properties/AssemblyInfo.cs +++ b/src/vstest.console/Properties/AssemblyInfo.cs @@ -9,7 +9,8 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Microsoft Corporation")] +[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] [assembly: AssemblyProduct("vstest.console")] [assembly: AssemblyTrademark("")] diff --git a/src/vstest.console/Resources/Resources.Designer.cs b/src/vstest.console/Resources/Resources.Designer.cs index 77784baf82..8b7c47a4d0 100644 --- a/src/vstest.console/Resources/Resources.Designer.cs +++ b/src/vstest.console/Resources/Resources.Designer.cs @@ -658,7 +658,7 @@ public static string FrameworkArgumentHelp } /// - /// Looks up a localized string similar to Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 "compatibility mode".. + /// Looks up a localized string similar to Framework35 is not supported. For projects targeting .Net Framework 3.5, test will run in CLR 4.0 "compatibility mode".. /// public static string Framework35NotSupported { diff --git a/src/vstest.console/Resources/Resources.resx b/src/vstest.console/Resources/Resources.resx index a84f2781a5..cb54ccd943 100644 --- a/src/vstest.console/Resources/Resources.resx +++ b/src/vstest.console/Resources/Resources.resx @@ -277,7 +277,7 @@ '{0}' not found. - Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 "compatibility mode". + Framework35 is not supported. For projects targeting .Net Framework 3.5, test will run in CLR 4.0 "compatibility mode". --Framework|/Framework:<Framework Version> diff --git a/src/vstest.console/Resources/xlf/Resources.cs.xlf b/src/vstest.console/Resources/xlf/Resources.cs.xlf index 1763ea111e..cf3b705f31 100644 --- a/src/vstest.console/Resources/xlf/Resources.cs.xlf +++ b/src/vstest.console/Resources/xlf/Resources.cs.xlf @@ -1633,9 +1633,9 @@ - Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 "compatibility mode". - Zadání Framework35 není podporováno. U projektů mířících na .Net Framework 3.5 prosím použijte Framework40, aby testy v CLR 4.0 běžely v režimu kompatibility. - + Framework35 is not supported. For projects targeting .Net Framework 3.5, test will run in CLR 4.0 "compatibility mode". + Zadání Framework35 není podporováno. U projektů mířících na .Net Framework 3.5 prosím použijte Framework40, aby testy v CLR 4.0 běžely v režimu kompatibility. + diff --git a/src/vstest.console/Resources/xlf/Resources.de.xlf b/src/vstest.console/Resources/xlf/Resources.de.xlf index 12c8ab24ce..db6617f413 100644 --- a/src/vstest.console/Resources/xlf/Resources.de.xlf +++ b/src/vstest.console/Resources/xlf/Resources.de.xlf @@ -1633,9 +1633,9 @@ - Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 "compatibility mode". - Framework35 wird nicht unterstützt. Verwenden Sie für Projekte, die auf .Net Framework 3.5 ausgerichtet sind, Framework40 zum Ausführen von Tests im "Kompatibilitätsmodus" von CLR 4.0. - + Framework35 is not supported. For projects targeting .Net Framework 3.5, test will run in CLR 4.0 "compatibility mode". + Framework35 wird nicht unterstützt. Verwenden Sie für Projekte, die auf .Net Framework 3.5 ausgerichtet sind, Framework40 zum Ausführen von Tests im "Kompatibilitätsmodus" von CLR 4.0. + diff --git a/src/vstest.console/Resources/xlf/Resources.es.xlf b/src/vstest.console/Resources/xlf/Resources.es.xlf index 0a6a9e954b..bbfb59d3a9 100644 --- a/src/vstest.console/Resources/xlf/Resources.es.xlf +++ b/src/vstest.console/Resources/xlf/Resources.es.xlf @@ -1638,9 +1638,9 @@ - Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 "compatibility mode". - No se admite Framework35. Para proyectos con destino .Net Framework 3.5, use Framework40 para ejecutar las pruebas en "modo de compatibilidad" de CLR 4.0. - + Framework35 is not supported. For projects targeting .Net Framework 3.5, test will run in CLR 4.0 "compatibility mode". + No se admite Framework35. Para proyectos con destino .Net Framework 3.5, use Framework40 para ejecutar las pruebas en "modo de compatibilidad" de CLR 4.0. + diff --git a/src/vstest.console/Resources/xlf/Resources.fr.xlf b/src/vstest.console/Resources/xlf/Resources.fr.xlf index d6c15855dc..6b888403fc 100644 --- a/src/vstest.console/Resources/xlf/Resources.fr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.fr.xlf @@ -1633,9 +1633,9 @@ - Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 "compatibility mode". - Framework35 n'est pas pris en charge. Pour les projets ciblant .Net Framework 3.5, utilisez Framework40 pour exécuter les tests dans CLR 4.0 en "mode compatibilité". - + Framework35 is not supported. For projects targeting .Net Framework 3.5, test will run in CLR 4.0 "compatibility mode". + Framework35 n'est pas pris en charge. Pour les projets ciblant .Net Framework 3.5, utilisez Framework40 pour exécuter les tests dans CLR 4.0 en "mode compatibilité". + diff --git a/src/vstest.console/Resources/xlf/Resources.it.xlf b/src/vstest.console/Resources/xlf/Resources.it.xlf index b47fea32a4..a9c6ee4f1d 100644 --- a/src/vstest.console/Resources/xlf/Resources.it.xlf +++ b/src/vstest.console/Resources/xlf/Resources.it.xlf @@ -1633,9 +1633,9 @@ - Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 "compatibility mode". - Framework35 non è supportato. Per i progetti destinati a .NET Framework 3.5, usare Framework40 per eseguire i test nella modalità di compatibilità di CLR 4.0. - + Framework35 is not supported. For projects targeting .Net Framework 3.5, test will run in CLR 4.0 "compatibility mode". + Framework35 non è supportato. Per i progetti destinati a .NET Framework 3.5, usare Framework40 per eseguire i test nella modalità di compatibilità di CLR 4.0. + diff --git a/src/vstest.console/Resources/xlf/Resources.ja.xlf b/src/vstest.console/Resources/xlf/Resources.ja.xlf index a2beac5a71..0bbdae6462 100644 --- a/src/vstest.console/Resources/xlf/Resources.ja.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ja.xlf @@ -1633,9 +1633,9 @@ - Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 "compatibility mode". - Framework35 はサポートされていません。.Net Framework 3.5 を対象とするプロジェクトでは、Framework40 を使用して CLR 4.0 の "互換モード" でテストを実行してください。 - + Framework35 is not supported. For projects targeting .Net Framework 3.5, test will run in CLR 4.0 "compatibility mode". + Framework35 はサポートされていません。.Net Framework 3.5 を対象とするプロジェクトでは、Framework40 を使用して CLR 4.0 の "互換モード" でテストを実行してください。 + diff --git a/src/vstest.console/Resources/xlf/Resources.ko.xlf b/src/vstest.console/Resources/xlf/Resources.ko.xlf index 563a694a08..2bdb09826f 100644 --- a/src/vstest.console/Resources/xlf/Resources.ko.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ko.xlf @@ -1633,9 +1633,9 @@ - Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 "compatibility mode". - Framework35는 지원되지 않습니다. .NET Framework 3.5를 대상으로 하는 프로젝트의 경우 Framework40을 사용하여 CLR 4.0 "호환 모드"에서 테스트를 실행하세요. - + Framework35 is not supported. For projects targeting .Net Framework 3.5, test will run in CLR 4.0 "compatibility mode". + Framework35는 지원되지 않습니다. .NET Framework 3.5를 대상으로 하는 프로젝트의 경우 Framework40을 사용하여 CLR 4.0 "호환 모드"에서 테스트를 실행하세요. + diff --git a/src/vstest.console/Resources/xlf/Resources.pl.xlf b/src/vstest.console/Resources/xlf/Resources.pl.xlf index 84bcdabc26..6098711c9e 100644 --- a/src/vstest.console/Resources/xlf/Resources.pl.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pl.xlf @@ -1631,9 +1631,9 @@ - Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 "compatibility mode". - Wersja Framework35 nie jest obsługiwana. W przypadku projektów przeznaczonych dla programu .Net Framework 3.5 użyj wersji Framework40 do uruchamiania testów w „trybie zgodności” CLR 4.0. - + Framework35 is not supported. For projects targeting .Net Framework 3.5, test will run in CLR 4.0 "compatibility mode". + Wersja Framework35 nie jest obsługiwana. W przypadku projektów przeznaczonych dla programu .Net Framework 3.5 użyj wersji Framework40 do uruchamiania testów w „trybie zgodności” CLR 4.0. + diff --git a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf index d9bbe2d342..bbe4bdd51c 100644 --- a/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf +++ b/src/vstest.console/Resources/xlf/Resources.pt-BR.xlf @@ -1631,9 +1631,9 @@ - Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 "compatibility mode". - Não há suporte para Framework35. Para projetos com .Net Framework 3.5 de destino, use o Framework40 para executar testes em “modo de compatibilidade” CLR 4.0. - + Framework35 is not supported. For projects targeting .Net Framework 3.5, test will run in CLR 4.0 "compatibility mode". + Não há suporte para Framework35. Para projetos com .Net Framework 3.5 de destino, use o Framework40 para executar testes em “modo de compatibilidade” CLR 4.0. + diff --git a/src/vstest.console/Resources/xlf/Resources.ru.xlf b/src/vstest.console/Resources/xlf/Resources.ru.xlf index f6de314c33..3fd7725c75 100644 --- a/src/vstest.console/Resources/xlf/Resources.ru.xlf +++ b/src/vstest.console/Resources/xlf/Resources.ru.xlf @@ -1633,9 +1633,9 @@ - Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 "compatibility mode". - Framework35 не поддерживается. В проектах для .Net Framework 3.5 запускайте тесты в режиме совместимости CLR 4.0 с использованием Framework40. - + Framework35 is not supported. For projects targeting .Net Framework 3.5, test will run in CLR 4.0 "compatibility mode". + Framework35 не поддерживается. В проектах для .Net Framework 3.5 запускайте тесты в режиме совместимости CLR 4.0 с использованием Framework40. + diff --git a/src/vstest.console/Resources/xlf/Resources.tr.xlf b/src/vstest.console/Resources/xlf/Resources.tr.xlf index 16bf48729b..a0f8394125 100644 --- a/src/vstest.console/Resources/xlf/Resources.tr.xlf +++ b/src/vstest.console/Resources/xlf/Resources.tr.xlf @@ -1633,9 +1633,9 @@ - Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 "compatibility mode". - Framework35 desteklenmiyor. .NET Framework 3.5’i hedefleyen projeler için lütfen Framework40 kullanarak testleri CLR 4.0’ın “uyumluluk modunda” çalıştırın. - + Framework35 is not supported. For projects targeting .Net Framework 3.5, test will run in CLR 4.0 "compatibility mode". + Framework35 desteklenmiyor. .NET Framework 3.5’i hedefleyen projeler için lütfen Framework40 kullanarak testleri CLR 4.0’ın “uyumluluk modunda” çalıştırın. + diff --git a/src/vstest.console/Resources/xlf/Resources.xlf b/src/vstest.console/Resources/xlf/Resources.xlf index c89c7b3ee5..6a18bf3040 100644 --- a/src/vstest.console/Resources/xlf/Resources.xlf +++ b/src/vstest.console/Resources/xlf/Resources.xlf @@ -815,7 +815,7 @@ - Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 "compatibility mode". + Framework35 is not supported. For projects targeting .Net Framework 3.5, test will run in CLR 4.0 "compatibility mode". Framework35 not supported. Use Framework40 or above to run tests in CLR 4.0 "compatibly mode". diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf index 2775c59a2d..2491ecca96 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hans.xlf @@ -1633,9 +1633,9 @@ - Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 "compatibility mode". - Framework35 不受支持。对于面向 .Net Framework 3.5 的项目,请使用 Framework40 在 CLR 4.0“兼容性模式”下运行测试。 - + Framework35 is not supported. For projects targeting .Net Framework 3.5, test will run in CLR 4.0 "compatibility mode". + Framework35 不受支持。对于面向 .Net Framework 3.5 的项目,请使用 Framework40 在 CLR 4.0“兼容性模式”下运行测试。 + diff --git a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf index 6e9b8563bc..e9e1af8986 100644 --- a/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf +++ b/src/vstest.console/Resources/xlf/Resources.zh-Hant.xlf @@ -1633,9 +1633,9 @@ - Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 "compatibility mode". - 不支援 Framework35。若為以 .Net Framework 3.5 為目標的專案,請使用 Framework40 在 CLR 4.0「相容模式」中執行測試。 - + Framework35 is not supported. For projects targeting .Net Framework 3.5, test will run in CLR 4.0 "compatibility mode". + 不支援 Framework35。若為以 .Net Framework 3.5 為目標的專案,請使用 Framework40 在 CLR 4.0「相容模式」中執行測試。 + diff --git a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs index 8ac9548de3..2736921d60 100644 --- a/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs +++ b/src/vstest.console/TestPlatformHelpers/TestRequestManager.cs @@ -396,8 +396,8 @@ private bool UpdateRunSettingsIfRequired(string runsettingsXml, List sou if (Constants.DotNetFramework35.Equals(chosenFramework.Name)) { - EqtTrace.Error("TestRequestManager.UpdateRunSettingsIfRequired: throw exception on /Framework:Framework35 option."); - throw new TestPlatformException(Resources.Framework35NotSupported); + EqtTrace.Warning("TestRequestManager.UpdateRunSettingsIfRequired: throw warning on /Framework:Framework35 option."); + ConsoleLogger.RaiseTestRunWarning(Resources.Framework35NotSupported); } if (EqtTrace.IsInfoEnabled) diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/ExecutionTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/ExecutionTests.cs index 3707a3339e..42aa0fa34d 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/ExecutionTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/ExecutionTests.cs @@ -231,23 +231,5 @@ public void IncompatibleSourcesWarningShouldBeDisplayedInTheConsole(RunnerInfo r // When both x64 & x86 DLL is passed x64 dll will be ignored. this.StdOutputContains(expectedWarningContains); } - - [TestMethod] - [NetFullTargetFrameworkDataSource(useCoreRunner:false)] - public void ExecuteTestsForFramework35ShouldPrintErrorMessage(RunnerInfo runnerInfo) - { - AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); - var expectedWarningContains = "Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 \"compatibility mode\"."; - var assemblyPaths = this.GetAssetFullPath("SimpleTestProject.dll"); - - var arguments = PrepareArguments(assemblyPaths, this.GetTestAdapterPath(), string.Empty, this.FrameworkArgValue, runnerInfo.InIsolationValue); - arguments = string.Concat(arguments, " /Framework:.NETFramework,Version=v3.5"); - - this.InvokeVsTest(arguments); - - this.ExitCodeEquals(1); - - this.StdErrorContains(expectedWarningContains); - } } } diff --git a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/DiscoverTests.cs b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/DiscoverTests.cs index 1f6b61202a..5ee70392f6 100644 --- a/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/DiscoverTests.cs +++ b/test/Microsoft.TestPlatform.AcceptanceTests/TranslationLayerTests/DiscoverTests.cs @@ -73,33 +73,6 @@ public void DiscoverTestsUsingDiscoveryEventHandler2AndTelemetryOptedOut(RunnerI Assert.AreEqual(0, this.discoveryEventHandler2.Metrics.Count); } - [TestMethod] - [NetFullTargetFrameworkDataSource] - public void DiscoverTestsShouldFailForFramework35(RunnerInfo runnerInfo) - { - AcceptanceTestBase.SetTestEnvironment(this.testEnvironment, runnerInfo); - this.ExecuteNotSupportedRunnerFrameworkTests(runnerInfo.RunnerFramework, Netcoreapp, Message); - this.Setup(); - - string runSettingsXml = @" - - - Framework35 - true - - "; - - this.vstestConsoleWrapper.DiscoverTests( - this.GetTestAssemblies(), - runSettingsXml, - new TestPlatformOptions() { CollectMetrics = false }, - this.discoveryEventHandler2); - - Assert.AreEqual(1, this.discoveryEventHandler2.testMessages.Count); - StringAssert.Contains(this.discoveryEventHandler2.testMessages[0].message, "Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 \"compatibility mode\"."); - Assert.AreEqual(TestMessageLevel.Error, this.discoveryEventHandler2.testMessages[0].testMessageLevel); - } - [TestMethod] [NetFullTargetFrameworkDataSource] [NetCoreTargetFrameworkDataSource] diff --git a/test/Microsoft.TestPlatform.Client.UnitTests/DesignMode/DesignModeClientTests.cs b/test/Microsoft.TestPlatform.Client.UnitTests/DesignMode/DesignModeClientTests.cs index abd58c571e..443794f5e0 100644 --- a/test/Microsoft.TestPlatform.Client.UnitTests/DesignMode/DesignModeClientTests.cs +++ b/test/Microsoft.TestPlatform.Client.UnitTests/DesignMode/DesignModeClientTests.cs @@ -252,7 +252,8 @@ public void DesignModeClientOnBadConnectionShouldStopServerAndThrowTimeoutExcept { this.mockCommunicationManager.Setup(cm => cm.WaitForServerConnection(It.IsAny())).Returns(false); - Assert.ThrowsException(() => this.designModeClient.ConnectToClientAndProcessRequests(PortNumber, this.mockTestRequestManager.Object)); + var ex = Assert.ThrowsException(() => this.designModeClient.ConnectToClientAndProcessRequests(PortNumber, this.mockTestRequestManager.Object)); + Assert.AreEqual("vstest.console process failed to connect to translation layer process after 90 seconds. This may occur due to machine slowness, please set environment variable VSTEST_CONNECTION_TIMEOUT to increase timeout.", ex.Message); this.mockCommunicationManager.Verify(cm => cm.SetupClientAsync(new IPEndPoint(IPAddress.Loopback, PortNumber)), Times.Once); this.mockCommunicationManager.Verify(cm => cm.WaitForServerConnection(It.IsAny()), Times.Once); diff --git a/test/Microsoft.TestPlatform.Common.PlatformTests/Microsoft.TestPlatform.Common.PlatformTests.csproj b/test/Microsoft.TestPlatform.Common.PlatformTests/Microsoft.TestPlatform.Common.PlatformTests.csproj index a60bcbe10d..ebdc931090 100644 --- a/test/Microsoft.TestPlatform.Common.PlatformTests/Microsoft.TestPlatform.Common.PlatformTests.csproj +++ b/test/Microsoft.TestPlatform.Common.PlatformTests/Microsoft.TestPlatform.Common.PlatformTests.csproj @@ -6,6 +6,7 @@ + Exe netcoreapp1.0;net451 Microsoft.TestPlatform.Common.PlatformTests true diff --git a/test/Microsoft.TestPlatform.Common.PlatformTests/Program.cs b/test/Microsoft.TestPlatform.Common.PlatformTests/Program.cs new file mode 100644 index 0000000000..c14da13e69 --- /dev/null +++ b/test/Microsoft.TestPlatform.Common.PlatformTests/Program.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft. All rights reserved. + +namespace Microsoft.VisualStudio.TestPlatform.Common.UnitTests +{ + public static class Program + { + public static void Main(string[] args) + { + } + } +} \ No newline at end of file diff --git a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TestRequestSenderTests.cs b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TestRequestSenderTests.cs index fea9e9156b..dc62f557c8 100644 --- a/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TestRequestSenderTests.cs +++ b/test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/TestRequestSenderTests.cs @@ -98,14 +98,33 @@ public void WaitForRequestHandlerConnectionShouldNotConnectIfExceptionWasThrownB } [TestMethod] - public void WaitForRequestHandlerConnectionWithInfiniteTimeoutShouldReturnImmediatelyWhenCancellationRequested() + public void WaitForRequestHandlerConnectionWithTimeoutShouldReturnImmediatelyWhenCancellationRequested() { var cancellationTokenSource = new CancellationTokenSource(); cancellationTokenSource.Cancel(); - var connected = this.testRequestSender.WaitForRequestHandlerConnection(-1, cancellationTokenSource.Token); + var connectionTimeout = 5000; + var watch = System.Diagnostics.Stopwatch.StartNew(); + var connected = this.testRequestSender.WaitForRequestHandlerConnection(connectionTimeout, cancellationTokenSource.Token); + watch.Stop(); Assert.IsFalse(connected); + Assert.IsTrue(watch.ElapsedMilliseconds < connectionTimeout); + } + + [TestMethod] + public void WaitForRequestHandlerConnectionWithTimeoutShouldReturnImmediatelyIfHostExitedUnexpectedly() + { + var cancellationTokenSource = new CancellationTokenSource(); + this.testRequestSender.OnClientProcessExit("DummyError"); + + var connectionTimeout = 5000; + var watch = System.Diagnostics.Stopwatch.StartNew(); + var connected = this.testRequestSender.WaitForRequestHandlerConnection(connectionTimeout, cancellationTokenSource.Token); + watch.Stop(); + + Assert.IsFalse(connected); + Assert.IsTrue(watch.ElapsedMilliseconds < connectionTimeout); } [TestMethod] diff --git a/test/Microsoft.TestPlatform.SmokeTests/Microsoft.TestPlatform.SmokeTests.csproj b/test/Microsoft.TestPlatform.SmokeTests/Microsoft.TestPlatform.SmokeTests.csproj index c6a54bb6bf..cd2568b209 100644 --- a/test/Microsoft.TestPlatform.SmokeTests/Microsoft.TestPlatform.SmokeTests.csproj +++ b/test/Microsoft.TestPlatform.SmokeTests/Microsoft.TestPlatform.SmokeTests.csproj @@ -6,9 +6,9 @@ - Exe + Exe Microsoft.TestPlatform.SmokeTests - netcoreapp1.0;net451 + netcoreapp1.0;netcoreapp2.0;net451 diff --git a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs index 1c7f158755..02d2b79de1 100644 --- a/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs +++ b/test/TranslationLayer.UnitTests/VsTestConsoleWrapperTests.cs @@ -11,6 +11,7 @@ namespace Microsoft.TestPlatform.VsTestConsole.TranslationLayer.UnitTests using Microsoft.VisualStudio.TestPlatform.ObjectModel; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client; using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces; + using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Interfaces; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -23,6 +24,8 @@ public class VsTestConsoleWrapperTests private Mock mockProcessManager; + private Mock mockProcessHelper; + private Mock mockRequestSender; private readonly List testSources = new List { "Hello", "World" }; @@ -42,11 +45,13 @@ public void TestInitialize() this.mockRequestSender = new Mock(); this.mockProcessManager = new Mock(); + this.mockProcessHelper = new Mock(); this.consoleWrapper = new VsTestConsoleWrapper( this.mockRequestSender.Object, this.mockProcessManager.Object, this.consoleParameters, - new Mock().Object); + new Mock().Object, + this.mockProcessHelper.Object); this.mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(It.IsAny())).Returns(true); this.mockRequestSender.Setup(rs => rs.InitializeCommunication()).Returns(100); @@ -124,9 +129,11 @@ public void InitializeExtensionsShouldSucceed() [TestMethod] public void InitializeExtensionsShouldThrowExceptionOnBadConnection() { + this.mockProcessHelper.Setup(x => x.GetCurrentProcessFileName()).Returns("DummyProcess"); this.mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(It.IsAny())).Returns(false); - Assert.ThrowsException(() => this.consoleWrapper.InitializeExtensions(new List { "Hello", "World" })); + var exception = Assert.ThrowsException(() => this.consoleWrapper.InitializeExtensions(new List { "Hello", "World" })); + Assert.AreEqual("DummyProcess process failed to connect to vstest.console process after 90 seconds. This may occur due to machine slowness, please set environment variable VSTEST_CONNECTION_TIMEOUT to increase timeout.", exception.Message); this.mockRequestSender.Verify(rs => rs.InitializeExtensions(It.IsAny>()), Times.Never); } @@ -158,9 +165,11 @@ public void DiscoverTestsShouldCallTestDiscoveryHandler2IfTestDiscoveryHandler1I [TestMethod] public void DiscoverTestsShouldThrowExceptionOnBadConnection() { + this.mockProcessHelper.Setup(x => x.GetCurrentProcessFileName()).Returns("DummyProcess"); this.mockRequestSender.Setup(rs => rs.WaitForRequestHandlerConnection(It.IsAny())).Returns(false); - Assert.ThrowsException(() => this.consoleWrapper.DiscoverTests(new List { "Hello", "World" }, null, null, new Mock().Object)); + var exception = Assert.ThrowsException(() => this.consoleWrapper.DiscoverTests(new List { "Hello", "World" }, null, null, new Mock().Object)); + Assert.AreEqual("DummyProcess process failed to connect to vstest.console process after 90 seconds. This may occur due to machine slowness, please set environment variable VSTEST_CONNECTION_TIMEOUT to increase timeout.", exception.Message); this.mockRequestSender.Verify(rs => rs.DiscoverTests(It.IsAny>(), It.IsAny(), null, It.IsAny()), Times.Never); } diff --git a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs index 2fe8ac1ab0..af70fec47b 100644 --- a/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs +++ b/test/vstest.console.UnitTests/Internal/ConsoleLoggerTests.cs @@ -144,7 +144,8 @@ public void TestMessageHandlerShouldWriteToConsoleWhenTestRunMessageIsRaised() loggerEvents.RaiseTestRunMessage(new TestRunMessageEventArgs(TestMessageLevel.Informational, "Informational123")); loggerEvents.RaiseTestRunMessage(new TestRunMessageEventArgs(TestMessageLevel.Error, "Error123")); loggerEvents.RaiseTestRunMessage(new TestRunMessageEventArgs(TestMessageLevel.Warning, "Warning123")); - + loggerEvents.WaitForEventCompletion(); + // Added this for synchronization SpinWait.SpinUntil(() => count == 3, 300); @@ -163,6 +164,7 @@ public void TestMessageHandlerShouldWriteToConsoleWhenTestDiscoveryMessageIsRais loggerEvents.RaiseDiscoveryMessage(new TestRunMessageEventArgs(TestMessageLevel.Informational, "Informational123")); loggerEvents.RaiseDiscoveryMessage(new TestRunMessageEventArgs(TestMessageLevel.Error, "Error123")); loggerEvents.RaiseDiscoveryMessage(new TestRunMessageEventArgs(TestMessageLevel.Warning, "Warning123")); + loggerEvents.WaitForEventCompletion(); // Added this for synchronization SpinWait.SpinUntil(() => count == 3, 300); @@ -223,6 +225,7 @@ public void TestResultHandlerShouldShowStdOutMessagesBannerIfStdOutIsNotEmpty() testresult.Messages.Add(testResultMessage); loggerEvents.RaiseTestResult(new TestResultEventArgs(testresult)); + loggerEvents.WaitForEventCompletion(); // Added this for synchronization SpinWait.SpinUntil(() => count == 2, 300); @@ -253,6 +256,7 @@ public void NormalVerbosityShowNotStdOutMessagesForPassedTests() // Raise an event on mock object loggerEvents.RaiseTestResult(new TestResultEventArgs(testresult)); + loggerEvents.WaitForEventCompletion(); // Verify this.mockOutput.Verify(o => o.WriteLine(CommandLineResources.StdOutMessagesBanner, OutputLevel.Information), Times.Never()); @@ -308,7 +312,8 @@ public void TestRunErrorMessageShowShouldTestRunFailed() // Act. Raise an event on mock object loggerEvents.RaiseTestRunMessage(new TestRunMessageEventArgs(TestMessageLevel.Error, message)); loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); - + loggerEvents.WaitForEventCompletion(); + // Verify this.mockOutput.Verify(o => o.WriteLine(CommandLineResources.TestRunFailed, OutputLevel.Error), Times.Once()); this.mockOutput.Verify(o => o.WriteLine(message, OutputLevel.Error), Times.Once()); @@ -331,6 +336,7 @@ public void InQuietModeTestErrorMessageShowShouldShowTestRunFailed() // Act. Raise an event on mock object loggerEvents.RaiseTestRunMessage(new TestRunMessageEventArgs(TestMessageLevel.Error, message)); loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); + loggerEvents.WaitForEventCompletion(); // Verify this.mockOutput.Verify(o => o.WriteLine(CommandLineResources.TestRunFailed, OutputLevel.Error), Times.Once()); @@ -354,6 +360,7 @@ public void InQuietModeTestWarningMessageShouldNotShow() // Act. Raise an event on mock object loggerEvents.RaiseTestRunMessage(new TestRunMessageEventArgs(TestMessageLevel.Warning, message)); loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); + loggerEvents.WaitForEventCompletion(); // Verify this.mockOutput.Verify(o => o.WriteLine(message, OutputLevel.Warning), Times.Never()); @@ -378,6 +385,7 @@ public void InNormalModeTestWarningAndErrorMessagesShouldShow() loggerEvents.RaiseTestRunMessage(new TestRunMessageEventArgs(TestMessageLevel.Warning, message)); loggerEvents.RaiseTestRunMessage(new TestRunMessageEventArgs(TestMessageLevel.Error, errorMessage)); loggerEvents.RaiseTestRunComplete(new TestRunCompleteEventArgs(new Mock().Object, false, false, null, new Collection(), TimeSpan.FromSeconds(1))); + loggerEvents.WaitForEventCompletion(); // Verify this.mockOutput.Verify(o => o.WriteLine(CommandLineResources.TestRunFailed, OutputLevel.Error), Times.Once()); @@ -405,6 +413,7 @@ public void TestResultHandlerShouldNotShowStdOutMessagesBannerIfStdOutIsEmpty() testresult.Messages.Add(testResultMessage); loggerEvents.RaiseTestResult(new TestResultEventArgs(testresult)); + loggerEvents.WaitForEventCompletion(); this.mockOutput.Verify(o => o.WriteLine(CommandLineResources.StdOutMessagesBanner, OutputLevel.Information), Times.Never()); } @@ -454,6 +463,7 @@ public void TestResultHandlerShouldNotShowStdErrMessagesBannerIfStdErrIsEmpty() testresult.Messages.Add(testResultMessage); loggerEvents.RaiseTestResult(new TestResultEventArgs(testresult)); + loggerEvents.WaitForEventCompletion(); this.mockOutput.Verify(o => o.WriteLine(CommandLineResources.StdErrMessagesBanner, OutputLevel.Information), Times.Never()); } @@ -505,6 +515,7 @@ public void TestResultHandlerShouldNotShowAdditionalInfoBannerIfAdditionalInfoIs testresult.Messages.Add(testResultMessage); loggerEvents.RaiseTestResult(new TestResultEventArgs(testresult)); + loggerEvents.WaitForEventCompletion(); this.mockOutput.Verify(o => o.WriteLine(CommandLineResources.AddnlInfoMessagesBanner, OutputLevel.Information), Times.Never()); } @@ -614,6 +625,7 @@ public void TestResultHandlerShouldWriteToNoTestResultForQuietVerbosity() { loggerEvents.RaiseTestResult(new TestResultEventArgs(testResult)); } + loggerEvents.WaitForEventCompletion(); this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.PassedTestIndicator, "TestName"), OutputLevel.Information), Times.Never); this.mockOutput.Verify(o => o.WriteLine(string.Format(CultureInfo.CurrentCulture, CommandLineResources.FailedTestIndicator, "TestName"), OutputLevel.Information), Times.Never); diff --git a/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs b/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs index 8cac6457e6..289aacff79 100644 --- a/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs +++ b/test/vstest.console.UnitTests/TestPlatformHelpers/TestRequestManagerTests.cs @@ -848,7 +848,7 @@ public void RunTestsShouldReadTheBatchSizeFromSettingsAndSetItForTestRunCriteria } [TestMethod] - public void RunTestsShouldThrowForFramework35() + public void RunTestsShouldNotThrowForFramework35() { var payload = new TestRunRequestPayload() { @@ -870,9 +870,14 @@ public void RunTestsShouldThrowForFramework35() actualTestRunCriteria = runCriteria; }).Returns(mockDiscoveryRequest.Object); this.mockAssemblyMetadataProvider.Setup(a => a.GetFrameWork(It.IsAny())).Returns(new FrameworkName(Constants.DotNetFramework35)); - var actualErrorMessage = Assert.ThrowsException( () => this.testRequestManager.RunTests(payload, new Mock().Object, new Mock().Object, this.protocolConfig)).Message; - Assert.AreEqual("Framework35 is not supported. For projects targeting .Net Framework 3.5, please use Framework40 to run tests in CLR 4.0 \"compatibility mode\".", actualErrorMessage); + var mockRunEventsRegistrar = new Mock(); + var mockCustomlauncher = new Mock(); + + this.testRequestManager.RunTests(payload, mockCustomlauncher.Object, mockRunEventsRegistrar.Object, this.protocolConfig); + + mockTestPlatformEventSource.Verify(mt => mt.ExecutionRequestStart(), Times.Once); + mockTestPlatformEventSource.Verify(mt => mt.ExecutionRequestStop(), Times.Once); } [TestMethod]