Skip to content

Commit

Permalink
More updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Evangelink committed Jul 21, 2022
1 parent ae4f07d commit ecaaee1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 30 deletions.
12 changes: 12 additions & 0 deletions TestPlatform.sln
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,18 @@ Global
{62E9D32B-B989-43CF-81A2-B38B3367FCA3}.Release|x64.Build.0 = Release|Any CPU
{62E9D32B-B989-43CF-81A2-B38B3367FCA3}.Release|x86.ActiveCfg = Release|Any CPU
{62E9D32B-B989-43CF-81A2-B38B3367FCA3}.Release|x86.Build.0 = Release|Any CPU
{4DA57968-F547-4019-8381-03A218B6C385}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4DA57968-F547-4019-8381-03A218B6C385}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4DA57968-F547-4019-8381-03A218B6C385}.Debug|x64.ActiveCfg = Debug|Any CPU
{4DA57968-F547-4019-8381-03A218B6C385}.Debug|x64.Build.0 = Debug|Any CPU
{4DA57968-F547-4019-8381-03A218B6C385}.Debug|x86.ActiveCfg = Debug|Any CPU
{4DA57968-F547-4019-8381-03A218B6C385}.Debug|x86.Build.0 = Debug|Any CPU
{4DA57968-F547-4019-8381-03A218B6C385}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4DA57968-F547-4019-8381-03A218B6C385}.Release|Any CPU.Build.0 = Release|Any CPU
{4DA57968-F547-4019-8381-03A218B6C385}.Release|x64.ActiveCfg = Release|Any CPU
{4DA57968-F547-4019-8381-03A218B6C385}.Release|x64.Build.0 = Release|Any CPU
{4DA57968-F547-4019-8381-03A218B6C385}.Release|x86.ActiveCfg = Release|Any CPU
{4DA57968-F547-4019-8381-03A218B6C385}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 0 additions & 1 deletion src/Microsoft.TestPlatform.Client/TestPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Metadata;

using Microsoft.VisualStudio.TestPlatform.Client.Discovery;
using Microsoft.VisualStudio.TestPlatform.Client.Execution;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ internal static class DebuggerBreakpoint
{
internal static void AttachVisualStudioDebugger(string environmentVariable)
{
#if NETCOREAPP1_0
return;
#else
if (string.IsNullOrWhiteSpace(environmentVariable))
{
throw new ArgumentException($"'{nameof(environmentVariable)}' cannot be null or whitespace.", nameof(environmentVariable));
Expand Down Expand Up @@ -53,14 +50,10 @@ internal static void AttachVisualStudioDebugger(string environmentVariable)

Break();
}
#endif
}

private static bool AttachVs(Process process, int? vsPid)
{
#if NETCOREAPP1_0
return false;
#else
// The way we attach VS is not compatible with .NET Core 2.1 and .NET Core 3.1, but works in .NET Framework and .NET.
// We could call the library code directly here for .NET, and .NET Framework, but then we would also need to package it
// together with testhost. So instead we always run the executable, and pass path to it using env variable.
Expand All @@ -84,29 +77,20 @@ private static bool AttachVs(Process process, int? vsPid)
attachVsProcess.WaitForExit();

return attachVsProcess.ExitCode == 0;
#endif
}

private static string? FindAttachVs()
{
#if NETCOREAPP1_0
return null;
#else

var fromPath = FindOnPath("AttachVS.exe");
if (fromPath != null)
{
return fromPath;
}


# if NETCOREAPP
var parent = AppContext.BaseDirectory;
#else
// Don't use current process MainModule here, it resolves to dotnet if you invoke
// dotnet vstest.console.dll, or dotnet testhost.dll. Use the entry assembly instead.
var parent = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
#endif
var parent = Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location);
while (parent != null)
{
var path = Path.Combine(parent, @"src\AttachVS\bin\Debug\net472\AttachVS.exe");
Expand All @@ -120,7 +104,6 @@ private static bool AttachVs(Process process, int? vsPid)
}

return parent;
#endif
}

private static string? FindOnPath(string exeName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,6 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo(
bool testHostExeFound = false;
if (!useCustomDotnetHostpath
&& _platformEnvironment.OperatingSystem.Equals(PlatformOperatingSystem.Windows)
// REVIEW ME: @Marco Do we need to update the logic?
// testhost*.exe are build for netcoreapp2.1 and are not able to search for the correct runtime in case of
// x64/x86 on arm because the new logic (registry lookup) was added in since netcoreapp3.0.
// On arm we cannot rely on apphost and we'll use dotnet.exe muxer.
&& !IsWinOnArm())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ public BlameDataCollectorTests()
}

[TestMethod]
// REVIEW ME: Shall we make the test supporting Linux?
// netcoreapp2.1 dump is not supported on Linux
[TestCategory("Windows-Review")]
[NetFullTargetFrameworkDataSource]
[NetCoreTargetFrameworkDataSource]
Expand All @@ -58,8 +56,6 @@ public void BlameDataCollectorShouldGiveCorrectTestCaseName(RunnerInfo runnerInf
}

[TestMethod]
// REVIEW ME: Shall we make the test supporting Linux?
// netcoreapp2.1 dump is not supported on Linux
[TestCategory("Windows-Review")]
[NetFullTargetFrameworkDataSource]
[NetCoreTargetFrameworkDataSource]
Expand All @@ -84,8 +80,6 @@ public void BlameDataCollectorShouldOutputDumpFile(RunnerInfo runnerInfo)
}

[TestMethod]
// REVIEW ME: Shall we make the test supporting Linux?
// netcoreapp2.1 dump is not supported on Linux
[TestCategory("Windows-Review")]
[NetFullTargetFrameworkDataSource]
[NetCoreTargetFrameworkDataSource]
Expand All @@ -110,8 +104,6 @@ public void BlameDataCollectorShouldNotOutputDumpFileWhenNoCrashOccurs(RunnerInf
}

[TestMethod]
// REVIEW ME: Shall we make the test supporting Linux?
// netcoreapp2.1 dump is not supported on Linux
[TestCategory("Windows-Review")]
[NetFullTargetFrameworkDataSource]
[NetCoreTargetFrameworkDataSource]
Expand Down

0 comments on commit ecaaee1

Please sign in to comment.