Skip to content

Commit

Permalink
Fix for failing WebSocket deflate test on ARM (#52052)
Browse files Browse the repository at this point in the history
Reducing the number of times Random.Next is called to improve runtime performance of test on ARM. 
Fixes #52031
  • Loading branch information
zlatanov authored May 11, 2021
1 parent 089717b commit d515841
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -421,12 +421,6 @@ public async Task ReceiveInvalidCompressedData()
[MemberData(nameof(SupportedWindowBits))]
public async Task PayloadShouldHaveSimilarSizeWhenSplitIntoSegments(int windowBits)
{
if (PlatformDetection.IsArmOrArm64Process && (windowBits == 14 || windowBits == 15))
{
// https://github.com/dotnet/runtime/issues/52031
return;
}

MemoryStream stream = new();
using WebSocket client = WebSocket.CreateFromStream(stream, new WebSocketCreationOptions
{
Expand All @@ -440,11 +434,11 @@ public async Task PayloadShouldHaveSimilarSizeWhenSplitIntoSegments(int windowBi
int frameSize = 2 << windowBits;

byte[] message = new byte[frameSize * 10];
Random random = new(0);
new Random(0).NextBytes(message);

for (int i = 0; i < message.Length; ++i)
{
message[i] = (byte)random.Next(maxValue: 10);
message[i] %= 10;
}

await client.SendAsync(message, WebSocketMessageType.Binary, true, CancellationToken);
Expand Down

0 comments on commit d515841

Please sign in to comment.