Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
24a0bc8
move sslstress project to runtime repo
eiriktsarpalis Nov 19, 2019
7f005c4
spanify CRC.cs implementation and reference from stress projects
eiriktsarpalis Nov 20, 2019
6d41119
add extra EoL
eiriktsarpalis Nov 21, 2019
8a1b872
account for Common dependency
eiriktsarpalis Nov 22, 2019
c3c2dee
fix docker issue
eiriktsarpalis Nov 22, 2019
ec19b0a
fix typo
eiriktsarpalis Nov 22, 2019
e4b299c
use correct relative path
eiriktsarpalis Nov 22, 2019
5c567d4
fix docker-compose scenaria
eiriktsarpalis Nov 22, 2019
0c34769
revert httpstress changes
eiriktsarpalis Nov 26, 2019
653d663
update ssl-linux pipeline definition
eiriktsarpalis Nov 26, 2019
4250b2c
set up sslstress windows container pipelines
eiriktsarpalis Nov 26, 2019
a584088
fix workdir in windows Dockerfile
eiriktsarpalis Nov 26, 2019
ed511ae
fix log formatting
eiriktsarpalis Nov 26, 2019
46e5991
add backpressure diagnostics
eiriktsarpalis Nov 26, 2019
b1cf4a0
add monitor for stalled connections
eiriktsarpalis Nov 26, 2019
5c5ee48
add more diagnostic logs
eiriktsarpalis Nov 26, 2019
a0ecfe8
fix typo
eiriktsarpalis Dec 2, 2019
aee0b5a
minor fixes
eiriktsarpalis Dec 2, 2019
78080c6
fix race condition in server
eiriktsarpalis Dec 2, 2019
8bab916
minimize backpressure log noise
eiriktsarpalis Dec 3, 2019
c552b60
fix predicate
eiriktsarpalis Dec 3, 2019
28dc9da
rework cancellation mechanism
eiriktsarpalis Dec 4, 2019
168caf6
add CountingStream.WriteByte override
eiriktsarpalis Dec 6, 2019
611edad
put PipeWriter.Complete() in finally clause
eiriktsarpalis Dec 6, 2019
e379c9d
add stall detection logic
eiriktsarpalis Dec 6, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/pipelines/libraries/stress/http-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ steps:
docker build -t $(httpStressImage) --build-arg SDK_BASE_IMAGE=$(sdkBaseImage) --build-arg CONFIGURATION=$(BUILD_CONFIGURATION) -f windows.Dockerfile .
displayName: Build HttpStress

- bash: |
- powershell: |
cd '$(HttpStressProject)'
docker-compose up --abort-on-container-exit --no-color
displayName: Run HttpStress
Expand Down
51 changes: 51 additions & 0 deletions eng/pipelines/libraries/stress/ssl-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
trigger: none

pr:
branches:
include:
- "*"

schedules:
- cron: "0 13 * * *" # 1PM UTC => 5 AM PST
displayName: SslStress nightly run
branches:
include:
- master

pool:
name: Hosted Ubuntu 1604

variables:
- template: ../variables.yml
- name: sslStressProject
value: $(sourcesRoot)/System.Net.Security/tests/StressTests/SslStress/
# Avoid duplication by referencing corefx build infrastructure hosted in HttpStress
# TODO move to eng/ folder.
- name: httpStressProject
value: $(sourcesRoot)/System.Net.Http/tests/StressTests/HttpStress/
- name: sdkBaseImage
value: sdk-corefx-current
- name: sslStressImage
value: sslstress

steps:
- checkout: self
clean: true
fetchDepth: 1
lfs: false

- bash: |
docker build -t $(sdkBaseImage) --build-arg CONFIGURATION=$(BUILD_CONFIGURATION) --build-arg BUILD_SCRIPT_NAME=$(buildScriptFileName) -f $(httpStressProject)corefx.Dockerfile .
displayName: Build Libraries

- bash: |
# we need to include the entire src/libraries folder in the build context due to Common/ dependencies
docker build -t $(sslStressImage) --build-arg SDK_BASE_IMAGE=$(sdkBaseImage) --build-arg CONFIGURATION=$(BUILD_CONFIGURATION) -f $(sslStressProject)/Dockerfile src/libraries
displayName: Build SslStress

- bash: |
cd '$(sslStressProject)'
docker-compose up --abort-on-container-exit --no-color
displayName: Run SslStress
env:
HTTPSTRESS_IMAGE: $(sslStressImage)
66 changes: 66 additions & 0 deletions eng/pipelines/libraries/stress/ssl-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
trigger: none

pr:
branches:
include:
- "*"

schedules:
- cron: "0 13 * * *" # 1PM UTC => 5 AM PST
displayName: SslStress nightly run
branches:
include:
- master

pool:
vmImage: 'windows-latest'

variables:
- template: ../variables.yml
- name: sslStressProject
value: $(sourcesRoot)/System.Net.Security/tests/StressTests/SslStress/
# Avoid duplication by referencing corefx build infrastructure hosted in HttpStress
# TODO move to eng/ folder.
- name: httpStressProject
value: $(sourcesRoot)/System.Net.Http/tests/StressTests/HttpStress/
- name: sdkBaseImage
value: sdk-corefx-current
- name: sslStressImage
value: sslstress

steps:
- checkout: self
clean: true
fetchDepth: 1
lfs: false

- powershell: |
.\libraries.cmd -ci -c $(BUILD_CONFIGURATION)
docker build -t $(sdkBaseImage) `
--build-arg CONFIGURATION=$(BUILD_CONFIGURATION) `
--build-arg TESTHOST_LOCATION=. `
-f src/libraries/System.Net.Http/tests/StressTests/HttpStress/corefx.windows.Dockerfile `
artifacts/bin/testhost

displayName: Build Libraries

- powershell: |
# we need to include the entire src/libraries folder in the build context due to Common/ dependencies
docker build -t $(sslStressImage) --build-arg SDK_BASE_IMAGE=$(sdkBaseImage) --build-arg CONFIGURATION=$(BUILD_CONFIGURATION) -f $(sslStressProject)/windows.Dockerfile src/libraries
displayName: Build SslStress

- powershell: |
cd '$(sslStressProject)'
docker-compose up --abort-on-container-exit --no-color
displayName: Run SslStress
env:
SSLTRESS_IMAGE: $(sslStressImage)

- task: PublishBuildArtifacts@1
displayName: Publish Logs
inputs:
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(BUILD_CONFIGURATION)'
PublishLocation: Container
ArtifactName: 'sslstress_$(Agent.Os)_$(Agent.JobName)'
continueOnError: true
condition: always()
14 changes: 6 additions & 8 deletions src/libraries/Common/tests/System/IO/Compression/CRC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;

public class CRC
{
// Table of CRCs of all 8-bit messages.
Expand Down Expand Up @@ -32,27 +34,23 @@ private static void make_crc_table()
s_crc_table_computed = true;
}

// Update a running CRC with the bytes buf[0..len-1]--the CRC
// Update a running CRC with the bytes --the CRC
// should be initialized to all 1's, and the transmitted value
// is the 1's complement of the final running CRC (see the
// crc() routine below)).
private static ulong update_crc(ulong crc, byte[] buf, int len)
public static ulong UpdateCRC(ulong crc, ReadOnlySpan<byte> buf)
{
ulong c = crc;
int n;

if (!s_crc_table_computed)
make_crc_table();
for (n = 0; n < len; n++)
for (n = 0; n < buf.Length; n++)
{
c = s_crc_table[(c ^ buf[n]) & 0xff] ^ (c >> 8);
}
return c;
}

internal static string CalculateCRC(byte[] buf) => CalculateCRC(buf, buf.Length);

// Return the CRC of the bytes buf[0..len-1].
internal static string CalculateCRC(byte[] buf, int len) =>
(update_crc(0xffffffffL, buf, len) ^ 0xffffffffL).ToString();
public static ulong CalculateCRC(ReadOnlySpan<byte> buf) => (UpdateCRC(0xffffffffL, buf) ^ 0xffffffffL);
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public static void IsZipSameAsDir(Stream archiveFile, string directory, ZipArchi
entrystream.Read(buffer, 0, buffer.Length);
#if NETCOREAPP
uint zipcrc = entry.Crc32;
Assert.Equal(CRC.CalculateCRC(buffer), zipcrc.ToString());
Assert.Equal(CRC.CalculateCRC(buffer), zipcrc);
#endif

if (file.Length != givenLength)
Expand All @@ -183,8 +183,8 @@ public static void IsZipSameAsDir(Stream archiveFile, string directory, ZipArchi
}

Assert.Equal(file.Length, buffer.Length);
string crc = CRC.CalculateCRC(buffer);
Assert.Equal(file.CRC, crc);
ulong crc = CRC.CalculateCRC(buffer);
Assert.Equal(file.CRC, crc.ToString());
}

if (checkTimes)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Net;

namespace SslStress
{
[Flags]
public enum RunMode { server = 1, client = 2, both = server | client };

public class Configuration
{
public IPEndPoint ServerEndpoint { get; set; } = new IPEndPoint(IPAddress.Loopback, 0);
public RunMode RunMode { get; set; }
public int RandomSeed { get; set; }
public double CancellationProbability { get; set; }
public int MaxConnections { get; set; }
public int MaxBufferLength { get; set; }
public TimeSpan? MaxExecutionTime { get; set; }
public TimeSpan DisplayInterval { get; set; }
public TimeSpan MinConnectionLifetime { get; set; }
public TimeSpan MaxConnectionLifetime { get; set; }
public bool LogServer { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Project/>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Project/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/core/sdk:3.0.100-buster
FROM $SDK_BASE_IMAGE

WORKDIR /app
COPY . .
WORKDIR /app/System.Net.Security/tests/StressTests/SslStress

ARG CONFIGURATION=Release
RUN dotnet build -c $CONFIGURATION

EXPOSE 5001

ENV CONFIGURATION=$CONFIGURATION
ENV SSLSTRESS_ARGS=''
CMD dotnet run --no-build -c $CONFIGURATION -- $SSLSTRESS_ARGS
Loading