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

Add test coverage for amd64 MSBuild.exe #69

Merged
merged 5 commits into from
Apr 1, 2024
Merged
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
40 changes: 2 additions & 38 deletions src/Tests/E2ETests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ private static (string ExePath, string Verb) GetMsBuildExeAndVerb()

if (!string.IsNullOrEmpty(vsInstallDir))
{
string msbuildExePath = Path.Combine(vsInstallDir, @"MSBuild\Current\Bin\MSBuild.exe");
string msbuildExePath = Path.Combine(vsInstallDir, @"MSBuild\Current\Bin\amd64\MSBuild.exe");
if (!File.Exists(msbuildExePath))
{
throw new InvalidOperationException($"Could not find MSBuild.exe path for unit tests: {msbuildExePath}");
Expand All @@ -500,43 +500,7 @@ private static (string ExePath, string Verb) GetMsBuildExeAndVerb()
return ("dotnet", "build");
}

// From: https://docs.microsoft.com/en-us/dotnet/standard/io/how-to-copy-directories
private static void DirectoryCopy(string sourceDirName, string destDirName)
stan-sz marked this conversation as resolved.
Show resolved Hide resolved
{
// Get the subdirectories for the specified directory.
var dir = new DirectoryInfo(sourceDirName);

if (!dir.Exists)
{
throw new DirectoryNotFoundException($"Source directory does not exist or could not be found: {sourceDirName}");
}

var subdirs = dir.GetDirectories();

// If the destination directory doesn't exist, create it.
if (!Directory.Exists(destDirName))
{
Directory.CreateDirectory(destDirName);
}

// Get the files in the directory and copy them to the new location.
var files = dir.GetFiles();
foreach (var file in files)
{
var destFile = Path.Combine(destDirName, file.Name);
file.CopyTo(destFile, false);
}

// Copy subdirectories and their contents to new location.
foreach (var subdir in subdirs)
{
var destSubdirName = Path.Combine(destDirName, subdir.Name);
DirectoryCopy(subdir.FullName, destSubdirName);
}
}

private async Task RunMSBuildAsync(string projectFile, Warning[] expectedWarnings, string[]? expectedConsoleOutputs = null, bool expectUnusedMsvcLibrariesLog = false,
bool enableReferenceTrimmerDiagnostics = false)
private async Task RunMSBuildAsync(string projectFile, Warning[] expectedWarnings, string[]? expectedConsoleOutputs = null, bool expectUnusedMsvcLibrariesLog = false, bool enableReferenceTrimmerDiagnostics = false)
{
var testDataSourcePath = Path.GetFullPath(Path.Combine("TestData", TestContext?.TestName ?? string.Empty));

Expand Down
Loading