Skip to content

Commit a82fee7

Browse files
committed
[RISC-V] Address last code review comments
1 parent 22981df commit a82fee7

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

src/libraries/Common/tests/TestUtilities/System/PlatformDetection.Unix.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,13 +309,7 @@ private static bool IsQemu()
309309
{
310310
if (IsLinux)
311311
{
312-
foreach (DictionaryEntry entry in Environment.GetEnvironmentVariables())
313-
{
314-
if (((String)entry.Key).ToUpper() == "DOTNET_RUNNING_UNDER_QEMU")
315-
{
316-
return true;
317-
}
318-
}
312+
return Environment.GetEnvironmentVariable("DOTNET_RUNNING_UNDER_QEMU") != null;
319313
}
320314
return false;
321315
}

src/libraries/System.Net.Sockets/tests/FunctionalTests/ArgumentValidationTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ public void Connect_ConnectTwice_NotSupported(int invalidatingAction)
800800
{
801801
using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
802802
{
803-
// On Qemu we omit one test case due to: https://gitlab.com/qemu-project/qemu/-/issues/2410
803+
// Skip on Qemu due to https://github.com/dotnet/runtime/issues/104542
804804
if (PlatformDetection.IsQemuLinux && invalidatingAction == 1)
805805
{
806806
return;
@@ -838,8 +838,8 @@ public void ConnectAsync_ConnectTwice_NotSupported(int invalidatingAction)
838838

839839
using (Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
840840
{
841-
// On Qemu we omit one test case due to: https://gitlab.com/qemu-project/qemu/-/issues/2410
842-
if (!PlatformDetection.IsNotQemuLinux && invalidatingAction == 1)
841+
// Skip on Qemu due to https://github.com/dotnet/runtime/issues/104542
842+
if (PlatformDetection.IsQemuLinux && invalidatingAction == 1)
843843
{
844844
return;
845845
}

src/libraries/System.Net.Sockets/tests/FunctionalTests/KeepAliveTest.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ public void Socket_KeepAlive_Interval_And_Time()
121121
}
122122
}
123123

124-
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotQemuLinux))] // Skip on Qemu due to https://gitlab.com/qemu-project/qemu/-/issues/2390
124+
[Fact]
125+
[ActiveIssue("https://github.com/dotnet/runtime/issues/104545", typeof(PlatformDetection), nameof(PlatformDetection.IsQemuLinux))]
125126
public void Socket_Get_KeepAlive_Time_AsByteArray_OptionLengthZero_Failure()
126127
{
127128
using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
@@ -144,9 +145,9 @@ public void Socket_Get_KeepAlive_Time_AsByteArray_OptionLengthZero_Failure()
144145
[InlineData(new byte[3] { 0, 0, 0 })]
145146
public void Socket_Get_KeepAlive_Time_AsByteArray_BufferNullOrTooSmall_Failure(byte[] buffer)
146147
{
147-
if (!PlatformDetection.IsNotQemuLinux && (buffer == null || buffer.Length == 0))
148+
if (PlatformDetection.IsQemuLinux && (buffer == null || buffer.Length == 0))
148149
{
149-
// Skip on Qemu due to https://gitlab.com/qemu-project/qemu/-/issues/2390
150+
// Skip on Qemu due to https://github.com/dotnet/runtime/issues/104545
150151
return;
151152
}
152153
using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))

src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketOptionNameTest.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ namespace System.Net.Sockets.Tests
1515
public partial class SocketOptionNameTest
1616
{
1717
private static bool SocketsReuseUnicastPortSupport => Capability.SocketsReuseUnicastPortSupport().HasValue;
18-
private static bool SupportedOnPlatform = PlatformDetection.IsNotWindowsNanoNorServerCore && PlatformDetection.IsNotQemuLinux;
1918

2019
[ConditionalFact(nameof(SocketsReuseUnicastPortSupport))]
2120
public void ReuseUnicastPort_CreateSocketGetOption()
@@ -51,7 +50,8 @@ public void ReuseUnicastPort_CreateSocketSetOption()
5150
}
5251
}
5352

54-
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotQemuLinux))]
53+
[Fact]
54+
[ActiveIssue("https://github.com/dotnet/runtime/issues/104547", typeof(PlatformDetection), nameof(PlatformDetection.IsQemuLinux))]
5555
public void MulticastOption_CreateSocketSetGetOption_GroupAndInterfaceIndex_SetSucceeds_GetThrows()
5656
{
5757
int interfaceIndex = 0;
@@ -65,7 +65,8 @@ public void MulticastOption_CreateSocketSetGetOption_GroupAndInterfaceIndex_SetS
6565
}
6666
}
6767

68-
[ConditionalFact(nameof(SupportedOnPlatform))] // Skip on Nano: https://github.com/dotnet/runtime/issues/26286 and Qemu
68+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] // Skip on Nano: https://github.com/dotnet/runtime/issues/26286
69+
[ActiveIssue("https://github.com/dotnet/runtime/issues/104547", typeof(PlatformDetection), nameof(PlatformDetection.IsQemuLinux))]
6970
public async Task MulticastInterface_Set_AnyInterface_Succeeds()
7071
{
7172
// On all platforms, index 0 means "any interface"
@@ -121,9 +122,10 @@ public void MulticastInterface_Set_InvalidIndex_Throws()
121122
}
122123
}
123124

124-
[ConditionalFact(nameof(SupportedOnPlatform))] // Skip on Nano: https://github.com/dotnet/runtime/issues/26286 and Qemu
125+
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))] // Skip on Nano: https://github.com/dotnet/runtime/issues/26286
125126
[SkipOnPlatform(TestPlatforms.OSX | TestPlatforms.FreeBSD, "Expected behavior is different on OSX or FreeBSD")]
126127
[ActiveIssue("https://github.com/dotnet/runtime/issues/52124", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
128+
[ActiveIssue("https://github.com/dotnet/runtime/issues/104547", typeof(PlatformDetection), nameof(PlatformDetection.IsQemuLinux))]
127129
public async Task MulticastInterface_Set_IPv6_AnyInterface_Succeeds()
128130
{
129131
// On all platforms, index 0 means "any interface"

0 commit comments

Comments
 (0)