Skip to content

Commit

Permalink
Port changes to 15.9 (#1938)
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
singhsarab authored Mar 5, 2019
1 parent b2ddbe9 commit a0d7a1b
Show file tree
Hide file tree
Showing 59 changed files with 393 additions and 155 deletions.
74 changes: 74 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -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)'

Original file line number Diff line number Diff line change
Expand Up @@ -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("")]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("")]

Expand Down
2 changes: 1 addition & 1 deletion scripts/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)}')"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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")]
22 changes: 22 additions & 0 deletions src/DataCollectors/TraceDataCollector/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -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")]
3 changes: 2 additions & 1 deletion src/Microsoft.TestPlatform.Build/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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("")]

Expand Down
25 changes: 17 additions & 8 deletions src/Microsoft.TestPlatform.Client/DesignMode/DesignModeClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

/// <summary>
/// The design mode client.
/// </summary>
public class DesignModeClient : IDesignModeClient
{
/// <summary>
/// The timeout for the client to connect to the server.
/// </summary>
private const int ClientListenTimeOut = 5 * 1000;

private readonly ICommunicationManager communicationManager;

private readonly IDataSerializer dataSerializer;
Expand Down Expand Up @@ -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)
);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/Microsoft.TestPlatform.Client/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
3 changes: 2 additions & 1 deletion src/Microsoft.TestPlatform.Common/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -19,11 +20,6 @@ namespace Microsoft.VisualStudio.TestPlatform.CommunicationUtilities
/// </summary>
public class SocketCommunicationManager : ICommunicationManager
{
/// <summary>
/// Time for which the client wait for executor/runner process to start, and host server
/// </summary>
private const int CONNECTIONRETRYTIMEOUT = 50 * 1000;

/// <summary>
/// The server stream read timeout constant (in microseconds).
/// </summary>
Expand Down Expand Up @@ -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)
Expand All @@ -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);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ public virtual bool SetupChannel(IEnumerable<string> 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))
{
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
Original file line number Diff line number Diff line change
@@ -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")]
Loading

0 comments on commit a0d7a1b

Please sign in to comment.