diff options
author | Aaron Robinson <arobins@microsoft.com> | 2022-03-18 00:41:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-18 00:41:40 +0300 |
commit | 60478d252098ad1f3bdb98df53aaabf7d2755970 (patch) | |
tree | 79b236a48d90076d2927c4e7d071e7f68bbab138 /src/tests/Loader | |
parent | 7f2cdc538d12bf92c8ef3811e8270a02ecd712e8 (diff) |
Always append the "dll" extension for native libraries loads on Windows (#66666)
* Always append the "dll" extension for native libraries loads on Windows
Due to case-sensitive file systems on Windows the runtime will now
always append the ".dll" extension unless the name contains a trailing
"." or a known loadable extensions. This is an attempt to mitigate
the default Windows behavior that appends a ".DLL" which is rarely the
casing used for Windows shared libraries.
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Diffstat (limited to 'src/tests/Loader')
-rw-r--r-- | src/tests/Loader/AssemblyDependencyResolver/AssemblyDependencyResolverTests/NativeDependencyTests.cs | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/src/tests/Loader/AssemblyDependencyResolver/AssemblyDependencyResolverTests/NativeDependencyTests.cs b/src/tests/Loader/AssemblyDependencyResolver/AssemblyDependencyResolverTests/NativeDependencyTests.cs index b49516e33bc..a513a81afb9 100644 --- a/src/tests/Loader/AssemblyDependencyResolver/AssemblyDependencyResolverTests/NativeDependencyTests.cs +++ b/src/tests/Loader/AssemblyDependencyResolver/AssemblyDependencyResolverTests/NativeDependencyTests.cs @@ -51,21 +51,21 @@ namespace AssemblyDependencyResolverTests public void TestRelativeNameAndLibPrefixAndNoSuffix() { // The lib prefix is not added if the lookup is a relative path. - ValidateNativeLibraryWithRelativeLookupResolutions("lib{0}", "{0}", 0); + ValidateNativeLibraryWithRelativeLookupResolutions("lib{0}", "{0}", OS.None); } public void TestSimpleNameAndLibPrefixAndSuffix() { - ValidateNativeLibraryResolutions("lib{0}.dll", "{0}", 0); + ValidateNativeLibraryResolutions("lib{0}.dll", "{0}", OS.None); ValidateNativeLibraryResolutions("lib{0}.dylib", "{0}", OS.OSX); ValidateNativeLibraryResolutions("lib{0}.so", "{0}", OS.Linux); } public void TestNameWithSuffixAndNoPrefixAndNoSuffix() { - ValidateNativeLibraryResolutions("{0}", "{0}.dll", 0); - ValidateNativeLibraryResolutions("{0}", "{0}.dylib", 0); - ValidateNativeLibraryResolutions("{0}", "{0}.so", 0); + ValidateNativeLibraryResolutions("{0}", "{0}.dll", OS.None); + ValidateNativeLibraryResolutions("{0}", "{0}.dylib", OS.None); + ValidateNativeLibraryResolutions("{0}", "{0}.so", OS.None); } public void TestNameWithSuffixAndNoPrefixAndSuffix() @@ -78,16 +78,16 @@ namespace AssemblyDependencyResolverTests public void TestNameWithSuffixAndNoPrefixAndDoubleSuffix() { // Unixes add the suffix even if one is already present. - ValidateNativeLibraryResolutions("{0}.dll.dll", "{0}.dll", 0); + ValidateNativeLibraryResolutions("{0}.dll.dll", "{0}.dll", OS.None); ValidateNativeLibraryResolutions("{0}.dylib.dylib", "{0}.dylib", OS.OSX); ValidateNativeLibraryResolutions("{0}.so.so", "{0}.so", OS.Linux); } public void TestNameWithSuffixAndPrefixAndNoSuffix() { - ValidateNativeLibraryResolutions("lib{0}", "{0}.dll", 0); - ValidateNativeLibraryResolutions("lib{0}", "{0}.dylib", 0); - ValidateNativeLibraryResolutions("lib{0}", "{0}.so", 0); + ValidateNativeLibraryResolutions("lib{0}", "{0}.dll", OS.None); + ValidateNativeLibraryResolutions("lib{0}", "{0}.dylib", OS.None); + ValidateNativeLibraryResolutions("lib{0}", "{0}.so", OS.None); } public void TestNameWithSuffixAndPrefixAndSuffix() @@ -100,14 +100,14 @@ namespace AssemblyDependencyResolverTests public void TestRelativeNameWithSuffixAndPrefixAndSuffix() { // The lib prefix is not added if the lookup is a relative path - ValidateNativeLibraryWithRelativeLookupResolutions("lib{0}.dll", "{0}.dll", 0); - ValidateNativeLibraryWithRelativeLookupResolutions("lib{0}.dylib", "{0}.dylib", 0); - ValidateNativeLibraryWithRelativeLookupResolutions("lib{0}.so", "{0}.so", 0); + ValidateNativeLibraryWithRelativeLookupResolutions("lib{0}.dll", "{0}.dll", OS.None); + ValidateNativeLibraryWithRelativeLookupResolutions("lib{0}.dylib", "{0}.dylib", OS.None); + ValidateNativeLibraryWithRelativeLookupResolutions("lib{0}.so", "{0}.so", OS.None); } public void TestNameWithPrefixAndNoPrefixAndNoSuffix() { - ValidateNativeLibraryResolutions("{0}", "lib{0}", 0); + ValidateNativeLibraryResolutions("{0}", "lib{0}", OS.None); } public void TestNameWithPrefixAndPrefixAndNoSuffix() @@ -117,9 +117,9 @@ namespace AssemblyDependencyResolverTests public void TestNameWithPrefixAndNoPrefixAndSuffix() { - ValidateNativeLibraryResolutions("{0}.dll", "lib{0}", 0); - ValidateNativeLibraryResolutions("{0}.dylib", "lib{0}", 0); - ValidateNativeLibraryResolutions("{0}.so", "lib{0}", 0); + ValidateNativeLibraryResolutions("{0}.dll", "lib{0}", OS.None); + ValidateNativeLibraryResolutions("{0}.dylib", "lib{0}", OS.None); + ValidateNativeLibraryResolutions("{0}.so", "lib{0}", OS.None); } public void TestNameWithPrefixAndPrefixAndSuffix() @@ -136,10 +136,10 @@ namespace AssemblyDependencyResolverTests public void TestWindowsDoesntAddSuffixWhenExectubaleIsPresent() { - ValidateNativeLibraryResolutions("{0}.dll.dll", "{0}.dll", 0); - ValidateNativeLibraryResolutions("{0}.dll.exe", "{0}.dll", 0); - ValidateNativeLibraryResolutions("{0}.exe.dll", "{0}.exe", 0); - ValidateNativeLibraryResolutions("{0}.exe.exe", "{0}.exe", 0); + ValidateNativeLibraryResolutions("{0}.dll.dll", "{0}.dll", OS.None); + ValidateNativeLibraryResolutions("{0}.dll.exe", "{0}.dll", OS.None); + ValidateNativeLibraryResolutions("{0}.exe.dll", "{0}.exe", OS.None); + ValidateNativeLibraryResolutions("{0}.exe.exe", "{0}.exe", OS.None); } private void TestLookupWithSuffixPrefersUnmodifiedSuffixOnUnixes() @@ -174,21 +174,22 @@ namespace AssemblyDependencyResolverTests public void TestFullPathLookupWithDifferentFileName() { - ValidateFullPathNativeLibraryResolutions("lib{0}", "{0}", 0); - ValidateFullPathNativeLibraryResolutions("{0}.dll", "{0}", 0); - ValidateFullPathNativeLibraryResolutions("{0}.dylib", "{0}", 0); - ValidateFullPathNativeLibraryResolutions("{0}.so", "{0}", 0); - ValidateFullPathNativeLibraryResolutions("lib{0}.dll", "{0}", 0); - ValidateFullPathNativeLibraryResolutions("lib{0}.dylib", "{0}", 0); - ValidateFullPathNativeLibraryResolutions("lib{0}.so", "{0}", 0); - ValidateFullPathNativeLibraryResolutions("lib{0}.dll", "{0}.dll", 0); - ValidateFullPathNativeLibraryResolutions("lib{0}.dylib", "{0}.dylib", 0); - ValidateFullPathNativeLibraryResolutions("lib{0}.so", "{0}.so", 0); + ValidateFullPathNativeLibraryResolutions("lib{0}", "{0}", OS.None); + ValidateFullPathNativeLibraryResolutions("{0}.dll", "{0}", OS.None); + ValidateFullPathNativeLibraryResolutions("{0}.dylib", "{0}", OS.None); + ValidateFullPathNativeLibraryResolutions("{0}.so", "{0}", OS.None); + ValidateFullPathNativeLibraryResolutions("lib{0}.dll", "{0}", OS.None); + ValidateFullPathNativeLibraryResolutions("lib{0}.dylib", "{0}", OS.None); + ValidateFullPathNativeLibraryResolutions("lib{0}.so", "{0}", OS.None); + ValidateFullPathNativeLibraryResolutions("lib{0}.dll", "{0}.dll", OS.None); + ValidateFullPathNativeLibraryResolutions("lib{0}.dylib", "{0}.dylib", OS.None); + ValidateFullPathNativeLibraryResolutions("lib{0}.so", "{0}.so", OS.None); } [Flags] private enum OS { + None = 0, Windows = 0x1, OSX = 0x2, Linux = 0x4 |