From: Swaroop Sridhar Date: Thu, 29 Nov 2018 07:09:30 +0000 (-0800) Subject: Fix dotnet/coreclr#21209 (dotnet/coreclr#21237) X-Git-Tag: submit/tizen/20210909.063632~11030^2~3221 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d480065527475d3f038b20f76f1ba6b84f5a226f;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fix dotnet/coreclr#21209 (dotnet/coreclr#21237) This commit has two changes to Native Load Library Tests fix the failures in: https://github.com/dotnet/coreclr/issues/21209 1) Windows: The test tried to load a DLL from Win32 directory which doesn't exist in Windows server 2016. So changed to use a file that exists. 2) Linux: Disable the test when run against packages -- because in this configuration the tests are built on Windows, and the native DLL is built separately and copied over to the CORE_ROOT directory instead of the test directory. [Several other tests are disabled with the comment "Issue building native DLL" on Linux] Commit migrated from https://github.com/dotnet/coreclr/commit/0a0bcebae483b434c70875707c0eb1a493eb2e66 --- diff --git a/src/coreclr/tests/issues.targets b/src/coreclr/tests/issues.targets index 5fe1694..92719214 100644 --- a/src/coreclr/tests/issues.targets +++ b/src/coreclr/tests/issues.targets @@ -807,6 +807,9 @@ + + Issue building native components for the test. Since tests are currently built on Windows, the native components end up at Core_Root instead of Test directory, which is not suitable for the test. + needs triage diff --git a/src/coreclr/tests/src/Interop/MarshalAPI/NativeLibrary/NativeLibraryTests.cs b/src/coreclr/tests/src/Interop/MarshalAPI/NativeLibrary/NativeLibraryTests.cs index 7ef2afb..dfc7335 100644 --- a/src/coreclr/tests/src/Interop/MarshalAPI/NativeLibrary/NativeLibraryTests.cs +++ b/src/coreclr/tests/src/Interop/MarshalAPI/NativeLibrary/NativeLibraryTests.cs @@ -106,14 +106,15 @@ public class NativeLibraryTest if (TestLibrary.Utilities.IsWindows) { + libName = GetWin32LibName(); + // Calls on a valid library from System32 directory - libName = GetNativeLibraryPlainName(); - success &= EXPECT(LoadLibraryAdvanced("mapi32", assembly, DllImportSearchPath.System32)); - success &= EXPECT(TryLoadLibraryAdvanced("mapi32", assembly, DllImportSearchPath.System32)); + success &= EXPECT(LoadLibraryAdvanced(libName, assembly, DllImportSearchPath.System32)); + success &= EXPECT(TryLoadLibraryAdvanced(libName, assembly, DllImportSearchPath.System32)); // Calls on a valid library from application directory - success &= EXPECT(LoadLibraryAdvanced("mapi32", assembly, DllImportSearchPath.ApplicationDirectory), TestResult.DllNotFound); - success &= EXPECT(TryLoadLibraryAdvanced("mapi32", assembly, DllImportSearchPath.ApplicationDirectory), TestResult.ReturnFailure); + success &= EXPECT(LoadLibraryAdvanced(libName, assembly, DllImportSearchPath.ApplicationDirectory), TestResult.DllNotFound); + success &= EXPECT(TryLoadLibraryAdvanced(libName, assembly, DllImportSearchPath.ApplicationDirectory), TestResult.ReturnFailure); } // Calls with null libName input @@ -179,6 +180,11 @@ public class NativeLibraryTest return "NativeLibrary"; } + static string GetWin32LibName() + { + return "msi.dll"; + } + static string GetNativeLibraryName() { string baseName = GetNativeLibraryPlainName();