-
Notifications
You must be signed in to change notification settings - Fork 331
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
Moving Desktop,& Dotnet runtime providers to separate dll #659
Conversation
Treating Using this dll as extension, to load appropriate runtimes for
@mayankbansal018, |
|
||
/// <summary> | ||
/// Implementation for TestPlatform | ||
/// </summary> | ||
public class TestPlatform : ITestPlatform | ||
{ | ||
private IFileHelper fileHelper; | ||
private readonly TestRuntimeProviderManager testHostProviderManager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: rename, maybe ?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Null check ?
…mayankbansal018/vstest-1 into desktop-dotnet-runtimeproviders
} | ||
|
||
EqtTrace.Verbose("ProcessHelper: Starting process '{0}' with command line '{1}'", processPath, arguments); | ||
// EqtTrace.Verbose("ProcessHelper: Starting process '{0}' with command line '{1}'", processPath, arguments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reason for removing diagnostics ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requires revert.
There was a problem hiding this comment.
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; } | ||
|
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be protected?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Request few changes.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Using this dll as extension, to load appropriate run-times for session