Skip to content

Commit

Permalink
Enable Android x86 double related issues (#74080)
Browse files Browse the repository at this point in the history
Issue was fixed by #65723, enabling all related tests.

Fixes #72862
Fixes #37093
Fixes #71252
Fixes #68906
  • Loading branch information
mkhamoyan committed Aug 18, 2022
1 parent 197ba91 commit d37ef82
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ private static void VerifyCtorDecimal(decimal value)
VerifyBigIntegerUsingIdentities(bigInteger, 0 == expectedValue);
}

[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotAndroidX86))] // disabled on Android x86, see https://github.com/dotnet/runtime/issues/37093
[Fact]
public static void RunCtorByteArrayTests()
{
ulong tempUInt64;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,7 @@ private static void VerifyPow_Complex_Complex(double realValue, double imaginary
VerifyRealImaginaryProperties(result, expectedReal, expectedImaginary);
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotAndroidX86))] // disabled on Android x86, see https://github.com/dotnet/runtime/issues/37093
[Theory]
[MemberData(nameof(Boundaries_2_TestData))]
[MemberData(nameof(Primitives_2_TestData))]
[MemberData(nameof(SmallRandom_2_TestData))]
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/System.Runtime/tests/System/DoubleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1504,7 +1504,7 @@ public static void Atan2PiTest(double y, double x, double expectedResult, double
AssertExtensions.Equal(+expectedResult, double.Atan2Pi(+y, +x), allowedVariance);
}

[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotAndroidX86))] // disabled on Android x86, see https://github.com/dotnet/runtime/issues/71252
[Theory]
[InlineData( double.NaN, double.NaN, 0.0)]
[InlineData( 0.0, 0.0, 0.0)]
[InlineData( 1.5574077246549022, 0.31830988618379067, CrossPlatformMachineEpsilon)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public async Task MultipleThreadsLooping()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/72862", 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.
Expand Down Expand Up @@ -105,7 +104,6 @@ public async Task PropertyCacheWithMinInputsFirst()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/72862", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroidX86))]
public async Task PropertyCacheWithMinInputsLast()
{
// Use local options to avoid obtaining already cached metadata from the default options.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public abstract partial class ConstructorTests
{
[Fact]
[SkipOnCoreClr("https://github.com/dotnet/runtime/issues/45464", ~RuntimeConfiguration.Release)]
[ActiveIssue("https://github.com/dotnet/runtime/issues/72862", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroidX86))]
public async Task ReadSimpleObjectAsync()
{
if (StreamingSerializer is null)
Expand Down Expand Up @@ -66,7 +65,6 @@ async Task RunTestAsync<T>(byte[] testData)
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/72862", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroidX86))]
public async Task ReadSimpleObjectWithTrailingTriviaAsync()
{
if (StreamingSerializer is null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public static void ExplicitOperators_FromProperties()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/72862", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroidX86))]
public static void ExplicitOperators_FromValues()
{
Assert.Equal(1, (short)(JsonNode)(short)1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ public static IEnumerable<object[]> TestData(bool enumeratePayloadTweaks)
[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/72862", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroidX86))]
public static async Task ShouldWorkAtAnyPosition_Stream(
string json,
int bufferSize,
Expand Down Expand Up @@ -183,7 +182,6 @@ public static async Task InvalidJsonShouldFailAtAnyPosition_Stream(
[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/72862", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroidX86))]
public static void ShouldWorkAtAnyPosition_Sequence(
string json,
int bufferSize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ public static void Number_AsRootType_RoundTrip()
RunAsRootTypeTest(JsonNumberTestData.UInts);
RunAsRootTypeTest(JsonNumberTestData.ULongs);
RunAsRootTypeTest(JsonNumberTestData.Floats);
// https://github.com/dotnet/runtime/issues/72862
if (!PlatformDetection.IsAndroidX86)
{
RunAsRootTypeTest(JsonNumberTestData.Doubles);
}
RunAsRootTypeTest(JsonNumberTestData.Doubles);
RunAsRootTypeTest(JsonNumberTestData.Decimals);
RunAsRootTypeTest(JsonNumberTestData.NullableBytes);
RunAsRootTypeTest(JsonNumberTestData.NullableSBytes);
Expand All @@ -76,11 +72,7 @@ public static void Number_AsRootType_RoundTrip()
RunAsRootTypeTest(JsonNumberTestData.NullableUInts);
RunAsRootTypeTest(JsonNumberTestData.NullableULongs);
RunAsRootTypeTest(JsonNumberTestData.NullableFloats);
// https://github.com/dotnet/runtime/issues/72862
if (!PlatformDetection.IsAndroidX86)
{
RunAsRootTypeTest(JsonNumberTestData.NullableDoubles);
}
RunAsRootTypeTest(JsonNumberTestData.NullableDoubles);
RunAsRootTypeTest(JsonNumberTestData.NullableDecimals);
}

Expand All @@ -97,15 +89,6 @@ private static void RunAsRootTypeTest<T>(List<T> numbers)

private static string GetNumberAsString<T>(T number)
{
// Added float case for x86 android due to nan conversion in below switch
// There is active issue https://github.com/dotnet/runtime/issues/68906 on x86 Android
#if NETCOREAPP
if (OperatingSystem.IsAndroid() && RuntimeInformation.ProcessArchitecture == Architecture.X86 && Type.GetTypeCode(typeof(T)) == TypeCode.Single)
{
return Convert.ToSingle(number).ToString(JsonTestHelper.SingleFormatString, CultureInfo.InvariantCulture);
}
#endif

return number switch
{
double @double => @double.ToString(JsonTestHelper.DoubleFormatString, CultureInfo.InvariantCulture),
Expand Down Expand Up @@ -388,11 +371,7 @@ public static void Number_AsCollectionElement_RoundTrip()
RunAsCollectionElementTest(JsonNumberTestData.UInts);
RunAsCollectionElementTest(JsonNumberTestData.ULongs);
RunAsCollectionElementTest(JsonNumberTestData.Floats);
// https://github.com/dotnet/runtime/issues/72862
if (!PlatformDetection.IsAndroidX86)
{
RunAsCollectionElementTest(JsonNumberTestData.Doubles);
}
RunAsCollectionElementTest(JsonNumberTestData.Doubles);
RunAsCollectionElementTest(JsonNumberTestData.Decimals);

// https://github.com/dotnet/runtime/issues/66220
Expand All @@ -407,11 +386,7 @@ public static void Number_AsCollectionElement_RoundTrip()
RunAsCollectionElementTest(JsonNumberTestData.NullableUInts);
RunAsCollectionElementTest(JsonNumberTestData.NullableULongs);
RunAsCollectionElementTest(JsonNumberTestData.NullableFloats);
// https://github.com/dotnet/runtime/issues/72862
if (!PlatformDetection.IsAndroidX86)
{
RunAsCollectionElementTest(JsonNumberTestData.NullableDoubles);
}
RunAsCollectionElementTest(JsonNumberTestData.NullableDoubles);
RunAsCollectionElementTest(JsonNumberTestData.NullableDecimals);
}
}
Expand Down Expand Up @@ -637,11 +612,7 @@ public static void DictionariesRoundTrip()
{
RunAllDictionariessRoundTripTest(JsonNumberTestData.ULongs);
RunAllDictionariessRoundTripTest(JsonNumberTestData.Floats);
// https://github.com/dotnet/runtime/issues/72862
if (!PlatformDetection.IsAndroidX86)
{
RunAllDictionariessRoundTripTest(JsonNumberTestData.Doubles);
}
RunAllDictionariessRoundTripTest(JsonNumberTestData.Doubles);
}

private static void RunAllDictionariessRoundTripTest<T>(List<T> numbers)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace System.Text.Json.Tests
public static partial class Utf8JsonReaderTests
{
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/72862", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroidX86))]
public static void TestingNumbers_TryGetMethods()
{
byte[] dataUtf8 = JsonNumberTestData.JsonData;
Expand Down Expand Up @@ -154,7 +153,6 @@ public static void TestingNumbers_TryGetMethods()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/72862", typeof(PlatformDetection), nameof(PlatformDetection.IsAndroidX86))]
public static void TestingNumbers_GetMethods()
{
byte[] dataUtf8 = JsonNumberTestData.JsonData;
Expand Down

0 comments on commit d37ef82

Please sign in to comment.