-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add resource for failing to copy via hardlink #8532
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
Conversation
dotnet#8238 added a reference to "Copy.LinkLibraryFailedPrefix" but didn't actually add that to our .resx. This adds it.
|
Can we add a test too - for a hardlink creation failing? |
src/Tasks.UnitTests/Copy_Tests.cs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also validate that it contains Copy.RetryingAsFileCopy?
src/Tasks.UnitTests/Copy_Tests.cs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not AssertLogContainsMessageFromResource as other places in this file?
src/Tasks.UnitTests/Copy_Tests.cs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't make sense to me. Isn't it unix-only because we have an OS-specific p/invoke?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have matching p/invokes per OS, so one could suppose we could easily craft the appropriate error message a la:
if (NativeMethodsShared.IsWindows)
{
errorMessage = ...
}
else
{
errorMessage = ...
}
But that doesn't work because the windows version isn't from MSBuild and isn't preserved in any particularly relevant form. We can't craft an appropriate error from what's in the test, and I don't think it's worth it to try to plumb the error message back out to some output variable.
src/Tasks.UnitTests/Copy_Tests.cs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put this in CopyHardLink_Tests instead of the base class so it isn't run multiple times?
|
@Forgind Sorry for awkward error. The new added test failed since there are not hard link creating failures in the same parent directory. we need a good way to inject failures for hardlink or symlink creation. |
|
Try making a 000 directory |
That doesn't work. @Forgind I'm thinking if we could merge the product code fixes and skip the test cases at first. When we have the way to fail the hyperlink, we can enable the test case. |
|
I agreed with @rainersigwald that since it's difficult to concoct a unit test that fails to create a hardlink on linux, I'd just test it manually and delete the unit test. My results from manual testing show: |
Fixes https://github.com/dotnet/msbuild/pull/8238/files#r1125001007
Context
#8238 added a reference to "Copy.LinkLibraryFailedPrefix" but didn't actually add that to our .resx. This adds it.
Changes Made
Added a resource
Testing
Notes