Skip to content

Commit

Permalink
[browser] Added an optional HybridGlobalization run of libraries (#95324
Browse files Browse the repository at this point in the history
)

* Interpreted, optional lane for HG.

* Move hg job to `runtime-wasm-libtests`

* Try fixing skipping HG.

* Temporarily remove, to be added in a follow up PR.

* Added AOT version.

* Using build arg instead of helix arg.

* Start triggering WBT on wasi changes

* Revert, wrong PR

* Avoid `$(HybridGlobalization) has no effect when $(InvariantGlobalization) is set to true.`

* Block tests using not supported operations.

* Hybrid Globalization cannot be treated as ICU Globalization + more GetHashCode to be blocked.

* Fact, not Theory.

* Revert: tests with remaining ICU data in hybrid should behave like icu for IDN mapping.

* Block AOT lane and tests hitting PSNE

* Blocked.

* Block failing tests + fix incorrect spaces.

* Blocked non-working Node platform discovery.

* Revert.

* We shouldn't be using net8 machine anymore.

* Better logging + corrected some expected results.

* Fix build

* Better failure logging.

* Logging improvement.

* Responses to bangla and bengali are different.

* Fix for node 17.3.1.

* Update src/libraries/Common/tests/Tests/System/StringTests.cs

Co-authored-by: Ankit Jain <radical@gmail.com>

---------

Co-authored-by: Ankit Jain <radical@gmail.com>
  • Loading branch information
ilonatommy and radical committed Dec 12, 2023
1 parent 8ec34f3 commit f2a5fbf
Show file tree
Hide file tree
Showing 76 changed files with 1,956 additions and 1,804 deletions.
35 changes: 34 additions & 1 deletion eng/pipelines/extra-platforms/runtime-extra-platforms-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

#
# ************ Rolling builds: *************
# - only run eat, and aot tests
# - only run eat and aot tests
# - rest are covered by runtime
#
- ${{ if eq(parameters.isRollingBuild, true) }}:
Expand Down Expand Up @@ -205,6 +205,39 @@ jobs:
scenarios:
- normal

# Hybrid Globalization tests
- template: /eng/pipelines/common/templates/wasm-library-tests.yml
parameters:
platforms:
- browser_wasm
- browser_wasm_win
nameSuffix: _HybridGlobalization
extraBuildArgs: /p:HybridGlobalization=true
isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }}
alwaysRun: true
scenarios:
- normal
- WasmTestOnBrowser
- WasmTestOnNodeJS

# Hybrid Globalization AOT tests - https://github.com/dotnet/runtime/issues/94212
# - template: /eng/pipelines/common/templates/wasm-library-aot-tests.yml
# parameters:
# platforms:
# - browser_wasm
# - browser_wasm_win
# nameSuffix: _HybridGlobalization_AOT
# extraBuildArgs: /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS) /p:HybridGlobalization=true
# runAOT: true
# isExtraPlatformsBuild: ${{ parameters.isExtraPlatformsBuild }}
# isWasmOnlyBuild: ${{ parameters.isWasmOnlyBuild }}
# alwaysRun: true
# scenarios:
# - normal
# - WasmTestOnBrowser
# - WasmTestOnNodeJS

- ${{ if and(ne(parameters.isRollingBuild, true), ne(parameters.excludeNonLibTests, true), ne(parameters.debuggerTestsOnly, true)) }}:
# Builds only
- template: /eng/pipelines/common/templates/wasm-build-only.yml
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/libraries/helix-queues-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,6 @@ jobs:

# Browser WebAssembly windows
- ${{ if in(parameters.platform, 'browser_wasm_win', 'wasi_wasm_win') }}:
- (Windows.Amd64.Server2022.Open)windows.amd64.server2022.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-ltsc2022-helix-webassembly-net8
- (Windows.Amd64.Server2022.Open)windows.amd64.server2022.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-ltsc2022-helix-webassembly

${{ insert }}: ${{ parameters.jobParameters }}
18 changes: 15 additions & 3 deletions src/libraries/Common/tests/Tests/System/StringTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,7 @@ public static void ContainsMatchDifferentSpans_StringComparison()

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/95338", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/95471", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnBrowser))]
public static void ContainsNoMatch_StringComparison()
{
for (int length = 1; length < 150; length++)
Expand Down Expand Up @@ -1728,6 +1729,7 @@ public static IEnumerable<object[]> EndsWith_StringComparison_TestData()

[Theory]
[MemberData(nameof(EndsWith_StringComparison_TestData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/95473", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnBrowser))]
public static void EndsWith_StringComparison(string s, string value, StringComparison comparisonType, bool expected)
{
if (comparisonType == StringComparison.CurrentCulture)
Expand Down Expand Up @@ -3216,15 +3218,17 @@ which ignore the contraction collation weights (defined as 'tertiary' rules)
Assert.Equal(PlatformDetection.IsNlsGlobalization ? 0 : -1, source.IndexOf(target));
Assert.Equal(PlatformDetection.IsNlsGlobalization ? 0 : -1, source.IndexOf(target, StringComparison.CurrentCulture));

Assert.Equal(0, source.IndexOf(target, StringComparison.CurrentCultureIgnoreCase));
if (!PlatformDetection.IsHybridGlobalizationOnBrowser)
Assert.Equal(0, source.IndexOf(target, StringComparison.CurrentCultureIgnoreCase));
Assert.Equal(-1, source.IndexOf(target, StringComparison.Ordinal));
Assert.Equal(-1, source.IndexOf(target, StringComparison.OrdinalIgnoreCase));

ReadOnlySpan<char> span = source.AsSpan();

Assert.Equal(PlatformDetection.IsNlsGlobalization ? 0 : -1, span.IndexOf(target.AsSpan(), StringComparison.CurrentCulture));

Assert.Equal(0, span.IndexOf(target.AsSpan(), StringComparison.CurrentCultureIgnoreCase));
if (!PlatformDetection.IsHybridGlobalizationOnBrowser)
Assert.Equal(0, span.IndexOf(target.AsSpan(), StringComparison.CurrentCultureIgnoreCase));
Assert.Equal(-1, span.IndexOf(target.AsSpan(), StringComparison.Ordinal));
Assert.Equal(-1, span.IndexOf(target.AsSpan(), StringComparison.OrdinalIgnoreCase));
}
Expand Down Expand Up @@ -4853,7 +4857,11 @@ public static IEnumerable<object[]> StartsWith_StringComparison_TestData()
yield return new object[] { "", "hello", StringComparison.CurrentCulture, false };

if (PlatformDetection.IsNotInvariantGlobalization && PlatformDetection.IsNotHybridGlobalizationOnOSX)
yield return new object[] { "Hello", SoftHyphen + "Hel", StringComparison.CurrentCulture, true };
{
// "https://github.com/dotnet/runtime/issues/95473"
if (PlatformDetection.IsNotHybridGlobalizationOnBrowser)
yield return new object[] { "Hello", SoftHyphen + "Hel", StringComparison.CurrentCulture, true };
}

// CurrentCultureIgnoreCase
yield return new object[] { "Hello", "Hel", StringComparison.CurrentCultureIgnoreCase, true };
Expand Down Expand Up @@ -4924,6 +4932,7 @@ public static IEnumerable<object[]> StartsWith_StringComparison_TestData()

[Theory]
[MemberData(nameof(StartsWith_StringComparison_TestData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/95473", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnBrowser))]
public static void StartsWith_StringComparison(string s, string value, StringComparison comparisonType, bool expected)
{
if (comparisonType == StringComparison.CurrentCulture)
Expand Down Expand Up @@ -5346,6 +5355,7 @@ private static IEnumerable<object[]> ToLower_Culture_TestData()

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/95338", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/95503", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnBrowser))]
public static void Test_ToLower_Culture()
{
foreach (object[] testdata in ToLower_Culture_TestData())
Expand Down Expand Up @@ -5863,6 +5873,7 @@ public static IEnumerable<object[]> ToUpper_Culture_TestData()
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/95338", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnOSX))]
[MemberData(nameof(ToUpper_Culture_TestData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/95503", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnBrowser))]
public static void Test_ToUpper_Culture(string actual, string expected, CultureInfo culture)
{
Assert.Equal(expected, actual.ToUpper(culture));
Expand Down Expand Up @@ -5962,6 +5973,7 @@ public static IEnumerable<object[]> ToUpper_TurkishI_InvariantCulture_MemberData

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotInvariantGlobalization), nameof(PlatformDetection.IsNotHybridGlobalizationOnOSX))]
[MemberData(nameof(ToUpper_TurkishI_InvariantCulture_MemberData))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/95471", typeof(PlatformDetection), nameof(PlatformDetection.IsHybridGlobalizationOnBrowser))]
public static void ToUpper_TurkishI_InvariantCulture(string s, string expected)
{
using (new ThreadCultureChange(CultureInfo.InvariantCulture))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static void Add_RelativeIndex()
Assert.Equal(item1, coll[3]);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotHybridGlobalizationOnBrowser))]
public static void Add_RelativeKey()
{
var coll = new Collection();
Expand Down Expand Up @@ -175,7 +175,7 @@ public static void RemoveAt_InvalidIndex_ThrowsArgumentOutOfRangeException()
Assert.Throws<ArgumentOutOfRangeException>("Index", () => coll.RemoveAt(-1)); // Index < 0
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotHybridGlobalizationOnBrowser))]
public static void Remove_Key()
{
var coll = CreateKeyedCollection(10);
Expand All @@ -185,7 +185,7 @@ public static void Remove_Key()
Assert.False(coll.Contains("Key3"));
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotHybridGlobalizationOnBrowser))]
public static void Remove_InvalidKey_ThrowsArgumentException()
{
var coll = CreateKeyedCollection(10);
Expand Down Expand Up @@ -242,7 +242,7 @@ public static void Contains()
Assert.False(coll.Contains(new Foo()));
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotHybridGlobalizationOnBrowser))]
public static void Contains_ByKey()
{
var coll = CreateKeyedCollection(10);
Expand Down Expand Up @@ -275,7 +275,7 @@ public static void Item_Get_InvalidIndex_ThrowsIndexOutOfRangeException()
Assert.Throws<ArgumentException>(() => coll[(object)Guid.Empty]); // Neither string nor int
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotHybridGlobalizationOnBrowser))]
public static void Item_GetByKey()
{
Collection coll = CreateKeyedCollection(10);
Expand All @@ -291,7 +291,7 @@ public static void Item_GetByKey()
Assert.Equal(CreateValue(11), coll[(object)'X']);
}

[Fact]
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotHybridGlobalizationOnBrowser))]
public static void Item_GetByKey_InvalidIndex_ThrowsIndexOutOfRangeException()
{
Collection coll = CreateKeyedCollection(10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,30 @@ namespace Microsoft.VisualBasic.CompilerServices.Tests
{
public class LateBindingTests
{
[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotHybridGlobalizationOnBrowser))]
[MemberData(nameof(LateCall_TestData))]
public void LateCall(object obj, Type objType, string name, object[] args, string[] paramNames, bool[] copyBack, Func<object, object> getResult, object expected)
{
LateBinding.LateCall(obj, objType, name, args, paramNames, copyBack);
Assert.Equal(expected, getResult(obj));
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotHybridGlobalizationOnBrowser))]
[MemberData(nameof(LateGet_TestData))]
public void LateGet(object obj, Type objType, string name, object[] args, string[] paramNames, bool[] copyBack, object expected)
{
Assert.Equal(expected, LateBinding.LateGet(obj, objType, name, args, paramNames, copyBack));
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotHybridGlobalizationOnBrowser))]
[MemberData(nameof(LateSet_TestData))]
public void LateSet(object obj, Type objType, string name, object[] args, string[] paramNames, Func<object, object> getResult, object expected)
{
LateBinding.LateSet(obj, objType, name, args, paramNames);
Assert.Equal(expected, getResult(obj));
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotHybridGlobalizationOnBrowser))]
[MemberData(nameof(LateSetComplex_TestData))]
public void LateSetComplex(object obj, Type objType, string name, object[] args, string[] paramNames, bool missing, bool valueType)
{
Expand Down Expand Up @@ -81,7 +81,7 @@ public void LateIndexSet_MissingMember(object obj, object[] args, string[] param
Assert.Throws<MissingMemberException>(() => LateBinding.LateIndexSet(obj, args, paramNames));
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotHybridGlobalizationOnBrowser))]
[MemberData(nameof(LateIndexSetComplex_TestData))]
public void LateIndexSetComplex(object obj, object[] args, string[] paramNames, bool missing, bool valueType)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.VisualBasic.CompilerServices.Tests
{
public class LikeOperatorTests
{
[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotHybridGlobalizationOnBrowser))]
[MemberData(nameof(LikeObject_TestData))]
[MemberData(nameof(LikeString_TestData))]
public void LikeObject(object source, object pattern, object expectedBinaryCompare, object expectedTextCompare)
Expand All @@ -18,7 +18,7 @@ public void LikeObject(object source, object pattern, object expectedBinaryCompa
Assert.Equal(expectedTextCompare, LikeOperator.LikeObject(source, pattern, CompareMethod.Text));
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotHybridGlobalizationOnBrowser))]
[MemberData(nameof(LikeString_TestData))]
public void LikeString(string source, string pattern, bool expectedBinaryCompare, bool expectedTextCompare)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public static IEnumerable<object[]> GetObjectValuePrimitive_TestData()
// Add more...
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotHybridGlobalizationOnBrowser))]
[MemberData(nameof(LikeObj_TestData))]
public void LikeObj(object left, object right, object expectedBinaryCompare, object expectedTextCompare)
{
Expand Down Expand Up @@ -323,7 +323,7 @@ public static IEnumerable<object[]> LikeObj_NullReference_TestData()
yield return new object[] { null, "*" };
}

[Theory]
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotHybridGlobalizationOnBrowser))]
[MemberData(nameof(ObjTst_TestData))]
public void ObjTst(object x, object y, bool textCompare, object expected)
{
Expand Down
Loading

0 comments on commit f2a5fbf

Please sign in to comment.