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

Moving Desktop,& Dotnet runtime providers to separate dll #659

Merged
merged 10 commits into from
Mar 31, 2017
Merged

Moving Desktop,& Dotnet runtime providers to separate dll #659

merged 10 commits into from
Mar 31, 2017

Conversation

mayankbansal018
Copy link
Contributor

Using this dll as extension, to load appropriate run-times for session

Treating Using this dll as extension, to load appropriate runtimes for
@msftclas
Copy link

@mayankbansal018,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot


/// <summary>
/// Implementation for TestPlatform
/// </summary>
public class TestPlatform : ITestPlatform
{
private IFileHelper fileHelper;
private readonly TestRuntimeProviderManager testHostProviderManager;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: rename, maybe ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do this in clean up PR. Have to rename lot of variables, & a few classes, & namespaces as well

/// <summary>
/// Initializes a new instance of the <see cref="TestPlatform"/> class.
/// </summary>
public TestPlatform() : this(new TestEngine(), new FileHelper())
public TestPlatform() : this(new TestEngine(), new FileHelper(), TestRuntimeProviderManager.Instance)
{
this.testHostProviderManager = TestRuntimeProviderManager.Instance;
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need this statement anymore.

@@ -58,7 +57,7 @@ public string GetDotnetHostFullPath()
}
}

string errorMessage = String.Format(Resources.NoDotnetExeFound, dotnetExeName);
string errorMessage = String.Empty; //String.Format(Resources.NoDotnetExeFound, dotnetExeName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please explain this change.
If it is required, we should clean it up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would need to add resource file for this project to accommodate for this resource.

Copy link
Contributor

Choose a reason for hiding this comment

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

It should be part of this PR please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved

@@ -66,7 +66,7 @@ public virtual int LaunchDataCollector(IDictionary<string, string> environmentVa

var argumentsString = string.Join(" ", commandLineArguments);

this.DataCollectorProcess = this.processHelper.LaunchProcess(dataCollectorProcessPath, argumentsString, processWorkingDirectory, environmentVariables, null, null);
this.DataCollectorProcess = this.processHelper.LaunchProcess(dataCollectorProcessPath, argumentsString, processWorkingDirectory, environmentVariables, null, null) as Process;
return this.DataCollectorProcess.Id;
Copy link
Contributor

Choose a reason for hiding this comment

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

Null check ?

}

EqtTrace.Verbose("ProcessHelper: Starting process '{0}' with command line '{1}'", processPath, arguments);
// EqtTrace.Verbose("ProcessHelper: Starting process '{0}' with command line '{1}'", processPath, arguments);
Copy link
Contributor

Choose a reason for hiding this comment

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

Reason for removing diagnostics ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Need to add back in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

limitation since platform abstraction cannot take dependency on coreutils, which contain eqttrace implementation

{
if (process.HasExited)
var proc = process as Process;
Copy link
Contributor

Choose a reason for hiding this comment

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

null check here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="Microsoft.TestPlatform.VSIX.Microsoft.0e51abf6-9f5f-401e-a812-4043b87acabf" Version="$version$" Language="en-US" Publisher="Microsoft" />
<Identity Id="Microsoft.TestPlatform.VSIX.Microsoft.0e51abf6-9f5f-401e-a812-4043b87acabf" Version="15.1.0" Language="en-US" Publisher="Microsoft" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this intentional ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Requires revert.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved

public event EventHandler<HostProviderEventArgs> HostExited;

public bool Shared { get; private set; }

Copy link
Contributor

@singhsarab singhsarab Mar 27, 2017

Choose a reason for hiding this comment

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

nit: extra line

@@ -257,6 +257,16 @@ function Publish-Package
Write-Verbose "Move-Item $coreCLR20PackageDir\$file $coreCLRExtensionsDir -Force"
Move-Item $coreCLR20PackageDir\$file $coreCLRExtensionsDir -Force
}

# Note Note: If there are some dependencies for the TestHostProvider assemblies, those need to be moved too.
$runtimeproviders = @("Microsoft.TestPlatform.TestHostProvider.dll", "Microsoft.TestPlatform.TestHostProvider.pdb")
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to keep the name generic? Should the name say that these are NET runtime providers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

clean up

/// <param name="testHostProviderManager">
/// The data.
/// </param>
internal TestPlatform(ITestEngine testEngine, IFileHelper filehelper, TestRuntimeProviderManager testHostProviderManager)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not protected? We already use the Testable approach for the unit tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved

@@ -6,7 +6,7 @@ namespace Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.Interfaces
/// <summary>
/// Helper class for getting info about dotnet host.
/// </summary>
internal interface IDotnetHostHelper
public interface IDotnetHostHelper
Copy link
Contributor

Choose a reason for hiding this comment

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

Why should this be public? I would suggest moving this into TestHostProvider implementation.

We need to discuss how DataCollector can consume this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

leaving here for now, may be clean up later

private ITestExtensionManager testExtensionManager;

#endregion

public TestEngine() : this(TestRuntimeProviderManager.Instance)
Copy link
Contributor

Choose a reason for hiding this comment

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

Require doc.

{
}

internal TestEngine(TestRuntimeProviderManager testHostProviderManager)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be protected?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved

/// </returns>
public ITestRuntimeProvider GetDefaultTestHostManager(RunConfiguration runConfiguration)
/// <inheritdoc/>
public ITestRuntimeProvider GetDefaultTestHostManager(string runSettingsXml)
Copy link
Contributor

Choose a reason for hiding this comment

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

May be this need not be an interface method? It's not getting the Default test host manager, it just gets the runtime provider which can understand a runsettings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it gets the appropriate runtime provider for current settings, but I let it be in Interface since that would require a lot of test changes as well

Copy link
Contributor

Choose a reason for hiding this comment

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

All the test changes should be in one test class, right? It is a smell if it require changes to multiple entities.


/// <summary>
/// Helper class to deal with process related functionality.
/// </summary>
internal class ProcessHelper : IProcessHelper
public class ProcessHelper : IProcessHelper
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it help to make this IProcessHelper<T>? If the consumer is aware of Process, it may as well call the ProcessHelper<Process> (may be do not require to do type casts).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can be taken in separate PR

@@ -19,6 +19,7 @@ namespace TestPlatform.CrossPlatEngine.UnitTests.Hosting
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Host;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Helpers.Interfaces;
Copy link
Contributor

Choose a reason for hiding this comment

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

These tests should move out to TestPlatformProvider.UnitTests. Kindly enable static analysis on new project.

using Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client.Interfaces;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Host;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Helpers.Interfaces;
Copy link
Contributor

Choose a reason for hiding this comment

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

Tests need to move out of crossplatengine.

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Helpers
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if there should be any Helper in the namespace. Process abstraction directly belongs to PlatformAbstractions since it is a platform specific concept?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved

Copy link
Contributor

@codito codito left a comment

Choose a reason for hiding this comment

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

Request few changes.

@codito
Copy link
Contributor

codito commented Mar 30, 2017

New assembly should be added to sign.proj.

Refactoring tests
Removing API to get test runtime provider from TestEngine
/// <summary>
/// Initializes a new instance of the <see cref="TestPlatform"/> class.
/// </summary>
public TestPlatform() : this(new TestEngine(), new FileHelper())
public TestPlatform() : this(new TestEngine(), new FileHelper(), TestRuntimeProviderManager.Instance)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm super confused: Whose responsibility is the TestRuntimeProvider? Not the engine's anymore? How would this look if another engine came in instead of the CrossPlatEngine? Is that even interesting anymore? We might need a doc for this please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The responsibility to provide TestRuntime, is moved to TestRuntimeProviderManager, which for a given session identifies all available TestRuntime, for instance (Desktop, DotNet), & then returns back a particular instance of Runtime, which would work for current settings.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. And is this tied to the test engine in any way? What happens if a substitute engine wants to provide its own host process as a default?(say TAEF) Is that supported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, If Taef wants to be the test runtime(i.e replace testhost), then they can provide their runtime whose job is to understand how to launch TAEF, once that is discovered, Taef can continue to host our crossplat engine to do the communication, & running test work, or they can implement their own communication framework which understands the protocol send across wire.

@mayankbansal018 mayankbansal018 merged commit 876f819 into microsoft:master Mar 31, 2017
@mayankbansal018 mayankbansal018 deleted the desktop-dotnet-runtimeproviders branch March 31, 2017 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants