From 391d1439e7bad1441987a519c2023ce7bafcabe8 Mon Sep 17 00:00:00 2001 From: Simon Rozsival Date: Fri, 22 Jul 2022 20:54:00 +0200 Subject: [PATCH] Disable failing System.Text.Json tests on Android x86 and on Browser with threading enabled (#72664) * Disable tests failing on Android x86 * Disable test projects timing out on multi-threaded Browser lanes * Disable more tests on Android x86 * Replace conditional fact with active issue * Fix build * Disable 5 additional failing Android x86 tests --- .../TestUtilities/System/PlatformDetection.cs | 3 ++- .../ConstructorTests/ConstructorTests.Cache.cs | 2 ++ .../ConstructorTests/ConstructorTests.Stream.cs | 2 ++ .../JsonNode/JsonNodeOperatorTests.cs | 3 ++- .../Serialization/ContinuationTests.cs | 2 ++ .../Serialization/NumberHandlingTests.cs | 30 ++++++++++++++++++---- .../Utf8JsonReaderTests.TryGet.cs | 2 ++ src/libraries/tests.proj | 7 +++++ 8 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index 46c8ddc..ddb7dd2 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -38,7 +38,8 @@ namespace System public static bool IsNetBSD => RuntimeInformation.IsOSPlatform(OSPlatform.Create("NETBSD")); public static bool IsAndroid => RuntimeInformation.IsOSPlatform(OSPlatform.Create("ANDROID")); public static bool IsNotAndroid => !IsAndroid; - public static bool IsNotAndroidX86 => !(IsAndroid && IsX86Process); + public static bool IsAndroidX86 => IsAndroid && IsX86Process; + public static bool IsNotAndroidX86 => !IsAndroidX86; public static bool IsiOS => RuntimeInformation.IsOSPlatform(OSPlatform.Create("IOS")); public static bool IstvOS => RuntimeInformation.IsOSPlatform(OSPlatform.Create("TVOS")); public static bool IsMacCatalyst => RuntimeInformation.IsOSPlatform(OSPlatform.Create("MACCATALYST")); diff --git a/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Cache.cs b/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Cache.cs index 2f12192..ec13c44 100644 --- a/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Cache.cs +++ b/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Cache.cs @@ -22,6 +22,7 @@ namespace System.Text.Json.Serialization.Tests } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/72101", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroidX86))] public async Task MultipleThreads() { // Verify the test class has >32 properties since that is a threshold for using the fallback dictionary. @@ -104,6 +105,7 @@ namespace System.Text.Json.Serialization.Tests } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/72101", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroidX86))] public async Task PropertyCacheWithMinInputsLast() { // Use local options to avoid obtaining already cached metadata from the default options. diff --git a/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Stream.cs b/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Stream.cs index 5c96e06..3a13070 100644 --- a/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Stream.cs +++ b/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.Stream.cs @@ -12,6 +12,7 @@ namespace System.Text.Json.Serialization.Tests { [Fact] [SkipOnCoreClr("https://github.com/dotnet/runtime/issues/45464", ~RuntimeConfiguration.Release)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/72101", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroidX86))] public async Task ReadSimpleObjectAsync() { if (StreamingSerializer is null) @@ -65,6 +66,7 @@ namespace System.Text.Json.Serialization.Tests } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/72101", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroidX86))] public async Task ReadSimpleObjectWithTrailingTriviaAsync() { if (StreamingSerializer is null) diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonNode/JsonNodeOperatorTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonNode/JsonNodeOperatorTests.cs index f193a3e..89818f1 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonNode/JsonNodeOperatorTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonNode/JsonNodeOperatorTests.cs @@ -86,7 +86,8 @@ namespace System.Text.Json.Nodes.Tests Assert.Equal(new Guid("1B33498A-7B7D-4DDA-9C13-F6AA4AB449A6"), (Guid)jObject["MyGuid"]); } - [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotAndroid), nameof(PlatformDetection.IsNotX86Process))] + [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/72101", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroidX86))] public static void ExplicitOperators_FromValues() { Assert.Equal(1, (short)(JsonNode)(short)1); diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/ContinuationTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/ContinuationTests.cs index 8496254..0645c16 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/ContinuationTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/ContinuationTests.cs @@ -124,6 +124,7 @@ namespace System.Text.Json.Serialization.Tests [Theory] [MemberData(nameof(TestData), /* enumeratePayloadTweaks: */ false)] [ActiveIssue("https://github.com/dotnet/runtime/issues/42677", platforms: TestPlatforms.Windows, runtimes: TestRuntimes.Mono)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/72101", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroidX86))] public static async Task ShouldWorkAtAnyPosition_Stream( string json, int bufferSize, @@ -182,6 +183,7 @@ namespace System.Text.Json.Serialization.Tests [MemberData(nameof(TestData), /* enumeratePayloadTweaks: */ false)] [ActiveIssue("https://github.com/dotnet/runtime/issues/42677", platforms: TestPlatforms.Windows, runtimes: TestRuntimes.Mono)] [SkipOnCoreClr("https://github.com/dotnet/runtime/issues/45464", ~RuntimeConfiguration.Release)] + [ActiveIssue("https://github.com/dotnet/runtime/issues/72101", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroidX86))] public static void ShouldWorkAtAnyPosition_Sequence( string json, int bufferSize, diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/NumberHandlingTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/NumberHandlingTests.cs index 9efb67a..5270f5d 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/NumberHandlingTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/NumberHandlingTests.cs @@ -61,7 +61,11 @@ namespace System.Text.Json.Serialization.Tests RunAsRootTypeTest(JsonNumberTestData.UInts); RunAsRootTypeTest(JsonNumberTestData.ULongs); RunAsRootTypeTest(JsonNumberTestData.Floats); - RunAsRootTypeTest(JsonNumberTestData.Doubles); + // https://github.com/dotnet/runtime/issues/72101 + if (!PlatformDetection.IsAndroidX86) + { + RunAsRootTypeTest(JsonNumberTestData.Doubles); + } RunAsRootTypeTest(JsonNumberTestData.Decimals); RunAsRootTypeTest(JsonNumberTestData.NullableBytes); RunAsRootTypeTest(JsonNumberTestData.NullableSBytes); @@ -72,7 +76,11 @@ namespace System.Text.Json.Serialization.Tests RunAsRootTypeTest(JsonNumberTestData.NullableUInts); RunAsRootTypeTest(JsonNumberTestData.NullableULongs); RunAsRootTypeTest(JsonNumberTestData.NullableFloats); - RunAsRootTypeTest(JsonNumberTestData.NullableDoubles); + // https://github.com/dotnet/runtime/issues/72101 + if (!PlatformDetection.IsAndroidX86) + { + RunAsRootTypeTest(JsonNumberTestData.NullableDoubles); + } RunAsRootTypeTest(JsonNumberTestData.NullableDecimals); } @@ -380,7 +388,11 @@ namespace System.Text.Json.Serialization.Tests RunAsCollectionElementTest(JsonNumberTestData.UInts); RunAsCollectionElementTest(JsonNumberTestData.ULongs); RunAsCollectionElementTest(JsonNumberTestData.Floats); - RunAsCollectionElementTest(JsonNumberTestData.Doubles); + // https://github.com/dotnet/runtime/issues/72101 + if (!PlatformDetection.IsAndroidX86) + { + RunAsCollectionElementTest(JsonNumberTestData.Doubles); + } RunAsCollectionElementTest(JsonNumberTestData.Decimals); // https://github.com/dotnet/runtime/issues/66220 @@ -395,7 +407,11 @@ namespace System.Text.Json.Serialization.Tests RunAsCollectionElementTest(JsonNumberTestData.NullableUInts); RunAsCollectionElementTest(JsonNumberTestData.NullableULongs); RunAsCollectionElementTest(JsonNumberTestData.NullableFloats); - RunAsCollectionElementTest(JsonNumberTestData.NullableDoubles); + // https://github.com/dotnet/runtime/issues/72101 + if (!PlatformDetection.IsAndroidX86) + { + RunAsCollectionElementTest(JsonNumberTestData.NullableDoubles); + } RunAsCollectionElementTest(JsonNumberTestData.NullableDecimals); } } @@ -621,7 +637,11 @@ namespace System.Text.Json.Serialization.Tests { RunAllDictionariessRoundTripTest(JsonNumberTestData.ULongs); RunAllDictionariessRoundTripTest(JsonNumberTestData.Floats); - RunAllDictionariessRoundTripTest(JsonNumberTestData.Doubles); + // https://github.com/dotnet/runtime/issues/72101 + if (!PlatformDetection.IsAndroidX86) + { + RunAllDictionariessRoundTripTest(JsonNumberTestData.Doubles); + } } private static void RunAllDictionariessRoundTripTest(List numbers) diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.TryGet.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.TryGet.cs index 9ae890d..4deee6a 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.TryGet.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.TryGet.cs @@ -15,6 +15,7 @@ namespace System.Text.Json.Tests public static partial class Utf8JsonReaderTests { [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/72101", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroidX86))] public static void TestingNumbers_TryGetMethods() { byte[] dataUtf8 = JsonNumberTestData.JsonData; @@ -153,6 +154,7 @@ namespace System.Text.Json.Tests } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/72101", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroidX86))] public static void TestingNumbers_GetMethods() { byte[] dataUtf8 = JsonNumberTestData.JsonData; diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index 9fc4c0c..3b94988 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -359,6 +359,13 @@ + + + + + + + -- 2.7.4