summaryrefslogtreecommitdiff
path: root/src/coreclr/tests/src/Loader/binding/assemblies/assemblybugs/37910/Ii.cs
diff options
context:
space:
mode:
authorMikhail Kurinnoi/AI Compiler Lab /SRR/Staff Engineer/Samsung Electronics <m.kurinnoi@samsung.com>2020-06-26 01:30:09 +0300
committerWoongsuk Cho <ws77.cho@samsung.com>2021-01-29 11:37:41 +0900
commitb3e2e12d3748ee733f0bd47943a9a3576c9301b3 (patch)
tree29bec6b145b0215259810ddac64aa88849afbf92 /src/coreclr/tests/src/Loader/binding/assemblies/assemblybugs/37910/Ii.cs
parente03324d772bbe880f2c01bfc743e34c1a4f77d3d (diff)
downloadcoreclr-b3e2e12d3748ee733f0bd47943a9a3576c9301b3.tar.gz
coreclr-b3e2e12d3748ee733f0bd47943a9a3576c9301b3.tar.bz2
coreclr-b3e2e12d3748ee733f0bd47943a9a3576c9301b3.zip
Fix TPA map hash calculation. (#288)tizen_5.5_tv
* Fix TPA map hash calculation. The point of issue is "the Turkish-I Problem". After locale changed, towupper() provide another result for "i" and different hash are calculated in case if file name have "i" letter. * Regression test for #37910
Diffstat (limited to 'src/coreclr/tests/src/Loader/binding/assemblies/assemblybugs/37910/Ii.cs')
-rw-r--r--src/coreclr/tests/src/Loader/binding/assemblies/assemblybugs/37910/Ii.cs39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/coreclr/tests/src/Loader/binding/assemblies/assemblybugs/37910/Ii.cs b/src/coreclr/tests/src/Loader/binding/assemblies/assemblybugs/37910/Ii.cs
new file mode 100644
index 0000000000..65f0ea68c0
--- /dev/null
+++ b/src/coreclr/tests/src/Loader/binding/assemblies/assemblybugs/37910/Ii.cs
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+public class Program
+{
+ [DllImport("libc", EntryPoint = "setlocale")]
+ public static extern IntPtr setlocale(int category, [MarshalAs(UnmanagedType.LPStr)] string locale);
+
+ public static int Main()
+ {
+ Assembly a1 = Assembly.GetExecutingAssembly();
+
+ // In case of Turkish locale:
+ // towupper 'i' -> \x0130 (instead of 'I')
+ // towlower 'I' -> \x0131 (instead of 'i')
+ const string TRLocale = "tr_TR.UTF-8";
+ IntPtr res = setlocale(6 /*LC_ALL*/, TRLocale);
+ if (TRLocale != Marshal.PtrToStringAnsi(res))
+ {
+ Console.WriteLine("Failed! " + TRLocale + " locale was not found in system!");
+ return -1;
+ }
+
+ Assembly a2 = Assembly.Load("Ii");
+
+ if (a1 != a2)
+ {
+ Console.WriteLine("Failed!");
+ return -2;
+ }
+
+ Console.WriteLine("Passed!");
+ return 100;
+ }
+}