Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Translation layer logs #2166

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -68,6 +68,8 @@ internal VsTestConsoleRequestSender(ICommunicationManager communicationManager,
/// <returns>Port Number of hosted server on this side</returns>
public int InitializeCommunication()
{
EqtTrace.Info("VsTestConsoleRequestSender.InitializeCommunication: Started.");

this.processExitCancellationTokenSource = new CancellationTokenSource();
this.handShakeSuccessful = false;
this.handShakeComplete.Reset();
Expand All @@ -90,6 +92,8 @@ public int InitializeCommunication()
this.handShakeComplete.Set();
}

EqtTrace.Info("VsTestConsoleRequestSender.InitializeCommunication: Ended.");

return port;
}

Expand All @@ -107,6 +111,8 @@ public bool WaitForRequestHandlerConnection(int clientConnectionTimeout)
/// <inheritdoc/>
public async Task<int> InitializeCommunicationAsync(int clientConnectionTimeout)
{
EqtTrace.Info($"VsTestConsoleRequestSender.InitializeCommunicationAsync: Started with client connection timeout {clientConnectionTimeout} milliseconds.");

this.processExitCancellationTokenSource = new CancellationTokenSource();
this.handShakeSuccessful = false;
this.handShakeComplete.Reset();
Expand All @@ -126,18 +132,22 @@ public async Task<int> InitializeCommunicationAsync(int clientConnectionTimeout)
this.handShakeComplete.Set();
}

EqtTrace.Info("VsTestConsoleRequestSender.InitializeCommunicationAsync: Ended.");

return this.handShakeSuccessful ? port : -1;
}

/// <inheritdoc/>
public void InitializeExtensions(IEnumerable<string> pathToAdditionalExtensions)
{
EqtTrace.Info($"VsTestConsoleRequestSender.InitializeExtensions: Initializing extensions with additional extensions path {string.Join(",", pathToAdditionalExtensions.ToArray())}.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an if check for EqtTrace Info enabled

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the build failed for linux

this.communicationManager.SendMessage(MessageType.ExtensionsInitialize, pathToAdditionalExtensions, this.protocolVersion);
}

/// <inheritdoc/>
public void DiscoverTests(IEnumerable<string> sources, string runSettings, TestPlatformOptions options, ITestDiscoveryEventsHandler2 eventHandler)
{
EqtTrace.Info("VsTestConsoleRequestSender.DiscoverTests: Starting test discovery.");
this.SendMessageAndListenAndReportTestCases(sources, runSettings, options, eventHandler);
}

Expand All @@ -146,12 +156,15 @@ public void DiscoverTests(IEnumerable<string> sources, string runSettings, TestP
/// </summary>
public async Task DiscoverTestsAsync(IEnumerable<string> sources, string runSettings, TestPlatformOptions options, ITestDiscoveryEventsHandler2 eventHandler)
{
EqtTrace.Info("VsTestConsoleRequestSender.DiscoverTestsAsync: Starting test discovery.");
await this.SendMessageAndListenAndReportTestCasesAsync(sources, runSettings, options, eventHandler);
}

/// <inheritdoc/>
public void StartTestRun(IEnumerable<string> sources, string runSettings, TestPlatformOptions options, ITestRunEventsHandler runEventsHandler)
{
EqtTrace.Info("VsTestConsoleRequestSender.StartTestRun: Starting test run.");

this.SendMessageAndListenAndReportTestResults(
MessageType.TestRunAllSourcesWithDefaultHost,
new TestRunRequestPayload() { Sources = sources.ToList(), RunSettings = runSettings, TestPlatformOptions = options },
Expand All @@ -162,6 +175,8 @@ public void StartTestRun(IEnumerable<string> sources, string runSettings, TestPl
/// <inheritdoc/>
public async Task StartTestRunAsync(IEnumerable<string> sources, string runSettings, TestPlatformOptions options, ITestRunEventsHandler runEventsHandler)
{
EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunAsync: Starting test run.");

await this.SendMessageAndListenAndReportTestResultsAsync(
MessageType.TestRunAllSourcesWithDefaultHost,
new TestRunRequestPayload() { Sources = sources.ToList(), RunSettings = runSettings, TestPlatformOptions = options },
Expand All @@ -172,6 +187,8 @@ public async Task StartTestRunAsync(IEnumerable<string> sources, string runSetti
/// <inheritdoc/>
public void StartTestRun(IEnumerable<TestCase> testCases, string runSettings, TestPlatformOptions options, ITestRunEventsHandler runEventsHandler)
{
EqtTrace.Info("VsTestConsoleRequestSender.StartTestRun: Starting test run.");

this.SendMessageAndListenAndReportTestResults(
MessageType.TestRunAllSourcesWithDefaultHost,
new TestRunRequestPayload() { TestCases = testCases.ToList(), RunSettings = runSettings, TestPlatformOptions = options },
Expand All @@ -182,6 +199,8 @@ public void StartTestRun(IEnumerable<TestCase> testCases, string runSettings, Te
/// <inheritdoc/>
public async Task StartTestRunAsync(IEnumerable<TestCase> testCases, string runSettings, TestPlatformOptions options, ITestRunEventsHandler runEventsHandler)
{
EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunAsync: Starting test run.");

await this.SendMessageAndListenAndReportTestResultsAsync(
MessageType.TestRunAllSourcesWithDefaultHost,
new TestRunRequestPayload() { TestCases = testCases.ToList(), RunSettings = runSettings, TestPlatformOptions = options },
Expand All @@ -197,6 +216,8 @@ public async Task StartTestRunAsync(IEnumerable<TestCase> testCases, string runS
ITestRunEventsHandler runEventsHandler,
ITestHostLauncher customHostLauncher)
{
EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHost: Starting test run.");

this.SendMessageAndListenAndReportTestResults(
MessageType.GetTestRunnerProcessStartInfoForRunAll,
new TestRunRequestPayload()
Expand All @@ -218,6 +239,8 @@ public async Task StartTestRunAsync(IEnumerable<TestCase> testCases, string runS
ITestRunEventsHandler runEventsHandler,
ITestHostLauncher customHostLauncher)
{
EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHostAsync: Starting test run.");

await this.SendMessageAndListenAndReportTestResultsAsync(
MessageType.GetTestRunnerProcessStartInfoForRunAll,
new TestRunRequestPayload()
Expand All @@ -234,6 +257,8 @@ public async Task StartTestRunAsync(IEnumerable<TestCase> testCases, string runS
/// <inheritdoc/>
public void StartTestRunWithCustomHost(IEnumerable<TestCase> testCases, string runSettings, TestPlatformOptions options, ITestRunEventsHandler runEventsHandler, ITestHostLauncher customHostLauncher)
{
EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHost: Starting test run.");

this.SendMessageAndListenAndReportTestResults(
MessageType.GetTestRunnerProcessStartInfoForRunSelected,
new TestRunRequestPayload
Expand All @@ -250,6 +275,8 @@ public void StartTestRunWithCustomHost(IEnumerable<TestCase> testCases, string r
/// <inheritdoc/>
public async Task StartTestRunWithCustomHostAsync(IEnumerable<TestCase> testCases, string runSettings, TestPlatformOptions options, ITestRunEventsHandler runEventsHandler, ITestHostLauncher customHostLauncher)
{
EqtTrace.Info("VsTestConsoleRequestSender.StartTestRunWithCustomHostAsync: Starting test run.");

await this.SendMessageAndListenAndReportTestResultsAsync(
MessageType.GetTestRunnerProcessStartInfoForRunSelected,
new TestRunRequestPayload()
Expand All @@ -266,18 +293,21 @@ public async Task StartTestRunWithCustomHostAsync(IEnumerable<TestCase> testCase
/// <inheritdoc/>
public void CancelTestRun()
{
EqtTrace.Info("VsTestConsoleRequestSender.CancelTestRun: Cancelling test run.");
this.communicationManager.SendMessage(MessageType.CancelTestRun);
}

/// <inheritdoc/>
public void AbortTestRun()
{
EqtTrace.Info("VsTestConsoleRequestSender.AbortTestRun: Aborting test run.");
this.communicationManager.SendMessage(MessageType.AbortTestRun);
}

/// <inheritdoc/>
public void CancelDiscovery()
{
EqtTrace.Info("VsTestConsoleRequestSender.CancelDiscovery: Cancelling test discovery.");
this.communicationManager.SendMessage(MessageType.CancelDiscovery);
}

Expand Down Expand Up @@ -328,7 +358,7 @@ private bool HandShakeWithVsTestConsole()
else if (message.MessageType == MessageType.ProtocolError)
{
// TODO : Payload for ProtocolError needs to finalized.
EqtTrace.Error("VsTestConsoleRequestSender.HandShakeWithVsTestConsole: Version Check failed. ProtolError was revceived from the runner");
EqtTrace.Error("VsTestConsoleRequestSender.HandShakeWithVsTestConsole: Version Check failed. ProtolError was received from the runner");
}
else
{
Expand Down Expand Up @@ -400,6 +430,8 @@ private void SendMessageAndListenAndReportTestCases(IEnumerable<string> sources,
}
else if (string.Equals(MessageType.DiscoveryComplete, message.MessageType))
{
EqtTrace.Info("VsTestConsoleRequestSender.SendMessageAndListenAndReportTestCases: Discovery complete.");

var discoveryCompletePayload =
this.dataSerializer.DeserializePayload<DiscoveryCompletePayload>(message);

Expand Down Expand Up @@ -461,6 +493,8 @@ private async Task SendMessageAndListenAndReportTestCasesAsync(IEnumerable<strin
}
else if (string.Equals(MessageType.DiscoveryComplete, message.MessageType))
{
EqtTrace.Info("VsTestConsoleRequestSender.SendMessageAndListenAndReportTestCasesAsync: Discovery complete.");

var discoveryCompletePayload =
this.dataSerializer.DeserializePayload<DiscoveryCompletePayload>(message);

Expand Down Expand Up @@ -520,6 +554,8 @@ private void SendMessageAndListenAndReportTestResults(string messageType, object
}
else if (string.Equals(MessageType.ExecutionComplete, message.MessageType))
{
EqtTrace.Info("VsTestConsoleRequestSender.SendMessageAndListenAndReportTestResults: Execution complete.");

var testRunCompletePayload =
this.dataSerializer.DeserializePayload<TestRunCompletePayload>(message);

Expand Down Expand Up @@ -578,6 +614,8 @@ private async Task SendMessageAndListenAndReportTestResultsAsync(string messageT
}
else if (string.Equals(MessageType.ExecutionComplete, message.MessageType))
{
EqtTrace.Info("VsTestConsoleRequestSender.SendMessageAndListenAndReportTestResultsAsync: Execution complete.");

var testRunCompletePayload =
this.dataSerializer.DeserializePayload<TestRunCompletePayload>(message);

Expand Down
Expand Up @@ -114,6 +114,8 @@ internal VsTestConsoleWrapper(ITranslationLayerRequestSender requestSender, IPro
/// <inheritdoc/>
public void StartSession()
{
EqtTrace.Info("VsTestConsoleWrapper.StartSession: Starting VsTestConsoleWrapper session.");

this.testPlatformEventSource.TranslationLayerInitializeStart();

// Start communication
Expand All @@ -140,6 +142,7 @@ public void StartSession()
public void InitializeExtensions(IEnumerable<string> pathToAdditionalExtensions)
{
this.EnsureInitialized();

this.pathToAdditionalExtensions = pathToAdditionalExtensions.ToList();
this.requestSender.InitializeExtensions(this.pathToAdditionalExtensions);
}
Expand Down Expand Up @@ -256,6 +259,8 @@ public void AbortTestRun()
/// <inheritdoc/>
public void EndSession()
{
EqtTrace.Info("VsTestConsoleWrapper.EndSession: Endinhg VsTestConsoleWrapper session");

this.requestSender.EndSession();
this.requestSender.Close();

Expand Down
Expand Up @@ -90,6 +90,8 @@ internal VsTestConsoleWrapperAsync(ITranslationLayerRequestSenderAsync requestSe
/// <inheritdoc/>
public async Task StartSessionAsync()
{
EqtTrace.Info("VsTestConsoleWrapperAsync.StartSessionAsync: Starting VsTestConsoleWrapper session");

this.testPlatformEventSource.TranslationLayerInitializeStart();

var timeout = EnvironmentHelper.GetConnectionTimeout();
Expand Down