Skip to content

Commit

Permalink
Revert part of "Remove regions (#3366)" (#3369)
Browse files Browse the repository at this point in the history
Co-authored-by: Amaury Levé <amauryleve@microsoft.com>
  • Loading branch information
Evangelink and Evangelink authored Feb 15, 2022
1 parent 17cf142 commit daa1534
Show file tree
Hide file tree
Showing 138 changed files with 1,136 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ internal EventLogDataCollector(IFileHelper fileHelper)
/// </summary>
internal Dictionary<DataCollectionContext, EventLogSessionContext> ContextMap { get; }


#region DataCollector Members

/// <summary>
/// Initializes the data collector
/// </summary>
Expand Down Expand Up @@ -179,6 +182,7 @@ public override void Initialize(
events.TestCaseEnd += _testCaseEndEventHandler;
}

#endregion
/// <summary>
/// The write event logs.
/// </summary>
Expand Down Expand Up @@ -275,6 +279,9 @@ internal string WriteEventLogs(List<EventLogEntry> eventLogEntries, int maxLogEn

return eventLogPath;
}

#region IDisposable Members

/// <summary>
/// Cleans up resources allocated by the data collector
/// </summary>
Expand All @@ -299,6 +306,8 @@ protected override void Dispose(bool disposing)
RemoveTempEventLogDirs(_eventLogDirectories);
}

#endregion

private static ISet<string> ParseCommaSeparatedList(string commaSeparatedList)
{
ISet<string> strings = new HashSet<string>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@

using System.Runtime.CompilerServices;

#region Test Assemblies

[assembly: InternalsVisibleTo("Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
#endregion
3 changes: 3 additions & 0 deletions src/Microsoft.TestPlatform.Build/Friends.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@

using System.Runtime.CompilerServices;

#region Test Assemblies

[assembly: InternalsVisibleTo("Microsoft.TestPlatform.Build.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]

#endregion
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,8 @@ private void StopTestSession(StopTestSessionPayload payload, ITestRequestManager
});
}

#region IDisposable Support

private bool _disposedValue; // To detect redundant calls

protected virtual void Dispose(bool disposing)
Expand All @@ -582,4 +584,5 @@ public void Dispose()
// Do not change this code. Put cleanup code in Dispose(bool disposing) above.
Dispose(true);
}
#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public DesignModeTestEventsRegistrar(IDesignModeClient designModeClient)
_designModeClient = designModeClient;
}

#region ITestDiscoveryEventsRegistrar

public void RegisterDiscoveryEvents(IDiscoveryRequest discoveryRequest)
{
discoveryRequest.OnRawMessageReceived += OnRawMessageReceived;
Expand All @@ -33,6 +35,10 @@ public void UnregisterDiscoveryEvents(IDiscoveryRequest discoveryRequest)
discoveryRequest.OnRawMessageReceived -= OnRawMessageReceived;
}

#endregion

#region ITestRunEventsRegistrar

public void RegisterTestRunEvents(ITestRunRequest testRunRequest)
{
testRunRequest.OnRawMessageReceived += OnRawMessageReceived;
Expand All @@ -43,6 +49,8 @@ public void UnregisterTestRunEvents(ITestRunRequest testRunRequest)
testRunRequest.OnRawMessageReceived -= OnRawMessageReceived;
}

#endregion

/// <summary>
/// RawMessage received handler for getting rawmessages directly from the host
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ public DiscoveryCriteria DiscoveryCriteria
/// </summary>
internal ITestLoggerManager LoggerManager { get; }

#region ITestDiscoveryEventsHandler2 Methods

/// <inheritdoc/>
public void HandleDiscoveryComplete(DiscoveryCompleteEventArgs discoveryCompleteEventArgs, IEnumerable<TestCase> lastChunk)
{
Expand Down Expand Up @@ -417,6 +419,10 @@ private string UpdateRawMessageWithTelemetryInfo(DiscoveryCompletePayload discov
return rawMessage;
}

#endregion

#region IDisposable implementation

/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or
/// resetting unmanaged resources.
Expand Down Expand Up @@ -453,6 +459,7 @@ private void Dispose(bool disposing)
EqtTrace.Info("DiscoveryRequest.Dispose: Completed.");
}

#endregion
/// <summary>
/// Request Data
/// </summary>
Expand Down
8 changes: 8 additions & 0 deletions src/Microsoft.TestPlatform.Client/Execution/TestRunRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ internal TestRunRequest(IRequestData requestData, TestRunCriteria testRunCriteri
_requestData = requestData;
}

#region ITestRunRequest

/// <summary>
/// Execute the test run asynchronously
/// </summary>
Expand Down Expand Up @@ -327,6 +329,10 @@ internal ITestLoggerManager LoggerManager
get; private set;
}

#endregion

#region IDisposable implementation

// Summary:
// Performs application-defined tasks associated with freeing, releasing, or
// resetting unmanaged resources.
Expand All @@ -337,6 +343,8 @@ public void Dispose()
GC.SuppressFinalize(this);
}

#endregion

/// <summary>
/// The criteria/config for this test run request.
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions src/Microsoft.TestPlatform.Client/Friends.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@

using System.Runtime.CompilerServices;

#region Product Assemblies

#endregion

#region Test Assemblies

[assembly: InternalsVisibleTo("Microsoft.TestPlatform.Client.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]

#endregion
5 changes: 5 additions & 0 deletions src/Microsoft.TestPlatform.Common/Friends.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@

using System.Runtime.CompilerServices;

#region Product Assemblies
[assembly: InternalsVisibleTo("Microsoft.TestPlatform.CrossPlatEngine, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleTo("vstest.console, PublicKey =002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleTo("datacollector, PublicKey =002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleTo("Microsoft.TestPlatform.CommunicationUtilities, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.TestPlatform.Common, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.TestPlatform.Client, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]

#endregion

#region Test Assemblies
[assembly: InternalsVisibleTo("Microsoft.TestPlatform.Common.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleTo("Microsoft.TestPlatform.CrossPlatEngine.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleTo("vstest.console.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
Expand All @@ -21,3 +25,4 @@
[assembly: InternalsVisibleTo("Microsoft.TestPlatform.Extensions.BlameDataCollector.UnitTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleTo("Microsoft.TestPlatform.TestUtilities, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleTo("Microsoft.TestPlatform.AcceptanceTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
#endregion
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ public InternalTestLoggerEvents(TestSessionMessageLogger testSessionMessageLogge
/// </summary>
public override event EventHandler<DiscoveryCompleteEventArgs> DiscoveryComplete;


#region IDisposable

/// <summary>
/// Waits for all pending messages to be processed by the loggers cleans up.
/// </summary>
Expand All @@ -132,6 +135,8 @@ public void Dispose()
_loggerEventQueue.Dispose();
}

#endregion

/// <summary>
/// Enables sending of events to the loggers which are registered and flushes the queue.
/// </summary>
Expand Down
4 changes: 4 additions & 0 deletions src/Microsoft.TestPlatform.Common/RunSettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@ private RunSettingsManager()
}



#region IRunSettingsProvider

/// <summary>
/// Gets the active run settings.
/// </summary>
public RunSettings ActiveRunSettings { get; private set; }

#endregion
public static RunSettingsManager Instance
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ internal SocketCommunicationManager(IDataSerializer dataSerializer)
_dataSerializer = dataSerializer;
}

#region ServerMethods

/// <summary>
/// Host TCP Socket Server and start listening
/// </summary>
Expand Down Expand Up @@ -154,6 +156,10 @@ public void StopServer()
_binaryWriter?.Dispose();
}

#endregion

#region ClientMethods

/// <summary>
/// Connects to server async
/// </summary>
Expand Down Expand Up @@ -233,6 +239,8 @@ public void StopClient()
_binaryWriter?.Dispose();
}

#endregion

/// <summary>
/// Writes message to the binary writer.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ public void CheckVersionWithTestHost()
}
}

#region Discovery Protocol

/// <inheritdoc />
public void InitializeDiscovery(IEnumerable<string> pathToAdditionalExtensions)
{
Expand Down Expand Up @@ -274,6 +276,10 @@ public void DiscoverTests(DiscoveryCriteria discoveryCriteria, ITestDiscoveryEve

_channel.Send(message);
}
#endregion

#region Execution Protocol

/// <inheritdoc />
public void InitializeExecution(IEnumerable<string> pathToAdditionalExtensions)
{
Expand Down Expand Up @@ -401,6 +407,8 @@ public void SendTestRunAbort()
_channel?.Send(_dataSerializer.SerializeMessage(MessageType.AbortTestRun));
}

#endregion

/// <inheritdoc />
public void EndSession()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client;
/// </summary>
internal abstract class ParallelOperationManager<T, TU> : IParallelOperationManager, IDisposable
{
#region ConcurrentManagerInstanceData

protected Func<T> CreateNewConcurrentManager { get; set; }

/// <summary>
Expand All @@ -39,12 +41,18 @@ internal abstract class ParallelOperationManager<T, TU> : IParallelOperationMana
/// </summary>
private int _currentParallelLevel;

#endregion

#region Concurrency Keeper Objects

/// <summary>
/// LockObject to iterate our sourceEnumerator in parallel
/// We can use the sourceEnumerator itself as lockObject, but since its a changing object - it's risky to use it as one
/// </summary>
protected object _sourceEnumeratorLockObject = new();

#endregion

protected ParallelOperationManager(Func<T> createNewManager, int parallelLevel, bool sharedHosts)
{
CreateNewConcurrentManager = createNewManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ internal class ParallelProxyDiscoveryManager : ParallelOperationManager<IProxyDi
{
private readonly IDataSerializer _dataSerializer;

#region DiscoverySpecificData

private int _discoveryCompletedClients;
private int _availableTestSources = -1;

Expand All @@ -41,11 +43,17 @@ internal class ParallelProxyDiscoveryManager : ParallelOperationManager<IProxyDi
// This field indicates if abort was requested by testplatform (user)
private bool _discoveryAbortRequested;

#endregion

#region Concurrency Keeper Objects

/// <summary>
/// LockObject to update discovery status in parallel
/// </summary>
private readonly object _discoveryStatusLockObject = new();

#endregion

public ParallelProxyDiscoveryManager(IRequestData requestData, Func<IProxyDiscoveryManager> actualProxyManagerCreator, int parallelLevel, bool sharedHosts)
: this(requestData, actualProxyManagerCreator, JsonDataSerializer.Instance, parallelLevel, sharedHosts)
{
Expand All @@ -58,6 +66,8 @@ internal ParallelProxyDiscoveryManager(IRequestData requestData, Func<IProxyDisc
_dataSerializer = dataSerializer;
}

#region IProxyDiscoveryManager

/// <inheritdoc/>
public void Initialize(bool skipDefaultAdapters)
{
Expand Down Expand Up @@ -91,6 +101,10 @@ public void Close()
DoActionOnAllManagers(proxyManager => proxyManager.Close(), doActionsInParallel: true);
}

#endregion

#region IParallelProxyDiscoveryManager methods

/// <inheritdoc/>
public bool HandlePartialDiscoveryComplete(IProxyDiscoveryManager proxyDiscoveryManager, long totalTests, IEnumerable<TestCase> lastChunk, bool isAborted)
{
Expand Down Expand Up @@ -152,6 +166,8 @@ Now when both.net framework and.net core projects can run in parallel
return false;
}

#endregion

private void DiscoverTestsPrivate(ITestDiscoveryEventsHandler2 discoveryEventsHandler)
{
_currentDiscoveryEventsHandler = discoveryEventsHandler;
Expand Down
Loading

0 comments on commit daa1534

Please sign in to comment.