Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordotnet-bot <dotnet-bot@microsoft.com>2022-10-18 18:41:59 +0300
committerdotnet-bot <dotnet-bot@microsoft.com>2022-10-18 18:41:59 +0300
commitd099f075e45d2aa6007a22b71b45a08758559f80 (patch)
tree53eed024d93f747b09c50a63ab5cc01016decbb5
parentbebb59597c8f98828b4cf2ae7724b277b15c47ee (diff)
parent0cee4aaff9cde26bfb1c09b3266ff392e0ad2db3 (diff)
Merge in 'release/7.0' changesv7.0.0
-rw-r--r--src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs2
-rw-r--r--src/libraries/System.Globalization/tests/IcuAppLocal/IcuAppLocal.Tests.csproj25
-rw-r--r--src/libraries/System.Globalization/tests/IcuAppLocal/IcuAppLocal.cs51
-rw-r--r--src/native/libs/System.Globalization.Native/pal_icushim.c1
4 files changed, 78 insertions, 1 deletions
diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs
index 33c4f5f9304..256a3075b41 100644
--- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs
+++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs
@@ -14,7 +14,7 @@ namespace System
// do it in a way that failures don't cascade.
//
- private static bool IsLinux => RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
+ public static bool IsLinux => RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
public static bool IsOpenSUSE => IsDistroAndVersion("opensuse");
public static bool IsUbuntu => IsDistroAndVersion("ubuntu");
public static bool IsDebian => IsDistroAndVersion("debian");
diff --git a/src/libraries/System.Globalization/tests/IcuAppLocal/IcuAppLocal.Tests.csproj b/src/libraries/System.Globalization/tests/IcuAppLocal/IcuAppLocal.Tests.csproj
new file mode 100644
index 00000000000..3b9800574da
--- /dev/null
+++ b/src/libraries/System.Globalization/tests/IcuAppLocal/IcuAppLocal.Tests.csproj
@@ -0,0 +1,25 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
+ <TestRuntime>true</TestRuntime>
+ <IncludeRemoteExecutor>true</IncludeRemoteExecutor>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="IcuAppLocal.cs" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Microsoft.ICU.ICU4C.Runtime" Version="68.2.0.9" />
+
+ <!--
+ We define this switch dynamically during the runtime using RemoteExecutor.
+ The reason is, if we enable ICU app-local here, this test will compile and run
+ on all supported OSs even the ICU NuGet package not have native bits support such OSs.
+ Note, it doesn't matter if we have test case conditioned to not run on such OSs, because
+ the test has to start running first before filtering the test cases and the globalization
+ code will run and fail fast at that time.
+
+ <RuntimeHostConfigurationOption Include="System.Globalization.AppLocalIcu" Value="68.2.0.9" />
+ -->
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/src/libraries/System.Globalization/tests/IcuAppLocal/IcuAppLocal.cs b/src/libraries/System.Globalization/tests/IcuAppLocal/IcuAppLocal.cs
new file mode 100644
index 00000000000..aa0a0df938c
--- /dev/null
+++ b/src/libraries/System.Globalization/tests/IcuAppLocal/IcuAppLocal.cs
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using Microsoft.DotNet.RemoteExecutor;
+using System.Diagnostics;
+using System.Reflection;
+using Xunit;
+
+namespace System.Globalization.Tests
+{
+ public class IcuAppLocalTests
+ {
+ private static bool SupportsIcuPackageDownload => RemoteExecutor.IsSupported &&
+ ((PlatformDetection.IsWindows && !PlatformDetection.IsArmProcess) ||
+ (PlatformDetection.IsLinux && (PlatformDetection.IsX64Process || PlatformDetection.IsArm64Process) &&
+ !PlatformDetection.IsAlpine && !PlatformDetection.IsLinuxBionic));
+
+
+ [ConditionalFact(nameof(SupportsIcuPackageDownload))]
+ public void TestIcuAppLocal()
+ {
+ // We define this switch dynamically during the runtime using RemoteExecutor.
+ // The reason is, if we enable ICU app-local here, this test will compile and run
+ // on all supported OSs even the ICU NuGet package not have native bits support such OSs.
+ // Note, it doesn't matter if we have test case conditioned to not run on such OSs, because
+ // the test has to start running first before filtering the test cases and the globalization
+ // code will run and fail fast at that time.
+
+ ProcessStartInfo psi = new ProcessStartInfo();
+ psi.Environment.Add("DOTNET_SYSTEM_GLOBALIZATION_APPLOCALICU", "68.2.0.9");
+
+ RemoteExecutor.Invoke(() =>
+ {
+ // Ensure initializing globalization code before checking the ICU version.
+ CultureInfo ci = CultureInfo.GetCultureInfo("en-US");
+
+ Type? interopGlobalization = Type.GetType("Interop+Globalization, System.Private.CoreLib");
+ Assert.NotNull(interopGlobalization);
+
+ MethodInfo? methodInfo = interopGlobalization.GetMethod("GetICUVersion", BindingFlags.NonPublic | BindingFlags.Static);
+ Assert.NotNull(methodInfo);
+
+ // Assert the ICU version 0x44020009 is 68.2.0.9
+ Assert.Equal(0x44020009, (int)methodInfo.Invoke(null, null));
+
+ // Now call globalization API to ensure the binding working without any problem.
+ Assert.Equal(-1, ci.CompareInfo.Compare("sample\u0000", "Sample\u0000", CompareOptions.IgnoreSymbols));
+ }, new RemoteInvokeOptions { StartInfo = psi }).Dispose();
+ }
+ }
+}
diff --git a/src/native/libs/System.Globalization.Native/pal_icushim.c b/src/native/libs/System.Globalization.Native/pal_icushim.c
index d23499c80b1..d6ae58dd1b3 100644
--- a/src/native/libs/System.Globalization.Native/pal_icushim.c
+++ b/src/native/libs/System.Globalization.Native/pal_icushim.c
@@ -539,6 +539,7 @@ void GlobalizationNative_InitICUFunctions(void* icuuc, void* icuin, const char*
ValidateICUDataCanLoad();
InitializeVariableMaxAndTopPointers(symbolVersion);
+ InitializeUColClonePointers(symbolVersion);
}
#undef PER_FUNCTION_BLOCK