Skip to content

Remove RunSettingsFilePath support from dotnet test for MTP #47706

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

Merged
merged 1 commit into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions src/Cli/dotnet/commands/dotnet-test/CliConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ internal static class CliConstants

public const string BinLogFileName = "msbuild.binlog";

public const string TestingPlatformVsTestBridgeRunSettingsFileEnvVar = "TESTINGPLATFORM_VSTESTBRIDGE_RUNSETTINGS_FILE";
public const string DLLExtension = ".dll";

public const string MTPTarget = "_MTPBuild";
Expand Down Expand Up @@ -91,7 +90,6 @@ internal static class ProjectProperties
internal const string TargetFrameworks = "TargetFrameworks";
internal const string TargetPath = "TargetPath";
internal const string ProjectFullPath = "MSBuildProjectFullPath";
internal const string RunSettingsFilePath = "RunSettingsFilePath";
internal const string RunCommand = "RunCommand";
internal const string RunArguments = "RunArguments";
internal const string RunWorkingDirectory = "RunWorkingDirectory";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

namespace Microsoft.DotNet.Tools.Test;

internal sealed record ModuleMessage(string? DllOrExePath, string? ProjectPath, string? TargetFramework, string? RunSettingsFilePath, string IsTestingPlatformApplication) : IRequest;
internal sealed record ModuleMessage(string? DllOrExePath, string? ProjectPath, string? TargetFramework, string IsTestingPlatformApplication) : IRequest;
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ public object Deserialize(Stream stream)
string modulePath = ReadString(stream);
string projectPath = ReadString(stream);
string targetFramework = ReadString(stream);
string runSettingsFilePath = ReadString(stream);
string isTestingPlatformApplication = ReadString(stream);
return new ModuleMessage(modulePath.Trim(), projectPath.Trim(), targetFramework.Trim(), runSettingsFilePath.Trim(), isTestingPlatformApplication.Trim());
return new ModuleMessage(modulePath.Trim(), projectPath.Trim(), targetFramework.Trim(), isTestingPlatformApplication.Trim());
}

public void Serialize(object objectToSerialize, Stream stream)
{
WriteString(stream, ((ModuleMessage)objectToSerialize).DllOrExePath);
WriteString(stream, ((ModuleMessage)objectToSerialize).ProjectPath);
WriteString(stream, ((ModuleMessage)objectToSerialize).TargetFramework);
WriteString(stream, ((ModuleMessage)objectToSerialize).RunSettingsFilePath);
WriteString(stream, ((ModuleMessage)objectToSerialize).IsTestingPlatformApplication);
}
}
1 change: 0 additions & 1 deletion src/Cli/dotnet/commands/dotnet-test/MSBuildHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ private void LogProjectProperties(IEnumerable<TestModule> modules)
logMessageBuilder.AppendLine($"{ProjectProperties.RunCommand}: {module.RunProperties.RunCommand}");
logMessageBuilder.AppendLine($"{ProjectProperties.RunArguments}: {module.RunProperties.RunArguments}");
logMessageBuilder.AppendLine($"{ProjectProperties.RunWorkingDirectory}: {module.RunProperties.RunWorkingDirectory}");
logMessageBuilder.AppendLine($"{ProjectProperties.RunSettingsFilePath}: {module.RunSettingsFilePath}");
logMessageBuilder.AppendLine();
}

Expand Down
2 changes: 1 addition & 1 deletion src/Cli/dotnet/commands/dotnet-test/Models.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Microsoft.DotNet.Cli;

internal sealed record TestModule(RunProperties RunProperties, string? ProjectFullPath, string? TargetFramework, string? RunSettingsFilePath, bool IsTestingPlatformApplication, bool IsTestProject);
internal sealed record TestModule(RunProperties RunProperties, string? ProjectFullPath, string? TargetFramework, bool IsTestingPlatformApplication, bool IsTestProject);

internal sealed record Handshake(Dictionary<byte, string>? Properties);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,8 @@ public static IEnumerable<TestModule> GetProjectProperties(string projectFilePat
string targetFramework = project.GetPropertyValue(ProjectProperties.TargetFramework);
RunProperties runProperties = GetRunProperties(project, loggers);
string projectFullPath = project.GetPropertyValue(ProjectProperties.ProjectFullPath);
string runSettingsFilePath = project.GetPropertyValue(ProjectProperties.RunSettingsFilePath);

return new TestModule(runProperties, PathUtility.FixFilePath(projectFullPath), targetFramework, runSettingsFilePath, isTestingPlatformApplication, isTestProject);
return new TestModule(runProperties, PathUtility.FixFilePath(projectFullPath), targetFramework, isTestingPlatformApplication, isTestProject);

static RunProperties GetRunProperties(ProjectInstance project, ICollection<ILogger>? loggers)
{
Expand Down
10 changes: 0 additions & 10 deletions src/Cli/dotnet/commands/dotnet-test/TestApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ private ProcessStartInfo CreateProcessStartInfo(bool isDll, TestOptions testOpti
processStartInfo.WorkingDirectory = _module.RunProperties.RunWorkingDirectory;
}

AddRunSettingsFileToEnvironment(processStartInfo);

return processStartInfo;
}

Expand All @@ -99,14 +97,6 @@ private string GetArguments(TestOptions testOptions, bool isDll)
return BuildArgsWithDotnetRun(testOptions);
}

private void AddRunSettingsFileToEnvironment(ProcessStartInfo processStartInfo)
{
if (!string.IsNullOrEmpty(_module.RunSettingsFilePath))
{
processStartInfo.EnvironmentVariables.Add(CliConstants.TestingPlatformVsTestBridgeRunSettingsFileEnvVar, _module.RunSettingsFilePath);
}
}

private static bool IsArchitectureSpecified(TestOptions testOptions)
{
return !string.IsNullOrEmpty(testOptions.Architecture);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public bool RunWithTestModulesFilter(ParseResult parseResult, BuildOptions build

foreach (string testModule in testModulePaths)
{
var testApp = new TestApplication(new TestModule(new RunProperties(testModule, null, null), null, null, null, true, true), buildOptions);
var testApp = new TestApplication(new TestModule(new RunProperties(testModule, null, null), null, null, true, true), buildOptions);
// Write the test application to the channel
_actionQueue.Enqueue(testApp);
}
Expand Down
Loading