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

Run multiple target frameworks and architectures in single vstest.console #3412

Merged
merged 142 commits into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
f70b70b
Add test
nohwnd Feb 22, 2022
91c2628
Merge branch 'main' into multi-tfm-run-in-vstestconsole
nohwnd Feb 22, 2022
a1c9028
Passthru options. Discover request needs to fix settings on criteria …
nohwnd Feb 23, 2022
409cca3
Discovery partially works, I don't update the testsettings in the req…
nohwnd Feb 23, 2022
8e5a289
Add tests for run and discovery with different TFMs.
nohwnd Feb 24, 2022
8ce64ae
First test rewrite.
nohwnd Feb 24, 2022
5d2f4ee
test sessions start
nohwnd Feb 24, 2022
8ec7a91
Manually test console mode a little bit
nohwnd Feb 25, 2022
21eee17
Add nested types and split up
nohwnd Feb 25, 2022
6549db9
Test sessions, and rework a bit
nohwnd Mar 1, 2022
3ca787d
Fix programmer tests
nohwnd Mar 1, 2022
2a85b51
Merge branch 'main' into multi-tfm-run-in-vstestconsole
nohwnd Mar 1, 2022
14e66d8
Skip source validation and enable checks
nohwnd Mar 1, 2022
a8f5da8
Fix settings check in test sessions, and remove rest of review points
nohwnd Mar 1, 2022
dbfdcd3
Fixing tests
nohwnd Mar 2, 2022
a487325
Fix some unit tests
nohwnd Mar 2, 2022
88ae4ad
Unit tests fixed
nohwnd Mar 2, 2022
d7c059c
Build
nohwnd Mar 2, 2022
4d8054d
Merge branch 'main' into multi-tfm-run-in-vstestconsole
nohwnd Mar 2, 2022
9e1f93a
Apply suggestions from code review
nohwnd Mar 3, 2022
1d35dc5
Update src/Microsoft.TestPlatform.CrossPlatEngine/Utilities/SourceDet…
nohwnd Mar 3, 2022
66283a0
Merge branch 'main' into multi-tfm-run-in-vstestconsole
nohwnd Mar 3, 2022
dfb2e81
Fix acceptance tests.
nohwnd Mar 4, 2022
aff2f4a
Apply suggestions from code review
nohwnd Mar 4, 2022
83a9fc6
Remove more workspace
nohwnd Mar 4, 2022
07e4782
Merge branch 'fix-acceptance' of https://github.com/nohwnd/vstest int…
nohwnd Mar 4, 2022
7536588
Revert non-optmize on Release
nohwnd Mar 4, 2022
a94b1bd
More fixes
nohwnd Mar 4, 2022
ef668f0
Update test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBase.cs
nohwnd Mar 4, 2022
4fb3b26
Merge branch 'main' into fix-acceptance
nohwnd Mar 4, 2022
8b04531
Fix unit test
nohwnd Mar 4, 2022
e57fe1d
Missing null operator
nohwnd Mar 4, 2022
98fa6b9
Revert incorrect rename
nohwnd Mar 4, 2022
6342ee4
Fix review remarks
nohwnd Mar 4, 2022
4f95d81
Build failures
nohwnd Mar 4, 2022
0f53078
Merge branch 'main' into multi-tfm-run-in-vstestconsole
nohwnd Mar 4, 2022
b62a26d
Upgrade
nohwnd Mar 4, 2022
c7de6ad
Merge branch 'fix-acceptance' into net6-tests
nohwnd Mar 4, 2022
f15ade9
Upgrade tests
nohwnd Mar 4, 2022
115b842
Merge branch 'main' into net6-tests
nohwnd Mar 4, 2022
100b4dd
Skip web tests locally
nohwnd Mar 4, 2022
cdaf3d0
Apply suggestions from code review
nohwnd Mar 4, 2022
390d80b
Skip in non-ci
nohwnd Mar 4, 2022
543c21c
Change order of tests to run from fastest
nohwnd Mar 4, 2022
76021d2
Newer approach to reference assemblies on MacOS and Linux
nohwnd Mar 7, 2022
4a79dc0
Merge branch 'newer-reference-assemblies' into net6-tests
nohwnd Mar 7, 2022
de7aefc
Revert "Change order of tests to run from fastest"
nohwnd Mar 7, 2022
1bddbc8
Acceptance for net48
nohwnd Mar 7, 2022
c4e7ff1
Fix filter
nohwnd Mar 7, 2022
bbd4473
Apply suggestions from code review
nohwnd Mar 7, 2022
7c6d946
Update scripts/build/TestPlatform.Settings.targets
nohwnd Mar 7, 2022
f38616a
Remove taking target framework and runtime from env variables because…
nohwnd Mar 7, 2022
c9dbf4e
Matrix for mstest wip
nohwnd Mar 9, 2022
79117c9
Merge branch 'main' into test-matrix
nohwnd Mar 9, 2022
ecdb18e
MSTest adapter tests
nohwnd Mar 10, 2022
a65c00a
Add vstest console data source, even though it is names translation l…
nohwnd Mar 10, 2022
0fc39cf
Second test
nohwnd Mar 11, 2022
3b14bb4
Merge branch 'main' into test-matrix
nohwnd Mar 11, 2022
aaecf7f
Remove unused field
nohwnd Mar 11, 2022
82cb607
Translation layer x vstest.console
nohwnd Mar 11, 2022
07cdf1c
Fixup console run
nohwnd Mar 14, 2022
1b0202a
Runs tests from the big data source, but test sdk is not used.
nohwnd Mar 14, 2022
d556525
Compose path to testhost + adapter.
nohwnd Mar 14, 2022
d243b59
One big unified data source. Still no version filtering.
nohwnd Mar 15, 2022
1d22cd9
Remove quote path trimming.
nohwnd Mar 16, 2022
82ad320
Some tests run.
nohwnd Mar 16, 2022
5216498
More fun with sources.
nohwnd Mar 16, 2022
0f087c0
Tests tests.
nohwnd Mar 17, 2022
63e6275
Merge branch 'main' into test-matrix
nohwnd Mar 21, 2022
1a45042
merge
nohwnd Mar 21, 2022
6e84158
Revert unnecessary renames
nohwnd Mar 21, 2022
2b3e039
Ignore strong naming in tests
nohwnd Mar 21, 2022
5987391
Add tags
nohwnd Mar 21, 2022
0e4ce5a
Fix console path
nohwnd Mar 21, 2022
969c2b3
fix
nohwnd Mar 22, 2022
8423de3
merge main
nohwnd Mar 22, 2022
9894fa3
CI cleanup always
nohwnd Mar 22, 2022
5af7437
Print free disk space
nohwnd Mar 23, 2022
81c0b1b
Whitespace and so on
nohwnd Mar 23, 2022
eff69de
Missing temp dir
nohwnd Mar 23, 2022
874f1c2
Merge branch 'main' into test-matrix
nohwnd Mar 23, 2022
5f3f5c2
Fix env variables
nohwnd Mar 23, 2022
a1a461c
Fixes I feel like I did before
nohwnd Mar 23, 2022
5a19d19
Touch
nohwnd Mar 23, 2022
df6a0f2
Merged
nohwnd Mar 23, 2022
0075b0b
Remove comment, and revert back to using TempDirectory
nohwnd Mar 24, 2022
85085dc
Fix quoting
nohwnd Mar 24, 2022
efc810f
Use Nuget.Versioning rather than semver, and revert strong name warni…
nohwnd Mar 24, 2022
02c7d41
Fix tests
nohwnd Mar 28, 2022
6bb4103
Merge branch 'test-matrix' into multi-tfm-run-in-vstestconsole
nohwnd Mar 28, 2022
57be8db
Fix test
nohwnd Mar 28, 2022
ab3093f
Fix
nohwnd Mar 28, 2022
b1e02f5
Fix
nohwnd Mar 28, 2022
3e637fc
Merge branch 'test-matrix' of https://github.com/nohwnd/vstest into t…
nohwnd Mar 28, 2022
a828bbc
Merge branch 'test-matrix' into multi-tfm-run-in-vstestconsole
nohwnd Mar 28, 2022
d33a3f2
Fix build
nohwnd Mar 28, 2022
2ac14cb
Free space
nohwnd Mar 28, 2022
020abf0
Free space
nohwnd Mar 28, 2022
55e8714
Add results directory to blame
nohwnd Mar 28, 2022
ebb15a1
Fix
nohwnd Mar 28, 2022
8c0cc0c
Add tools and fix gitingore
nohwnd Mar 29, 2022
23b5f66
Fix build
nohwnd Mar 28, 2022
1d9003c
Add tools and fix gitingore
nohwnd Mar 29, 2022
a8e8476
Merge branch 'main' into test-matrix
nohwnd Mar 29, 2022
25c5802
Make Cancel Discovery faster and more reliable
nohwnd Mar 29, 2022
0e063a4
Merge branch 'discovery-cancel-faster-better-more-reliable' into test…
nohwnd Mar 29, 2022
4dd10bc
Add fluent assertions
nohwnd Mar 29, 2022
fd235c1
Cancellation
nohwnd Mar 29, 2022
68c4e4a
Merge
nohwnd Mar 29, 2022
70f4e81
Merge branch 'test-matrix' into multi-tfm-run-in-vstestconsole
nohwnd Mar 29, 2022
b346a3e
Renames and fixes
nohwnd Mar 29, 2022
5e81462
Merge branch 'main' into multi-tfm-run-in-vstestconsole
nohwnd Mar 29, 2022
a24d1b1
Add debugger info
nohwnd May 12, 2022
6e0ef0a
Merged
nohwnd May 12, 2022
6933548
Half merged but is missing some test fixes
nohwnd May 12, 2022
65e1e0f
Programmer tests build and run, I think I left some not passing befor…
nohwnd May 12, 2022
0b25dff
Try with test sessions
nohwnd May 12, 2022
0f1e8bd
Fix programmer tests and add DISABLE_MULTI_TFM
nohwnd May 12, 2022
f7b8e94
Re-enable warnings for multtfm when there are settings forcing framew…
nohwnd May 12, 2022
095345d
Merge branch 'main' into multi-tfm-run-in-vstestconsole
nohwnd May 13, 2022
08d86c4
Smaller PR comments addressed
nohwnd May 13, 2022
3c22472
Rewrite ParallelOperationManagerTests because that class fully changed
nohwnd May 13, 2022
d624583
Fix build warnings
nohwnd May 13, 2022
da6150c
Remove test checking that we set custom launcher on default runtime p…
nohwnd May 13, 2022
f997480
Fix NOMERGE unit tests
nohwnd May 13, 2022
8734b3a
Fix runsettings tests
nohwnd May 13, 2022
2980a29
More unit tests
nohwnd May 13, 2022
94bc0f1
Fix more unit tests
nohwnd May 13, 2022
2f6c67a
Fix unit test
nohwnd May 13, 2022
08506a8
Update resources
nohwnd May 16, 2022
750c8bb
Fix collection modified exception
nohwnd May 16, 2022
fe4218e
Don't return true where you should not
nohwnd May 16, 2022
a6dbcf2
Fix assignment
nohwnd May 17, 2022
dbb04f6
Fix tests
nohwnd May 17, 2022
d6d47a5
up versions for matrix
nohwnd May 17, 2022
902e435
More PR feedbacks
nohwnd May 17, 2022
5e2f9b0
up internal version and remove debug attribute
nohwnd May 17, 2022
287b4e6
yah for the extra parent
nohwnd May 17, 2022
7dcf780
Fix testhost startup performance and choosing x86 for mixed runs.
nohwnd May 18, 2022
da0cbdf
Clean up HandlePartialRunComplete, and fix unit tests
nohwnd May 19, 2022
6e49ebe
Fix acceptance tests
nohwnd May 19, 2022
6f5bedb
Merge branch 'main' into multi-tfm-run-in-vstestconsole
nohwnd May 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion playground/MSTest1/MSTest1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
<Import Project="$(TestPlatformRoot)scripts/build/TestPlatform.Settings.targets" />

<PropertyGroup>
<TargetFrameworks Condition=" '$(OS)' == 'WINDOWS_NT' ">$(TargetFrameworks);net472</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'WINDOWS_NT' ">$(TargetFrameworks);net472;net5.0</TargetFrameworks>
<!-- We build this on linux as well, and are including ref assemblies for this framework only. -->
<TargetFrameworks Condition=" '$(OS)' != 'WINDOWS_NT' ">$(TargetFrameworks);net451</TargetFrameworks>
<Prefer32Bit>false</Prefer32Bit>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
3 changes: 3 additions & 0 deletions playground/MSTest1/UnitTest1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@

namespace MSTest1;

using Microsoft.VisualStudio.TestTools.UnitTesting;

[TestClass]
nohwnd marked this conversation as resolved.
Show resolved Hide resolved
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
// Thread.Sleep(1000);
}
}
25 changes: 22 additions & 3 deletions playground/TestPlatform.Playground/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,34 @@ static void Main(string[] args)
<RunSettings>
<RunConfiguration>
<InIsolation>true</InIsolation>
<MaxCpuCount>4</MaxCpuCount>
</RunConfiguration>
</RunSettings>
";

var sources = new[] {
Path.Combine(playground, "MSTest1", "bin", "Debug", "net472", "MSTest1.dll")
Path.Combine(playground, "MSTest1", "bin", "Debug", "net472", "MSTest1.dll"),
Path.Combine(playground, "MSTest1", "bin", "Debug", "net5.0", "MSTest1.dll"),
@"C:\Users\jajares\source\repos\TestProject48\TestProject48\bin\Debug\net48\TestProject48.dll",
@"C:\Users\jajares\source\repos\TestProject48\TestProject1\bin\x64\Debug\net48\win10-x64\TestProject1.dll"
};

var options = new TestPlatformOptions();
r.RunTestsWithCustomTestHost(sources, sourceSettings, options, new TestRunHandler(), new DebuggerTestHostLauncher());
// console mode
var settingsFile = Path.GetTempFileName();
try
{

nohwnd marked this conversation as resolved.
Show resolved Hide resolved
File.WriteAllText(settingsFile, sourceSettings);
Process.Start(console, string.Join(" ", sources) + " --settings:" + settingsFile).WaitForExit();
}
finally
{
try { File.Delete(settingsFile); } catch { }
}

// design mode
// var options = new TestPlatformOptions();
// r.RunTestsWithCustomTestHost(sources, sourceSettings, options, new TestRunHandler(), new DebuggerTestHostLauncher());
}

public class TestRunHandler : ITestRunEventsHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"VSTEST_CONNECTION_TIMEOUT": "999",
"VSTEST_DEBUG_NOBP": "1",
"VSTEST_RUNNER_DEBUG_ATTACHVS": "1",
"VSTEST_HOST_DEBUG_ATTACHVS": "1",
"VSTEST_HOST_DEBUG_ATTACHVS": "0",
"VSTEST_DATACOLLECTOR_DEBUG_ATTACHVS": "1"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition=" '$(OS)' == 'WINDOWS_NT' ">
<Exec Command="xcopy /i /y $(MSBuildProjectDirectory)\..\..\src\vstest.console\bin\$(Configuration)\net451\win7-x64\ $(TargetDir)\vstest.console\&#xD;&#xA;xcopy /i /y $(MSBuildProjectDirectory)\..\..\src\testhost\bin\$(Configuration)\net451\win7-x64\ $(TargetDir)\vstest.console\&#xD;&#xA;xcopy /i /y $(MSBuildProjectDirectory)\..\..\src\Microsoft.TestPlatform.TestHostProvider\bin\$(Configuration)\net451\ $(TargetDir)\vstest.console\Extensions\&#xD;&#xA;xcopy /i /y $(MSBuildProjectDirectory)\..\..\src\testhost.x86\bin\$(Configuration)\net472\win7-x86 $(TargetDir)\vstest.console\TestHost\" />
<Exec Command="xcopy /i /y $(MSBuildProjectDirectory)\..\..\src\vstest.console\bin\$(Configuration)\net451\win7-x64\ $(TargetDir)\vstest.console\&#xD;&#xA;xcopy /i /y $(MSBuildProjectDirectory)\..\..\src\testhost\bin\$(Configuration)\net451\win7-x64\ $(TargetDir)\vstest.console\&#xD;&#xA;xcopy /i /y $(MSBuildProjectDirectory)\..\..\src\Microsoft.TestPlatform.TestHostProvider\bin\$(Configuration)\net451\ $(TargetDir)\vstest.console\Extensions\&#xD;&#xA;xcopy /i /y $(MSBuildProjectDirectory)\..\..\src\testhost.x86\bin\$(Configuration)\net472\win7-x86 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y $(MSBuildProjectDirectory)\..\..\src\testhost.x86\bin\$(Configuration)\net48\win7-x86 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;REM x64 &#xD;&#xA;xcopy /i /y $(MSBuildProjectDirectory)\..\..\src\testhost\bin\$(Configuration)\net472\win7-x64 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y $(MSBuildProjectDirectory)\..\..\src\testhost\bin\$(Configuration)\net48\win7-x64 $(TargetDir)\vstest.console\TestHost\" />
</Target>
<Import Project="$(TestPlatformRoot)scripts\build\TestPlatform.targets" />
</Project>
8 changes: 8 additions & 0 deletions src/AttachVS/AttachVs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ private static bool AttachVs(Process vs, int pid)
Trace($"ComException: Retrying in 250ms.\n{ex}");
Thread.Sleep(250);
}
catch (TargetInvocationException ex)
Copy link
Member

Choose a reason for hiding this comment

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

[minor] You could merge with previous catch with something like catch (Exception ex) when (ex is COMException || ex is TargetInvocationException tie && tie.InnerException is COMException).

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you really like the proposed code better than what is there now?

Copy link
Member

Choose a reason for hiding this comment

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

I just like the fact that if we change one block we won't forget the other one :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok changed.

{
if (ex.InnerException is not COMException)
throw;

Trace($"ComException: Retrying in 250ms.\n{ex}");
Thread.Sleep(250);
}
}
Marshal.ReleaseComObject(moniker[0]);

Expand Down
36 changes: 9 additions & 27 deletions src/Microsoft.TestPlatform.Client/TestPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,16 @@ protected internal TestPlatform(
public IDiscoveryRequest CreateDiscoveryRequest(
IRequestData requestData,
DiscoveryCriteria discoveryCriteria!!,
TestPlatformOptions options)
TestPlatformOptions options,
Dictionary<string, SourceDetail> sourceToSourceDetailMap)
{
PopulateExtensions(discoveryCriteria.RunSettings, discoveryCriteria.Sources);

// Initialize loggers.
ITestLoggerManager loggerManager = TestEngine.GetLoggerManager(requestData);
loggerManager.Initialize(discoveryCriteria.RunSettings);

ITestRuntimeProvider testHostManager = _testHostProviderManager.GetTestHostManagerByRunConfiguration(discoveryCriteria.RunSettings);
TestPlatform.ThrowExceptionIfTestHostManagerIsNull(testHostManager, discoveryCriteria.RunSettings);

testHostManager.Initialize(TestSessionMessageLogger.Instance, discoveryCriteria.RunSettings);

IProxyDiscoveryManager discoveryManager = TestEngine.GetDiscoveryManager(requestData, testHostManager, discoveryCriteria);
IProxyDiscoveryManager discoveryManager = TestEngine.GetDiscoveryManager(requestData, discoveryCriteria, sourceToSourceDetailMap);
discoveryManager.Initialize(options?.SkipDefaultAdapters ?? false);

return new DiscoveryRequest(requestData, discoveryCriteria, discoveryManager, loggerManager);
Expand All @@ -108,7 +104,8 @@ public IDiscoveryRequest CreateDiscoveryRequest(
public ITestRunRequest CreateTestRunRequest(
IRequestData requestData,
TestRunCriteria testRunCriteria!!,
TestPlatformOptions options)
TestPlatformOptions options,
Dictionary<string, SourceDetail> sourceToSourceDetailMap)
{
IEnumerable<string> sources = GetSources(testRunCriteria);
PopulateExtensions(testRunCriteria.TestRunSettings, sources);
Expand All @@ -117,23 +114,7 @@ public ITestRunRequest CreateTestRunRequest(
ITestLoggerManager loggerManager = TestEngine.GetLoggerManager(requestData);
loggerManager.Initialize(testRunCriteria.TestRunSettings);

// TODO: PERF: this will create a testhost manager, and then it will pass that to GetExecutionManager, where it will
// be used only when we will run in-process. If we don't run in process, we will throw away the manager we just
// created and let the proxy parallel callbacks to create a new one. This seems to be very easy to move to the GetExecutionManager,
// and safe as well, so we create the manager only once.
// TODO: Of course TestEngine.GetExecutionManager is public api...
ITestRuntimeProvider testHostManager = _testHostProviderManager.GetTestHostManagerByRunConfiguration(testRunCriteria.TestRunSettings);
TestPlatform.ThrowExceptionIfTestHostManagerIsNull(testHostManager, testRunCriteria.TestRunSettings);

testHostManager.Initialize(TestSessionMessageLogger.Instance, testRunCriteria.TestRunSettings);

// NOTE: The custom launcher should not be set when we have test session info available.
if (testRunCriteria.TestHostLauncher != null)
{
testHostManager.SetCustomLauncher(testRunCriteria.TestHostLauncher);
}

IProxyExecutionManager executionManager = TestEngine.GetExecutionManager(requestData, testHostManager, testRunCriteria);
IProxyExecutionManager executionManager = TestEngine.GetExecutionManager(requestData, testRunCriteria, sourceToSourceDetailMap);
executionManager.Initialize(options?.SkipDefaultAdapters ?? false);

return new TestRunRequest(requestData, testRunCriteria, executionManager, loggerManager);
Expand All @@ -143,7 +124,8 @@ public ITestRunRequest CreateTestRunRequest(
public bool StartTestSession(
IRequestData requestData,
StartTestSessionCriteria testSessionCriteria!!,
ITestSessionEventsHandler eventsHandler)
ITestSessionEventsHandler eventsHandler,
Dictionary<string, SourceDetail> sourceToSourceDetailMap)
{
RunConfiguration runConfiguration = XmlRunSettingsUtilities.GetRunConfigurationNode(testSessionCriteria.RunSettings);
TestAdapterLoadingStrategy strategy = runConfiguration.TestAdapterLoadingStrategy;
Expand All @@ -155,7 +137,7 @@ public bool StartTestSession(
return false;
}

IProxyTestSessionManager testSessionManager = TestEngine.GetTestSessionManager(requestData, testSessionCriteria);
IProxyTestSessionManager testSessionManager = TestEngine.GetTestSessionManager(requestData, testSessionCriteria, sourceToSourceDetailMap);
if (testSessionManager == null)
{
// The test session manager is null because the combination of runsettings and
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// 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.Collections.Generic;

using Microsoft.VisualStudio.TestPlatform.ObjectModel.Host;

namespace Microsoft.VisualStudio.TestPlatform.Common.Hosting;

internal interface ITestRuntimeProviderManager
{
ITestRuntimeProvider GetTestHostManagerByRunConfiguration(string runConfiguration);
ITestRuntimeProvider GetTestHostManagerByRunConfiguration(string runConfiguration, List<string> sources);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe ICollection<string> or IReadOnlyCollection<string>? Or IList/IReadonlyList if we need the indexer.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is an internal interface; I don't want to gold plate it. Keeping as is, unless you feel strongly about this.

ITestRuntimeProvider GetTestHostManagerByUri(string hostUri);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Microsoft.VisualStudio.TestPlatform.Common.Logging;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Host;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using System.Collections.Generic;
nohwnd marked this conversation as resolved.
Show resolved Hide resolved

#nullable disable

Expand Down Expand Up @@ -44,7 +45,7 @@ public ITestRuntimeProvider GetTestHostManagerByUri(string hostUri)
return host?.Value;
}

public virtual ITestRuntimeProvider GetTestHostManagerByRunConfiguration(string runConfiguration)
public virtual ITestRuntimeProvider GetTestHostManagerByRunConfiguration(string runConfiguration, List<string> _)
{
foreach (var testExtension in _testHostExtensionManager.TestExtensions)
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine;
/// <summary>
/// Interface defining the parallel discovery manager
/// </summary>
public interface IParallelProxyDiscoveryManager : IParallelOperationManager, IProxyDiscoveryManager
public interface IParallelProxyDiscoveryManager : IProxyDiscoveryManager
{
/// <summary>
/// Indicates if user requested an abortion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Microsoft.VisualStudio.TestPlatform.ObjectModel.Engine;
/// <summary>
/// Interface defining the parallel execution manager
/// </summary>
public interface IParallelProxyExecutionManager : IParallelOperationManager, IProxyExecutionManager
public interface IParallelProxyExecutionManager : IProxyExecutionManager
{
/// <summary>
/// Handles Partial Run Complete event coming from a specific concurrent proxy execution manager
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// 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.Collections.Generic;

using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;

using Microsoft.VisualStudio.TestPlatform.ObjectModel.Host;
Expand Down Expand Up @@ -28,8 +30,8 @@ public interface ITestEngine
/// <returns>An IProxyDiscoveryManager object that can do discovery.</returns>
IProxyDiscoveryManager GetDiscoveryManager(
IRequestData requestData,
ITestRuntimeProvider testHostManager,
DiscoveryCriteria discoveryCriteria);
DiscoveryCriteria discoveryCriteria,
Dictionary<string, SourceDetail> sourceToSourceDetailMap);
nohwnd marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Fetches the ExecutionManager for this engine. This manager would provide all
Expand All @@ -45,8 +47,8 @@ IProxyDiscoveryManager GetDiscoveryManager(
/// <returns>An IProxyExecutionManager object that can do execution.</returns>
IProxyExecutionManager GetExecutionManager(
IRequestData requestData,
ITestRuntimeProvider testHostManager,
TestRunCriteria testRunCriteria);
TestRunCriteria testRunCriteria,
Dictionary<string, SourceDetail> sourceToSourceDetailMap);
nohwnd marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Fetches the TestSessionManager for this engine. This manager would provide all
Expand All @@ -63,7 +65,8 @@ IProxyExecutionManager GetExecutionManager(
/// <returns>An IProxyTestSessionManager object that can manage test sessions.</returns>
IProxyTestSessionManager GetTestSessionManager(
IRequestData requestData,
StartTestSessionCriteria testSessionCriteria);
StartTestSessionCriteria testSessionCriteria,
Dictionary<string, SourceDetail> sourceToSourceDetailMap);
nohwnd marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Fetches the extension manager for this engine. This manager would provide extensibility
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Microsoft.VisualStudio.TestPlatform.Utilities;
// !!! FEATURES MUST BE KEPT IN SYNC WITH https://github.com/dotnet/sdk/blob/main/src/Cli/dotnet/commands/dotnet-test/VSTestFeatureFlag.cs !!!
internal partial class FeatureFlag : IFeatureFlag
internal sealed class FeatureFlag : IFeatureFlag
{
private static readonly Dictionary<string, bool> FeatureFlags = new();

Expand All @@ -18,18 +18,40 @@ internal partial class FeatureFlag : IFeatureFlag

static FeatureFlag()
{
#pragma warning disable CS0618 // Type or member is obsolete
Reset();
#pragma warning restore CS0618 // Type or member is obsolete
}

[Obsolete("Use this only from tests, and ctor.")]
internal static void Reset()
{
FeatureFlags.Clear();
FeatureFlags.Add(ARTIFACTS_POSTPROCESSING, true);
FeatureFlags.Add(ARTIFACTS_POSTPROCESSING_SDK_KEEP_OLD_UX, false);
FeatureFlags.Add(MULTI_TFM_RUN, true);
}

// Added for artifact porst-processing, it enable/disable the post processing.
[Obsolete("Use this only from tests.")]
internal static void SetFlag(string name, bool value)
{
if (!FeatureFlags.ContainsKey(name))
throw new ArgumentException($"Feature flag {name} is a known feature flag.");
nohwnd marked this conversation as resolved.
Show resolved Hide resolved

FeatureFlags[name] = value;
}

// Added for artifact post-processing, it enable/disable the post processing.
// Added in 17.2-preview 7.0-preview
public static string ARTIFACTS_POSTPROCESSING = VSTEST_FEATURE + "_" + "ARTIFACTS_POSTPROCESSING";
public static string ARTIFACTS_POSTPROCESSING = VSTEST_FEATURE + "_" + nameof(ARTIFACTS_POSTPROCESSING);
nohwnd marked this conversation as resolved.
Show resolved Hide resolved

// Added for artifact porst-processing, it will show old output for dotnet sdk scenario.
// Added for artifact post-processing, it will show old output for dotnet sdk scenario.
// It can be useful if we need to restore old UX in case users are parsing the console output.
// Added in 17.2-preview 7.0-preview
public static string ARTIFACTS_POSTPROCESSING_SDK_KEEP_OLD_UX = VSTEST_FEATURE + "_" + "ARTIFACTS_POSTPROCESSING_SDK_KEEP_OLD_UX";
public static string ARTIFACTS_POSTPROCESSING_SDK_KEEP_OLD_UX = VSTEST_FEATURE + "_" + nameof(ARTIFACTS_POSTPROCESSING_SDK_KEEP_OLD_UX);
nohwnd marked this conversation as resolved.
Show resolved Hide resolved

// Allow vstest.console to sources from multiple TFMs
public static string MULTI_TFM_RUN = VSTEST_FEATURE + "_" + nameof(MULTI_TFM_RUN);
nohwnd marked this conversation as resolved.
Show resolved Hide resolved

// For now we're checking env var.
// We could add it also to some section inside the runsettings.
Expand Down
3 changes: 3 additions & 0 deletions src/Microsoft.TestPlatform.CoreUtilities/Friends.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("vstest.console, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]


nohwnd marked this conversation as resolved.
Show resolved Hide resolved
[assembly: InternalsVisibleTo("vstest.ProgrammerTests, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
Loading