Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit 75329f4

Browse files
EgorBoViktorHofer
authored andcommitted
Ignore some System.Runtime tests on Mono (#37358)
* Add SkipOnTargetFramework(Mono) here and there
1 parent b2097cb commit 75329f4

File tree

7 files changed

+27
-19
lines changed

7 files changed

+27
-19
lines changed

src/CoreFx.Private.TestUtilities/ref/CoreFx.Private.TestUtilities.cs

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public static partial class PlatformDetection
6363
public static bool IsInvokingStaticConstructorsSupported { get { throw null; } }
6464
public static bool IsMacOsHighSierraOrHigher { get { throw null; } }
6565
public static bool IsMacOsMojaveOrHigher { get { throw null; } }
66+
public static bool IsMonoRuntime { get { throw null; } }
6667
public static bool IsNetBSD { get { throw null; } }
6768
public static bool IsNetCore { get { throw null; } }
6869
public static bool IsNetfx462OrNewer { get { throw null; } }
@@ -93,6 +94,7 @@ public static partial class PlatformDetection
9394
public static bool IsNotWinRTSupported { get { throw null; } }
9495
public static bool IsOpenSUSE { get { throw null; } }
9596
public static bool IsOSX { get { throw null; } }
97+
public static bool IsPreciseGcSupported { get { throw null; } }
9698
public static bool IsRedHatFamily { get { throw null; } }
9799
public static bool IsRedHatFamily6 { get { throw null; } }
98100
public static bool IsRedHatFamily7 { get { throw null; } }

src/CoreFx.Private.TestUtilities/src/System/PlatformDetection.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public static partial class PlatformDetection
2424
public static bool IsFullFramework => RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.OrdinalIgnoreCase);
2525
public static bool IsNetNative => RuntimeInformation.FrameworkDescription.StartsWith(".NET Native", StringComparison.OrdinalIgnoreCase);
2626
public static bool IsNetCore => RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.OrdinalIgnoreCase);
27+
public static bool IsMonoRuntime => Type.GetType("Mono.RuntimeStructs") != null;
2728
public static bool IsOSX => RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
2829
public static bool IsNotOSX => !IsOSX;
2930
public static bool IsFreeBSD => RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD"));
@@ -39,7 +40,7 @@ public static partial class PlatformDetection
3940
public static bool IsNotArm64Process => !IsArm64Process;
4041
public static bool IsArmOrArm64Process => IsArmProcess || IsArm64Process;
4142
public static bool IsNotArmNorArm64Process => !IsArmOrArm64Process;
42-
public static bool IsArgIteratorSupported => IsWindows && IsNotArmProcess;
43+
public static bool IsArgIteratorSupported => IsMonoRuntime || (IsWindows && IsNotArmProcess);
4344
public static bool IsArgIteratorNotSupported => !IsArgIteratorSupported;
4445
public static bool Is32BitProcess => IntPtr.Size == 4;
4546

@@ -143,5 +144,7 @@ public static bool IsNonZeroLowerBoundArraySupported
143144
// System.Security.Cryptography.Xml.XmlDsigXsltTransform.GetOutput() relies on XslCompiledTransform which relies
144145
// heavily on Reflection.Emit
145146
public static bool IsXmlDsigXsltTransformSupported => !PlatformDetection.IsUap;
147+
148+
public static bool IsPreciseGcSupported => !IsMonoRuntime;
146149
}
147150
}

src/System.Buffers/tests/ArrayPool/CollectionTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ private static bool ValidateTrimState(object pool, string trimString)
145145
return parsedTrim;
146146
}
147147

148-
[Theory,
149-
InlineData(true),
150-
InlineData(false)]
148+
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))]
149+
[InlineData(true)]
150+
[InlineData(false)]
151151
[ActiveIssue(29866, TargetFrameworkMonikers.UapNotUapAot)]
152152
public void PollingEventFires(bool trim)
153153
{

src/System.Net.Sockets/tests/FunctionalTests/UdpClientTest.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public void DisposeClose_OperationsThrow(bool close)
194194
Assert.Throws<ObjectDisposedException>(() => udpClient.Send(null, 0, "localhost", 0));
195195
}
196196

197-
[Fact]
197+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))]
198198
public void Finalize_NoExceptionsThrown()
199199
{
200200
WeakReference<UdpClient> udpClientWeakRef = CreateAndDiscardUdpClient();

src/System.Runtime/tests/System/EnumTests.cs

+9-6
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,16 @@ public static IEnumerable<object[]> Parse_TestData()
8787
yield return new object[] { "Value1", false, Enum.ToObject(s_boolEnumType, true) };
8888
yield return new object[] { "vaLue2", true, Enum.ToObject(s_boolEnumType, false) };
8989

90-
// Single - parses successfully, but doesn't properly represent the underlying value
91-
yield return new object[] { "Value1", false, Enum.GetValues(s_floatEnumType).GetValue(0) };
92-
yield return new object[] { "vaLue2", true, Enum.GetValues(s_floatEnumType).GetValue(0) };
90+
if (!PlatformDetection.IsMonoRuntime) // tracked in issue #36887
91+
{
92+
// Single - parses successfully, but doesn't properly represent the underlying value
93+
yield return new object[] { "Value1", false, Enum.GetValues(s_floatEnumType).GetValue(0) };
94+
yield return new object[] { "vaLue2", true, Enum.GetValues(s_floatEnumType).GetValue(0) };
9395

94-
// Double - parses successfully, but doesn't properly represent the underlying value
95-
yield return new object[] { "Value1", false, Enum.GetValues(s_doubleEnumType).GetValue(0) };
96-
yield return new object[] { "vaLue2", true, Enum.GetValues(s_doubleEnumType).GetValue(0) };
96+
// Double - parses successfully, but doesn't properly represent the underlying value
97+
yield return new object[] { "Value1", false, Enum.GetValues(s_doubleEnumType).GetValue(0) };
98+
yield return new object[] { "vaLue2", true, Enum.GetValues(s_doubleEnumType).GetValue(0) };
99+
}
97100
#endif // netcoreapp
98101

99102
// SimpleEnum

src/System.Runtime/tests/System/GCTests.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public static void Collection_InvalidCollectionMode_ThrowsArgumentOutOfRangeExce
7474
AssertExtensions.Throws<ArgumentOutOfRangeException>("mode", null, () => GC.Collect(2, mode, false));
7575
}
7676

77-
[Fact]
77+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))]
7878
public static void Collect_CallsFinalizer()
7979
{
8080
FinalizerTest.Run();
@@ -111,7 +111,7 @@ private class TestObject
111111
}
112112
}
113113

114-
[Fact]
114+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))]
115115
public static void KeepAlive()
116116
{
117117
KeepAliveTest.Run();
@@ -161,7 +161,7 @@ private class DoNotKeepAliveObject
161161
}
162162
}
163163

164-
[Fact]
164+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))]
165165
public static void KeepAlive_Null()
166166
{
167167
KeepAliveNullTest.Run();
@@ -339,7 +339,7 @@ public static void RemoveMemoryPressure_InvalidBytesAllocated_ThrowsArgumentOutO
339339
}
340340
}
341341

342-
[Fact]
342+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))]
343343
public static void GetTotalMemoryTest_ForceCollection()
344344
{
345345
// We don't test GetTotalMemory(false) at all because a collection
@@ -378,7 +378,7 @@ public static void GetGeneration()
378378
}
379379
}
380380

381-
[Theory]
381+
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))]
382382
[InlineData(GCLargeObjectHeapCompactionMode.CompactOnce)]
383383
[InlineData(GCLargeObjectHeapCompactionMode.Default)]
384384
public static void LargeObjectHeapCompactionModeRoundTrips(GCLargeObjectHeapCompactionMode value)

src/System.Runtime/tests/System/Runtime/CompilerServices/ConditionalWeakTableTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static void InvalidArgs_Throws()
2727
AssertExtensions.Throws<ArgumentException>(null, () => cwt.Add(key, key)); // duplicate key
2828
}
2929

30-
[Theory]
30+
[ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))]
3131
[InlineData(1)]
3232
[InlineData(100)]
3333
public static void Add(int numObjects)
@@ -231,7 +231,7 @@ static void GetWeakRefPair(out WeakReference<object> key_out, out WeakReference<
231231
key_out = new WeakReference<object>(key, false);
232232
}
233233

234-
[Fact]
234+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))]
235235
public static void GetOrCreateValue()
236236
{
237237
WeakReference<object> wrValue;
@@ -262,7 +262,7 @@ static void GetWeakRefValPair(out WeakReference<object> key_out, out WeakReferen
262262
key_out = new WeakReference<object>(key, false);
263263
}
264264

265-
[Fact]
265+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsPreciseGcSupported))]
266266
public static void GetValue()
267267
{
268268
WeakReference<object> wrValue;

0 commit comments

Comments
 (0)