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

In-process vstest.console #3728

Merged
merged 28 commits into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Use dotnet console
  • Loading branch information
nohwnd committed May 26, 2022
commit f3203ae95555ab4012b424ab35b19a12326ed93f
9 changes: 5 additions & 4 deletions playground/TestPlatform.Playground/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ static void Main(string[] args)
var here = Path.GetDirectoryName(thisAssemblyPath);
var playground = Path.GetFullPath(Path.Combine(here, "..", "..", "..", ".."));

var console = Path.Combine(here, "vstest.console", "vstest.console.exe");
var dotnetExe = @"C:\Program Files\dotnet\dotnet.exe";
var consoleDll = Path.Combine(here, "vstest.console", "vstest.console.dll");

var sourceSettings = @"
<RunSettings>
Expand All @@ -61,8 +62,8 @@ static void Main(string[] args)
File.WriteAllText(settingsFile, sourceSettings);
var processStartInfo = new ProcessStartInfo
{
FileName = console,
Arguments = string.Join(" ", sources, $"--settings:{settingsFile}", "--listtests"),
FileName = dotnetExe,
Arguments = string.Join(" ", consoleDll, string.Join(" ", sources), $"--settings:{settingsFile}", "--listtests"),
UseShellExecute = false,
};
EnvironmentVariables.Variables.ToList().ForEach(processStartInfo.Environment.Add);
Expand All @@ -86,7 +87,7 @@ static void Main(string[] args)
TraceLevel = TraceLevel.Verbose,
};
var options = new TestPlatformOptions();
var r = new VsTestConsoleWrapper(console, consoleOptions);
var r = new VsTestConsoleWrapper(consoleDll, dotnetExe, consoleOptions);
var sessionHandler = new TestSessionHandler();
#pragma warning disable CS0618 // Type or member is obsolete
r.StartTestSession(sources, sourceSettings, sessionHandler);
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 /f $(MSBuildProjectDirectory)\..\..\src\vstest.console\bin\$(Configuration)\net451\ $(TargetDir)\vstest.console\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\Microsoft.TestPlatform.TestHostProvider\bin\$(Configuration)\net451\ $(TargetDir)\vstest.console\Extensions\&#xD;&#xA;REM copy net451, net47, net471, net472 and net48 testhosts&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost.x86\bin\$(Configuration)\net451\win7-x86 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost\bin\$(Configuration)\net451\win7-x64 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost.x86\bin\$(Configuration)\net47\win7-x86 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost\bin\$(Configuration)\net47\win7-x64 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost.x86\bin\$(Configuration)\net471\win7-x86 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost\bin\$(Configuration)\net471\win7-x64 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost.x86\bin\$(Configuration)\net472\win7-x86 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost\bin\$(Configuration)\net472\win7-x64 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost.x86\bin\$(Configuration)\net48\win7-x86 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost\bin\$(Configuration)\net48\win7-x64 $(TargetDir)\vstest.console\TestHost\" />
<Exec Command="xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\vstest.console\bin\$(Configuration)\netcoreapp2.1\ $(TargetDir)\vstest.console\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\Microsoft.TestPlatform.TestHostProvider\bin\$(Configuration)\net451\ $(TargetDir)\vstest.console\Extensions\&#xD;&#xA;REM copy net451, net47, net471, net472 and net48 testhosts&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost.x86\bin\$(Configuration)\net451\win7-x86 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost\bin\$(Configuration)\net451\win7-x64 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost.x86\bin\$(Configuration)\net47\win7-x86 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost\bin\$(Configuration)\net47\win7-x64 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost.x86\bin\$(Configuration)\net471\win7-x86 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost\bin\$(Configuration)\net471\win7-x64 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost.x86\bin\$(Configuration)\net472\win7-x86 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost\bin\$(Configuration)\net472\win7-x64 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost.x86\bin\$(Configuration)\net48\win7-x86 $(TargetDir)\vstest.console\TestHost\&#xD;&#xA;xcopy /i /y /f $(MSBuildProjectDirectory)\..\..\src\testhost\bin\$(Configuration)\net48\win7-x64 $(TargetDir)\vstest.console\TestHost\" />
</Target>
<Import Project="$(TestPlatformRoot)scripts\build\TestPlatform.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

using System.Runtime.CompilerServices;

using Microsoft.VisualStudio.TestPlatform.ObjectModel.Client;

#region Product Assemblies

#endregion
Expand All @@ -11,5 +13,7 @@

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


#endregion