From 785a318efbe6dcf0c2ea92141e4c08350121c580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Thu, 8 Sep 2022 18:27:10 +0200 Subject: [PATCH] Fix test issues on armv6, s390x, ppc64le on runtime-community --- .../tests/TestUtilities/System/PlatformDetection.cs | 2 ++ .../tests/CheckArchitectureTests.cs | 10 +++++++++- .../tests/BinaryFormatterTests.cs | 1 + .../tests/XmlDictionaryReaderTests.cs | 2 ++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs index 3292595b41fbf1..e48a3f25a6a704 100644 --- a/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs +++ b/src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs @@ -61,7 +61,9 @@ public static partial class PlatformDetection public static bool IsNotArm64Process => !IsArm64Process; public static bool IsArmOrArm64Process => IsArmProcess || IsArm64Process; public static bool IsNotArmNorArm64Process => !IsArmOrArm64Process; + public static bool IsS390xProcess => (int)RuntimeInformation.ProcessArchitecture == 5; // Architecture.S390x public static bool IsArmv6Process => (int)RuntimeInformation.ProcessArchitecture == 7; // Architecture.Armv6 + public static bool IsPpc64leProcess => (int)RuntimeInformation.ProcessArchitecture == 8; // Architecture.Ppc64le public static bool IsX64Process => RuntimeInformation.ProcessArchitecture == Architecture.X64; public static bool IsX86Process => RuntimeInformation.ProcessArchitecture == Architecture.X86; public static bool IsNotX86Process => !IsX86Process; diff --git a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/CheckArchitectureTests.cs b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/CheckArchitectureTests.cs index 1405411989d9ef..29c91dce7580ca 100644 --- a/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/CheckArchitectureTests.cs +++ b/src/libraries/System.Runtime.InteropServices.RuntimeInformation/tests/CheckArchitectureTests.cs @@ -29,7 +29,15 @@ public void VerifyArchitecture() break; case Architecture.Arm64: - Assert.Equal(IntPtr.Size == 4 ? Architecture.Arm : Architecture.Arm64, processArch); + if (IntPtr.Size == 8) + { + Assert.Equal(Architecture.Arm64, processArch); + } + else + { + // armv7/armv6 process running on arm64 host + Assert.True(processArch == Architecture.Arm || processArch == Architecture.Armv6, $"Unexpected process architecture: {processArch}"); + } break; case Architecture.Wasm: diff --git a/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs b/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs index 7e48c51bc50aad..95891b7bcfa3a3 100644 --- a/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs +++ b/src/libraries/System.Runtime.Serialization.Formatters/tests/BinaryFormatterTests.cs @@ -25,6 +25,7 @@ public partial class BinaryFormatterTests : FileCleanupTestBase [ConditionalTheory(typeof(Environment), nameof(Environment.Is64BitProcess))] [SkipOnCoreClr("Long running tests: https://github.com/dotnet/runtime/issues/11191", ~RuntimeConfiguration.Release)] [ActiveIssue("https://github.com/dotnet/runtime/issues/35915", typeof(PlatformDetection), nameof(PlatformDetection.IsMonoInterpreter))] + [ActiveIssue("https://github.com/dotnet/runtime/issues/75281", typeof(PlatformDetection), nameof(PlatformDetection.IsPpc64leProcess))] [InlineData(2 * 6_584_983 - 2)] // previous limit [InlineData(2 * 7_199_369 - 2)] // last pre-computed prime number public void SerializeHugeObjectGraphs(int limit) diff --git a/src/libraries/System.Runtime.Serialization.Xml/tests/XmlDictionaryReaderTests.cs b/src/libraries/System.Runtime.Serialization.Xml/tests/XmlDictionaryReaderTests.cs index e15f9fc2df544b..e4797e08b94d27 100644 --- a/src/libraries/System.Runtime.Serialization.Xml/tests/XmlDictionaryReaderTests.cs +++ b/src/libraries/System.Runtime.Serialization.Xml/tests/XmlDictionaryReaderTests.cs @@ -165,6 +165,7 @@ public static void ReadStringTest() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/74494", typeof(PlatformDetection), nameof(PlatformDetection.IsS390xProcess))] public static void BinaryXml_ReadPrimitiveTypes() { float f = 1.23456788f; @@ -202,6 +203,7 @@ public static void BinaryXml_ReadPrimitiveTypes() } [Fact] + [ActiveIssue("https://github.com/dotnet/runtime/issues/74494", typeof(PlatformDetection), nameof(PlatformDetection.IsS390xProcess))] public static void BinaryXml_Array_RoundTrip() { int[] ints = new int[] { -1, 0x01020304, 0x11223344, -1 };