Skip to content

Add diagnostics to symlink embedding unittest #8653

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
Apr 12, 2023
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
15 changes: 10 additions & 5 deletions src/Build.UnitTests/BinaryLogger_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ public void BinaryLoggerShouldEmbedFilesViaTaskOutput()

// Can't just compare `Name` because `ZipArchive` does not handle unix directory separators well
// thus producing garbled fully qualified paths in the actual .ProjectImports.zip entries
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith("testtaskoutputfile.txt"));
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith("testtaskoutputfile.txt"),
() => $"Embedded files: {string.Join(",", zipArchive.Entries)}");
}

[RequiresSymbolicLinksFact]
Expand Down Expand Up @@ -321,10 +322,14 @@ public void BinaryLoggerShouldEmbedSymlinkFilesViaTaskOutput()

// Can't just compare `Name` because `ZipArchive` does not handle unix directory separators well
// thus producing garbled fully qualified paths in the actual .ProjectImports.zip entries
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith("testtaskoutputfile.txt"));
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith(symlinkName));
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith(symlinkLvl2Name));
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith(emptyFileName));
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith("testtaskoutputfile.txt"),
() => $"Embedded files: {string.Join(",", zipArchive.Entries)}");
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith(symlinkName),
() => $"Embedded files: {string.Join(",", zipArchive.Entries)}");
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith(symlinkLvl2Name),
() => $"Embedded files: {string.Join(",", zipArchive.Entries)}");
zipArchive.Entries.ShouldContain(zE => zE.Name.EndsWith(emptyFileName),
() => $"Embedded files: {string.Join(",", zipArchive.Entries)}");
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion src/UnitTests.Shared/RequiresSymbolicLinksFactAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public RequiresSymbolicLinksFactAttribute()
// In Windows, a process can create symlinks only if it has sufficient permissions.
// We simply try to create one and if it fails we skip the test.
string sourceFile = FileUtilities.GetTemporaryFile();
string destinationFile = FileUtilities.GetTemporaryFile();
string destinationFile = FileUtilities.GetTemporaryFileName();
try
{
File.Create(sourceFile).Dispose();
Expand Down