From bfd6dcdf8d45f9e37e2322492490248752cd61af Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Tue, 16 Nov 2021 14:34:18 +0100 Subject: [PATCH 01/19] refactor stress test builds --- .gitignore | 4 ++ eng/docker/build-docker-sdk.ps1 | 29 +++++++-- eng/docker/build-docker-sdk.sh | 11 +--- .../libraries-sdk-aspnetcore.linux.Dockerfile | 36 ----------- .../libraries-sdk-daily.windows.Dockerfile | 28 ++++++++ eng/docker/libraries-sdk.linux.Dockerfile | 53 +++++++++++---- eng/pipelines/libraries/stress/http.yml | 20 +++--- .../System.Net.Http/ref/System.Net.Http.cs | 1 + .../src/System/Net/Http/HttpClient.cs | 3 + .../StressTests/HttpStress/Build-Local.ps1 | 56 ++++++++++++++++ .../HttpStress/Directory.Build.props | 17 ++++- .../HttpStress/Directory.Build.targets | 12 +++- .../tests/StressTests/HttpStress/Dockerfile | 12 +++- .../StressTests/HttpStress/HttpStress.csproj | 42 ++++++++++-- .../tests/StressTests/HttpStress/Program.cs | 1 + .../tests/StressTests/HttpStress/Readme.md | 32 ++++++---- .../StressTests/HttpStress/StressClient.cs | 1 + .../StressTests/HttpStress/StressServer.cs | 3 + .../StressTests/HttpStress/build-local.sh | 64 +++++++++++++++++++ .../HttpStress/load-corefx-testhost.ps1 | 0 .../HttpStress/run-docker-compose.sh | 12 ---- .../StressTests/HttpStress/windows.Dockerfile | 18 +++++- .../LiveBuildTest/Directory.Build.props | 17 +++++ .../LiveBuildTest/Directory.Build.targets | 11 ++++ .../StressTests/LiveBuildTest/Dockerfile | 4 ++ .../LiveBuildTest/LiveBuildTest.csproj | 28 ++++++++ .../StressTests/LiveBuildTest/Program.cs | 17 +++++ .../StressTests/SslStress/Build-Local.ps1 | 38 +++++++++++ .../SslStress/Directory.Build.props | 17 ++++- .../SslStress/Directory.Build.targets | 12 +++- .../tests/StressTests/SslStress/Dockerfile | 13 +++- .../tests/StressTests/SslStress/Readme.md | 34 ++++++---- .../StressTests/SslStress/SslStress.csproj | 3 +- .../StressTests/SslStress/build-local.sh | 44 +++++++++++++ .../SslStress/run-docker-compose.sh | 12 ---- 35 files changed, 567 insertions(+), 138 deletions(-) delete mode 100644 eng/docker/libraries-sdk-aspnetcore.linux.Dockerfile create mode 100644 eng/docker/libraries-sdk-daily.windows.Dockerfile create mode 100644 src/libraries/System.Net.Http/tests/StressTests/HttpStress/Build-Local.ps1 create mode 100755 src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.sh mode change 100644 => 100755 src/libraries/System.Net.Http/tests/StressTests/HttpStress/load-corefx-testhost.ps1 create mode 100644 src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Directory.Build.props create mode 100644 src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Directory.Build.targets create mode 100644 src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Dockerfile create mode 100644 src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/LiveBuildTest.csproj create mode 100644 src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Program.cs create mode 100644 src/libraries/System.Net.Security/tests/StressTests/SslStress/Build-Local.ps1 create mode 100755 src/libraries/System.Net.Security/tests/StressTests/SslStress/build-local.sh diff --git a/.gitignore b/.gitignore index dbdbce21b052de..833551119f2d02 100644 --- a/.gitignore +++ b/.gitignore @@ -354,3 +354,7 @@ src/coreclr/System.Private.CoreLib/common !src/coreclr/inc/obj/ !src/coreclr/vm/.vscode/ !src/coreclr/vm/.vscode/c_cpp_properties.json + +# Temporary artifacts from local libraries stress builds +.dotnet-daily/ +run-stress-* \ No newline at end of file diff --git a/eng/docker/build-docker-sdk.ps1 b/eng/docker/build-docker-sdk.ps1 index e3fbaef77d1d36..c9c83577c0f255 100755 --- a/eng/docker/build-docker-sdk.ps1 +++ b/eng/docker/build-docker-sdk.ps1 @@ -7,7 +7,7 @@ Param( [string][Alias('t')]$imageName = "dotnet-sdk-libs-current", [string][Alias('c')]$configuration = "Release", [switch][Alias('w')]$buildWindowsContainers, - [switch][Alias('pa')]$privateAspNetCore + [switch][Alias('ds')]$dailySdk ) $ErrorActionPreference = "Stop" @@ -16,9 +16,9 @@ $REPO_ROOT_DIR=$(git -C "$PSScriptRoot" rev-parse --show-toplevel) $dockerFilePrefix="$PSScriptRoot/libraries-sdk" -if ($privateAspNetCore) +if ($dailySdk) { - $dockerFilePrefix="$PSScriptRoot/libraries-sdk-aspnetcore" + $dockerFilePrefix="$PSScriptRoot/libraries-sdk-daily" } if ($buildWindowsContainers) @@ -33,13 +33,30 @@ if ($buildWindowsContainers) exit $LASTEXITCODE } - $dockerFile="$dockerFilePrefix.windows.Dockerfile" + $dockerFile="$dockerFilePrefix-daily.windows.Dockerfile" + + ## Collect the following artifacts under to a special folder that and copy it to the container, + ## so projects can build and test against the live-built runtime: + ## 1. Reference assembly pack (microsoft.netcore.app.ref) + ## 2. Runtime pack (microsoft.netcore.app.runtime.linux-x64) + ## 3. targetingpacks.targets, so stress test builds can target the live-built runtime instead of the one in the pre-installed SDK + ## 4. testhost + $binArtifacts = "$REPO_ROOT_DIR\artifacts\bin" + $dockerArtifacts = "$REPO_ROOT_DIR\artifacts\docker-context" + if (Test-Path $dockerArtifacts) { + Remove-Item -Recurse -Force $dockerArtifacts + } + + Copy-Item -Recurse -Destination $dockerArtifacts\microsoft.netcore.app.ref -Path $binArtifacts\microsoft.netcore.app.ref + Copy-Item -Recurse -Destination $dockerArtifacts\microsoft.netcore.app.runtime.win-x64 -Path $binArtifacts\microsoft.netcore.app.runtime.win-x64 + Copy-Item -Recurse -Destination $dockerArtifacts\testhost -Path $binArtifacts\testhost + Copy-Item -Recurse -Destination $dockerArtifacts\targetingpacks.targets -Path $REPO_ROOT_DIR\eng\targetingpacks.targets + docker build --tag $imageName ` --build-arg CONFIGURATION=$configuration ` - --build-arg TESTHOST_LOCATION=. ` --file $dockerFile ` - "$REPO_ROOT_DIR/artifacts/bin/testhost" + $dockerArtifacts } else { diff --git a/eng/docker/build-docker-sdk.sh b/eng/docker/build-docker-sdk.sh index c2cdb81efae9a3..92fc632ec05e2a 100755 --- a/eng/docker/build-docker-sdk.sh +++ b/eng/docker/build-docker-sdk.sh @@ -23,7 +23,6 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" imagename="dotnet-sdk-libs-current" configuration="Release" -privateaspnetcore=0 while [[ $# > 0 ]]; do opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")" @@ -36,10 +35,6 @@ while [[ $# > 0 ]]; do configuration=$2 shift 2 ;; - -privateaspnetcore|-pa) - privateaspnetcore=1 - shift 1 - ;; *) shift 1 ;; @@ -49,13 +44,9 @@ done repo_root=$(git rev-parse --show-toplevel) docker_file="$scriptroot/libraries-sdk.linux.Dockerfile" -if [[ $privateaspnetcore -eq 1 ]]; then - docker_file="$scriptroot/libraries-sdk-aspnetcore.linux.Dockerfile" -fi - docker build --tag $imagename \ --build-arg CONFIGURATION=$configuration \ --file $docker_file \ $repo_root -exit $? +exit $? \ No newline at end of file diff --git a/eng/docker/libraries-sdk-aspnetcore.linux.Dockerfile b/eng/docker/libraries-sdk-aspnetcore.linux.Dockerfile deleted file mode 100644 index 184ffdb8bcc8b4..00000000000000 --- a/eng/docker/libraries-sdk-aspnetcore.linux.Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -# Builds and copies library artifacts into target dotnet sdk image -ARG BUILD_BASE_IMAGE=mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-f39df28-20191023143754 -ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-bullseye-slim - -FROM $BUILD_BASE_IMAGE as corefxbuild - -WORKDIR /repo -COPY . . - -ARG CONFIGURATION=Release -RUN ./src/coreclr/build.sh -release -skiptests -clang9 && \ - ./libraries.sh -c $CONFIGURATION -runtimeconfiguration release - -FROM $SDK_BASE_IMAGE as target - -ARG TESTHOST_LOCATION=/repo/artifacts/bin/testhost -ARG TFM=net7.0 -ARG OS=Linux -ARG ARCH=x64 -ARG CONFIGURATION=Release - -ARG COREFX_SHARED_FRAMEWORK_NAME=Microsoft.NETCore.App -ARG ASPNETCORE_SHARED_NAME=Microsoft.AspNetCore.App -ARG SOURCE_COREFX_VERSION=7.0.0 -ARG TARGET_SHARED_FRAMEWORK=/usr/share/dotnet/shared -ARG TARGET_COREFX_VERSION=$DOTNET_VERSION - -COPY --from=corefxbuild \ - $TESTHOST_LOCATION/$TFM-$OS-$CONFIGURATION-$ARCH/shared/$COREFX_SHARED_FRAMEWORK_NAME/$SOURCE_COREFX_VERSION/* \ - $TARGET_SHARED_FRAMEWORK/$COREFX_SHARED_FRAMEWORK_NAME/$TARGET_COREFX_VERSION/ -COPY --from=corefxbuild \ - $TESTHOST_LOCATION/$TFM-$OS-$CONFIGURATION-$ARCH/shared/$COREFX_SHARED_FRAMEWORK_NAME/$SOURCE_COREFX_VERSION/* \ - $TARGET_SHARED_FRAMEWORK/$COREFX_SHARED_FRAMEWORK_NAME/$SOURCE_COREFX_VERSION/ -COPY --from=corefxbuild \ - $TESTHOST_LOCATION/$TFM-$OS-$CONFIGURATION-$ARCH/shared/$ASPNETCORE_SHARED_NAME/$SOURCE_COREFX_VERSION/* \ - $TARGET_SHARED_FRAMEWORK/$ASPNETCORE_SHARED_NAME/$TARGET_COREFX_VERSION/ \ No newline at end of file diff --git a/eng/docker/libraries-sdk-daily.windows.Dockerfile b/eng/docker/libraries-sdk-daily.windows.Dockerfile new file mode 100644 index 00000000000000..5a7e448388c7ea --- /dev/null +++ b/eng/docker/libraries-sdk-daily.windows.Dockerfile @@ -0,0 +1,28 @@ +# escape=` +# Simple Dockerfile which copies clr and library build artifacts into target dotnet sdk image +ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-nanoserver-1809 +FROM $SDK_BASE_IMAGE as target + +SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +USER ContainerAdministrator + +RUN Invoke-WebRequest -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile .\dotnet-install.ps1 +RUN & .\dotnet-install.ps1 -Channel 7.0.1xx -Quality daily -InstallDir 'C:/Program Files/dotnet' + +USER ContainerUser + +COPY . /live-runtime-artifacts + +ARG VERSION=7.0 +ARG CONFIGURATION=Release + +ENV _ASPNETCORE_SOURCE_DIR="C:/Program Files/dotnet/shared/Microsoft.AspNetCore.App/$VERSION*" +ENV _ASPNETCORE_DEST_DIR="C:/live-runtime-artifacts/testhost/net$VERSION-windows-$CONFIGURATION-x64/shared/Microsoft.AspNetCore.App" +RUN & New-Item -ItemType Directory -Path $env:_ASPNETCORE_DEST_DIR +RUN Copy-Item -Recurse -Path $env:_ASPNETCORE_SOURCE_DIR -Destination $env:_ASPNETCORE_DEST_DIR + +# COPY ./bin/microsoft.netcore.app.ref /live-runtime-artifacts/microsoft.netcore.app.ref +# COPY ./bin/microsoft.netcore.app.runtime.win-$ARCH /live-runtime-artifacts/microsoft.netcore.app.runtime.win-$ARCH +# COPY ./targetingpacks.targets /live-runtime-artifacts/targetingpacks.targets +# COPY ./bin/testhost /live-runtime-artifacts/testhost \ No newline at end of file diff --git a/eng/docker/libraries-sdk.linux.Dockerfile b/eng/docker/libraries-sdk.linux.Dockerfile index 6f79a9c39ee7c3..6c835a5c66e968 100644 --- a/eng/docker/libraries-sdk.linux.Dockerfile +++ b/eng/docker/libraries-sdk.linux.Dockerfile @@ -3,26 +3,55 @@ ARG BUILD_BASE_IMAGE=mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-f39df2 ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-bullseye-slim FROM $BUILD_BASE_IMAGE as corefxbuild - +ARG CONFIGURATION=Release WORKDIR /repo COPY . . -ARG CONFIGURATION=Release -RUN ./build.sh -ci -subset clr+libs -runtimeconfiguration release -c $CONFIGURATION +RUN ./build.sh clr+libs -runtimeconfiguration Release -configuration $CONFIGURATION -ci + +# Mocks: +# RUN mkdir -p /repo/artifacts/bin/testhost/net7.0-Linux-Release-x64 +# RUN echo 'lol' > /repo/artifacts/bin/testhost/lol.txt +# +# RUN mkdir -p /repo/artifacts/bin/microsoft.netcore.app.ref +# RUN echo 'rofl' > /repo/artifacts/bin/microsoft.netcore.app.ref/rofl.txt +# +# RUN mkdir -p /repo/artifacts/bin/microsoft.netcore.app.runtime.linux-x64 +# RUN echo 'haha' > /repo/artifacts/bin/microsoft.netcore.app.runtime.linux-x64/haha.txt FROM $SDK_BASE_IMAGE as target -ARG TESTHOST_LOCATION=/repo/artifacts/bin/testhost -ARG TFM=net7.0 -ARG OS=Linux +# Install 7.0 SDK: +RUN wget https://dot.net/v1/dotnet-install.sh +RUN bash ./dotnet-install.sh --channel 7.0.1xx --quality daily --install-dir /usr/share/dotnet + +## Collect the following artifacts under /live-runtime-artifacts, +## so projects can build and test against the live-built runtime: +## 1. Reference assembly pack (microsoft.netcore.app.ref) +## 2. Runtime pack (microsoft.netcore.app.runtime.linux-x64) +## 3. targetingpacks.targets, so stress test builds can target the live-built runtime instead of the one in the pre-installed SDK +## 4. testhost + +ARG VERSION=7.0 ARG ARCH=x64 ARG CONFIGURATION=Release -ARG COREFX_SHARED_FRAMEWORK_NAME=Microsoft.NETCore.App -ARG SOURCE_COREFX_VERSION=7.0.0 -ARG TARGET_SHARED_FRAMEWORK=/usr/share/dotnet/shared -ARG TARGET_COREFX_VERSION=$DOTNET_VERSION +COPY --from=corefxbuild \ + /repo/artifacts/bin/microsoft.netcore.app.ref \ + /live-runtime-artifacts/microsoft.netcore.app.ref + +COPY --from=corefxbuild \ + /repo/artifacts/bin/microsoft.netcore.app.runtime.linux-$ARCH \ + /live-runtime-artifacts/microsoft.netcore.app.runtime.linux-$ARCH COPY --from=corefxbuild \ - $TESTHOST_LOCATION/$TFM-$OS-$CONFIGURATION-$ARCH/shared/$COREFX_SHARED_FRAMEWORK_NAME/$SOURCE_COREFX_VERSION/* \ - $TARGET_SHARED_FRAMEWORK/$COREFX_SHARED_FRAMEWORK_NAME/$TARGET_COREFX_VERSION/ \ No newline at end of file + /repo/eng/targetingpacks.targets \ + /live-runtime-artifacts/targetingpacks.targets + +COPY --from=corefxbuild \ + /repo/artifacts/bin/testhost \ + /live-runtime-artifacts/testhost + +# Add AspNetCore bits to testhost: +RUN mkdir -p /live-runtime-artifacts/testhost/net$VERSION-Linux-$CONFIGURATION-$ARCH/shared/Microsoft.AspNetCore.App +RUN cp -r /usr/share/dotnet/shared/Microsoft.AspNetCore.App/$VERSION* /live-runtime-artifacts/testhost/net$VERSION-Linux-$CONFIGURATION-$ARCH/shared/Microsoft.AspNetCore.App \ No newline at end of file diff --git a/eng/pipelines/libraries/stress/http.yml b/eng/pipelines/libraries/stress/http.yml index 049c979b5e32fd..243271c6404ba1 100644 --- a/eng/pipelines/libraries/stress/http.yml +++ b/eng/pipelines/libraries/stress/http.yml @@ -50,15 +50,15 @@ jobs: name: buildStress displayName: Build HttpStress - - bash: | - cd '$(httpStressProject)' - export CLIENT_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/client/3.0" - export SERVER_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/server/3.0" - export HTTPSTRESS_CLIENT_ARGS="$HTTPSTRESS_CLIENT_ARGS -http 3.0" - export HTTPSTRESS_SERVER_ARGS="$HTTPSTRESS_SERVER_ARGS -http 3.0" - docker-compose up --abort-on-container-exit --no-color - displayName: Run HttpStress - HTTP 3.0 - condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true')) + # - bash: | + # cd '$(httpStressProject)' + # export CLIENT_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/client/3.0" + # export SERVER_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/server/3.0" + # export HTTPSTRESS_CLIENT_ARGS="$HTTPSTRESS_CLIENT_ARGS -http 3.0" + # export HTTPSTRESS_SERVER_ARGS="$HTTPSTRESS_SERVER_ARGS -http 3.0" + # docker-compose up --abort-on-container-exit --no-color + # displayName: Run HttpStress - HTTP 3.0 + # condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true')) - bash: | cd '$(httpStressProject)' @@ -149,4 +149,4 @@ jobs: - powershell: | Set-NetFirewallProfile -Profile Domain, Public, Private -Enabled True name: enableFirewall - displayName: Enable Firewall + displayName: Enable Firewall \ No newline at end of file diff --git a/src/libraries/System.Net.Http/ref/System.Net.Http.cs b/src/libraries/System.Net.Http/ref/System.Net.Http.cs index 0f63c2badb27ba..996e23a3c4f547 100644 --- a/src/libraries/System.Net.Http/ref/System.Net.Http.cs +++ b/src/libraries/System.Net.Http/ref/System.Net.Http.cs @@ -51,6 +51,7 @@ public partial class HttpClient : System.Net.Http.HttpMessageInvoker public HttpClient() : base (default(System.Net.Http.HttpMessageHandler)) { } public HttpClient(System.Net.Http.HttpMessageHandler handler) : base (default(System.Net.Http.HttpMessageHandler)) { } public HttpClient(System.Net.Http.HttpMessageHandler handler, bool disposeHandler) : base (default(System.Net.Http.HttpMessageHandler)) { } + public static bool DummyPropertyToTestLiveBuild { get; set; } public System.Uri? BaseAddress { get { throw null; } set { } } public static System.Net.IWebProxy DefaultProxy { get { throw null; } set { } } public System.Net.Http.Headers.HttpRequestHeaders DefaultRequestHeaders { get { throw null; } } diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs index 3b77aeafc0467b..77e6d39e65ff0e 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs @@ -36,6 +36,9 @@ public partial class HttpClient : HttpMessageInvoker #endregion Fields #region Properties + + public static bool DummyPropertyToTestLiveBuild { get; set; } + public static IWebProxy DefaultProxy { get => LazyInitializer.EnsureInitialized(ref s_defaultProxy, () => SystemProxyInfo.Proxy); diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Build-Local.ps1 b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Build-Local.ps1 new file mode 100644 index 00000000000000..98fc2f0bed4721 --- /dev/null +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Build-Local.ps1 @@ -0,0 +1,56 @@ +## This is a helper script for non-containerized local build and test execution. +## It downloads and uses the daily SDK which contains the compatible AspNetCore bits. +## Usage: +## ./build-local.ps1 [StressConfiguration] [LibrariesConfiguration] + +$Version="7.0" +$RepoRoot="$(git rev-parse --show-toplevel)" +$DailyDotnetRoot= "./.dotnet-daily" + +$StressConfiguration = "Release" +if (-not ([string]::IsNullOrEmpty($args[0]))) { + $StressConfiguration = $args[0] +} + +$LibrariesConfiguration = "Release" +if (-not ([string]::IsNullOrEmpty($args[1]))) { + $LibrariesConfiguration = $args[0] +} + +Write-Host "StressConfiguration: $StressConfiguration, LibrariesConfiguration: $LibrariesConfiguration" + +if (-not (Test-Path -Path $DailyDotnetRoot)) { + Write-Host "Downloading daily SDK to: $DailyDotnetRoot" + New-Item -ItemType Directory -Path $DailyDotnetRoot + Invoke-WebRequest -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile "$DailyDotnetRoot\dotnet-install.ps1" + & "$DailyDotnetRoot\dotnet-install.ps1" -NoPath -Channel "$Version.1xx" -Quality daily -InstallDir $DailyDotnetRoot +} +else { + Write-Host "Daily SDK found in $DailyDotnetRoot" +} + +$TestHostRoot="$RepoRoot/artifacts/bin/testhost/net$Version-windows-$LibrariesConfiguration-x64" + +$env:DOTNET_ROOT=$DailyDotnetRoot +$env:PATH="$DailyDotnetRoot;$env:PATH" +$env:DOTNET_MULTILEVEL_LOOKUP=0 + +if (-not (Test-Path -Path "$TestHostRoot/shared/Microsoft.AspNetCore.App")) { + Write-Host "Copying Microsoft.AspNetCore.App bits from daily SDK to testhost: $TestHostRoot" + Copy-Item -Recurse -Path "$DailyDotnetRoot/shared/Microsoft.AspNetCore.App" -Destination "$TestHostRoot/shared" +} +else { + Write-Host "Microsoft.AspNetCore.App found in testhost: $TestHostRoot" +} + +Write-Host "Building solution." +dotnet build -c $StressConfiguration + +$Runscript=".\run-stress-$LibrariesConfiguration-$StressConfiguration.ps1" +if (-not (Test-Path $Runscript)) { + Write-Host "Generating Runscript." + Add-Content -Path $Runscript -Value "& '$TestHostRoot/dotnet' exec ./bin/$StressConfiguration/net$Version/HttpStress.dll `$args" +} + +Write-Host "To run tests type:" +Write-Host "$Runscript [stress test args]" \ No newline at end of file diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props index 8998bf4546770d..cf816f6aa2c593 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props @@ -1 +1,16 @@ - + + + linux-x64 + win-x64 + osx-x64 + + ../../../../../../eng/targetingpacks.targets + 7.0.0 + net7.0 + 7.0 + Microsoft.NETCore.App + ../../../../../../artifacts/bin/microsoft.netcore.app.ref/ + ../../../../../../artifacts/bin/microsoft.netcore.app.runtime.$(PackageRid)/$(Configuration)/ + + + diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.targets b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.targets index 8998bf4546770d..bc43343b2c088e 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.targets +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.targets @@ -1 +1,11 @@ - + + + + + + 7.0 + + diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile index 089047be6964b4..54821d38e89185 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile @@ -19,8 +19,14 @@ RUN unzip $PACKAGES_DIR.zip RUN dpkg -i $PACKAGES_DIR/$MSQUIC_PACKAGE RUN rm -rf $PACKAGES_DIR* +ARG VERSION=7.0 ARG CONFIGURATION=Release -RUN dotnet build -c $CONFIGURATION +ARG ARCH=x64 + +RUN dotnet build -c $CONFIGURATION \ + -p:TargetingPacksTargetsLocation=/live-runtime-artifacts/targetingpacks.targets \ + -p:MicrosoftNetCoreAppRefPackDir=/live-runtime-artifacts/microsoft.netcore.app.ref/ \ + -p:MicrosoftNetCoreAppRuntimePackDir=/live-runtime-artifacts/microsoft.netcore.app.runtime.linux-$ARCH/$CONFIGURATION/ # Enable dump collection ENV COMPlus_DbgEnableMiniDump=1 @@ -29,6 +35,8 @@ ENV COMPlus_DbgMiniDumpName="/share/coredump.%p" EXPOSE 5001 +ENV VERSION=$VERSION ENV CONFIGURATION=$CONFIGURATION +ENV ARCH=$ARCH ENV HTTPSTRESS_ARGS='' -CMD dotnet run --no-build -c $CONFIGURATION -- $HTTPSTRESS_ARGS +CMD /live-runtime-artifacts/testhost/net$VERSION-Linux-$CONFIGURATION-$ARCH/dotnet exec ./bin/$CONFIGURATION/net$VERSION/HttpStress.dll $HTTPSTRESS_ARGS diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj index 39774f26b2313a..08b3f91feb9667 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj @@ -1,11 +1,12 @@ - - + + Exe - net6.0 + $(NetCoreAppCurrent) + preview enable - True + True @@ -22,4 +23,37 @@ + + + + + + + + + + + + + + + + + + + + + + + false + false + false + false + false + false + false + false + false + + diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs index b411d637a54f14..d2904ef525e7b4 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs @@ -28,6 +28,7 @@ public enum ExitCode { Success = 0, StressError = 1, CliError = 2 }; public static async Task Main(string[] args) { + Console.WriteLine("Does it work?"); if (!TryParseCli(args, out Configuration? config)) { return (int)ExitCode.CliError; diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Readme.md b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Readme.md index ec19d321160553..bc1a0490d9b6dd 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Readme.md +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Readme.md @@ -1,41 +1,49 @@ ## HttpStress -Provides stress testing scenaria for System.Net.Http.HttpClient, with emphasis on the HTTP/2 implementation of SocketsHttpHandler. +Provides stress testing scenaria for System.Net.Http.HttpClient and the underlying SocketsHttpHandler. ### Running the suite locally -Using the command line, +Prerequisite: the runtime and the libraries should be [live-built](https://github.com/dotnet/runtime/tree/main/docs/workflow/building/libraries) with `build.cmd`/`build.sh`. + +Use the script `build-local.sh` / `Build-Local.ps1` to build the stress project against the live-built runtime. This will acquire the latest daily SDK, which is TFM-compatible with the live-built runtime. + +```bash +$ build-local.sh [StressConfiguration] [LibrariesConfiguration] +``` + +The build script will also generate the runscript that runs the stress suite using the locally built testhost in the form of `run-stress--.sh`. To run the tests with the script, assuming that both the stress project and the libraries have been built against Release configuration: ```bash -$ dotnet run -- +$ run-stress-Release-Release.sh [stress suite args] ``` To get the full list of available parameters: ```bash -$ dotnet run -- -help +$ run-stress-Release-Release.sh.sh -help ``` -### Running with local runtime builds +### Building and running with Docker -Note that the stress suite will test the sdk available in the environment, -that is to say it will not necessarily test the implementation of the local runtime repo. -To achieve this, we will first need to build a new sdk from source. This can be done [using docker](https://github.com/dotnet/runtime/blob/main/eng/docker/Readme.md). +A docker image containing the live-built runtime bits and the latest daily SDK is created with the [`build-docker-sdk.sh/ps1` scripts](https://github.com/dotnet/runtime/blob/main/eng/docker/Readme.md). -### Running using docker-compose +It's possible to manually `docker build` a docker image containing the stress project based on the docker image created with `build-docker-sdk.sh/ps1`, however the preferred way is to use docker-compose, which can be used to target both linux and windows containers. -The preferred way of running the stress suite is using docker-compose, -which can be used to target both linux and windows containers. Docker and compose-compose are required for this step (both included in [docker for windows](https://docs.docker.com/docker-for-windows/)). #### Using Linux containers -From the stress folder on powershell: +From the stress folder: ```powershell PS> .\run-docker-compose.ps1 -b ``` +```bash +$ ./run-docker-compose.sh -b +``` + This will build libraries and stress suite to a linux docker image and initialize a stress run using docker-compose. #### Using Windows containers diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs index 76176390615a01..bc4e5594811b74 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs @@ -32,6 +32,7 @@ public class StressClient : IDisposable public StressClient((string name, Func operation)[] clientOperations, Configuration configuration) { + HttpClient.DummyPropertyToTestLiveBuild = true; _clientOperations = clientOperations; _config = configuration; _baseAddress = new Uri(configuration.ServerUri); diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressServer.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressServer.cs index c55936e051ff16..a54c0cab78c482 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressServer.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressServer.cs @@ -41,6 +41,9 @@ public class StressServer : IDisposable public StressServer(Configuration configuration) { + // Force loading System.Security.Cryptography.Encoding + _ = new Oid(); + ServerUri = configuration.ServerUri; (string scheme, string hostname, int port) = ParseServerUri(configuration.ServerUri); IWebHostBuilder host = WebHost.CreateDefaultBuilder(); diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.sh b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.sh new file mode 100755 index 00000000000000..0c7902d14c2e46 --- /dev/null +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash + +## This is a helper script for non-containerized local build and test execution. +## It downloads and uses the daily SDK which contains the compatible AspNetCore bits. +## Usage: +## ./build-local.sh [StressConfiguration] [LibrariesConfiguration] + +version=7.0 +repo_root=$(git rev-parse --show-toplevel) +daily_dotnet_root=./.dotnet-daily + +stress_configuration="Release" +if [ "$1" != "" ] +then + stress_configuration=${1,,} # Lowercase all characters in $1 + stress_configuration=${stress_configuration^} # Uppercase first character +fi + +libraries_configuration="Release" +if [ "$2" != "" ] +then + libraries_configuration=${2,,} # Lowercase all characters in $1 + libraries_configuration=${libraries_configuration^} # Uppercase first character +fi + +echo "StressConfiguration: $stress_configuration, LibrariesConfiguration: $libraries_configuration" + +if [ ! -d $daily_dotnet_root ]; +then + echo "Downloading daily SDK to $daily_dotnet_root" + mkdir $daily_dotnet_root + wget https://dot.net/v1/dotnet-install.sh -O $daily_dotnet_root/dotnet-install.sh + bash $daily_dotnet_root/dotnet-install.sh --no-path --channel $version.1xx --quality daily --install-dir $daily_dotnet_root +else + echo "Daily SDK found in $daily_dotnet_root" +fi + +testhost_root=$repo_root/artifacts/bin/testhost/net$version-Linux-$libraries_configuration-x64 + +export DOTNET_ROOT=$daily_dotnet_root +export PATH=$DOTNET_ROOT:$PATH +export DOTNET_MULTILEVEL_LOOKUP=0 + +if [ ! -d "$testhost_root/shared/Microsoft.AspNetCore.App" ] +then + echo "Copying Microsoft.AspNetCore.App bits from daily SDK to testhost: $testhost_root" + cp -r $daily_dotnet_root/shared/Microsoft.AspNetCore.App $testhost_root/shared/Microsoft.AspNetCore.App +else + echo "Microsoft.AspNetCore.App found in testhost: $testhost_root" +fi + +echo "Building solution." +dotnet build -c $stress_configuration + +runscript=./run-stress-${stress_configuration,,}-${libraries_configuration,,}.sh +if [ ! -f $runscript ] +then + echo "Generating runscript." + echo "$testhost_root/dotnet exec ./bin/$stress_configuration/net$version/HttpStress.dll \$@" > $runscript + chmod +x $runscript +fi + +echo "To run tests type:" +echo "$runscript [stress test args]" \ No newline at end of file diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/load-corefx-testhost.ps1 b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/load-corefx-testhost.ps1 old mode 100644 new mode 100755 diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/run-docker-compose.sh b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/run-docker-compose.sh index 5c3ba48758be84..a99b4c4e31726d 100755 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/run-docker-compose.sh +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/run-docker-compose.sh @@ -22,7 +22,6 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" imagename="dotnet-sdk-libs-current" configuration="Release" -privateaspnetcore=0 buildcurrentlibraries=0 buildonly=0 clientstressargs="" @@ -39,10 +38,6 @@ while [[ $# > 0 ]]; do configuration=$2 shift 2 ;; - -privateaspnetcore|-pa) - privateaspnetcore=1 - shift 1 - ;; -buildcurrentlibraries|-b) buildcurrentlibraries=1 shift 1 @@ -69,17 +64,10 @@ repo_root=$(git rev-parse --show-toplevel) if [[ buildcurrentlibraries -eq 1 ]]; then libraries_args=" -t $imagename -c $configuration" - if [[ $privateaspnetcore -eq 1 ]]; then - libraries_args="$libraries_args -pa" - fi if ! $repo_root/eng/docker/build-docker-sdk.sh $libraries_args; then exit 1 fi - -elif [[ $privateaspnetcore -eq 1 ]]; then - echo "Using a private Asp.Net Core package (-pa) requires using privately built libraries. Please, enable it with -b switch." - exit 1 fi build_args="" diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/windows.Dockerfile b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/windows.Dockerfile index 2c16d6c0d7209e..8d13a83964225a 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/windows.Dockerfile +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/windows.Dockerfile @@ -11,8 +11,17 @@ RUN echo "DOTNET_VERSION="$env:DOTNET_VERSION WORKDIR /app COPY . . +# ARG CONFIGURATION=Release +# RUN dotnet build -c $env:CONFIGURATION +ARG VERSION=7.0 +ENV VERSION=$VERSION ARG CONFIGURATION=Release -RUN dotnet build -c $env:CONFIGURATION +ENV CONFIGURATION=$CONFIGURATION + +RUN dotnet build -c $env:CONFIGURATION ` + -p:TargetingPacksTargetsLocation=C:/live-runtime-artifacts/targetingpacks.targets ` + -p:MicrosoftNetCoreAppRefPackDir=C:/live-runtime-artifacts/microsoft.netcore.app.ref/ ` + -p:MicrosoftNetCoreAppRuntimePackDir=C:/live-runtime-artifacts/microsoft.netcore.app.runtime.win-x64/$env:CONFIGURATION/ # Enable dump collection ENV COMPlus_DbgEnableMiniDump=1 @@ -21,6 +30,11 @@ ENV COMPlus_DbgMiniDumpName="C:/share/coredump.%p" EXPOSE 5001 +# ENV CONFIGURATION=$CONFIGURATION +# ENV HTTPSTRESS_ARGS="" +# CMD dotnet run --no-build -c $env:CONFIGURATION -- $env:HTTPSTRESS_ARGS.Split() + +ENV VERSION=$VERSION ENV CONFIGURATION=$CONFIGURATION ENV HTTPSTRESS_ARGS="" -CMD dotnet run --no-build -c $env:CONFIGURATION -- $env:HTTPSTRESS_ARGS.Split() +CMD & C:/live-runtime-artifacts/testhost/net$env:VERSION-windows-$env:CONFIGURATION-x64/dotnet.exe exec ./bin/$env:CONFIGURATION/net$env:VERSION/HttpStress.dll $env:HTTPSTRESS_ARGS.Split() diff --git a/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Directory.Build.props b/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Directory.Build.props new file mode 100644 index 00000000000000..5a1b7e92c1f341 --- /dev/null +++ b/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Directory.Build.props @@ -0,0 +1,17 @@ + + + $([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier) + linux-x64 + win-x64 + osx-x64 + + ../../../../../../eng/targetingpacks.targets + 7.0.0 + net7.0 + 7.0 + Microsoft.NETCore.App + ../../../../../../artifacts/bin/microsoft.netcore.app.ref/ + ../../../../../../artifacts/bin/microsoft.netcore.app.runtime.$(PackageRid)/$(Configuration)/ + + + diff --git a/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Directory.Build.targets b/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Directory.Build.targets new file mode 100644 index 00000000000000..bc43343b2c088e --- /dev/null +++ b/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Directory.Build.targets @@ -0,0 +1,11 @@ + + + + + + 7.0 + + diff --git a/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Dockerfile b/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Dockerfile new file mode 100644 index 00000000000000..4a000303f0bf76 --- /dev/null +++ b/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Dockerfile @@ -0,0 +1,4 @@ +FROM test03 + +WORKDIR /app +COPY . . diff --git a/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/LiveBuildTest.csproj b/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/LiveBuildTest.csproj new file mode 100644 index 00000000000000..0d699e50c3307d --- /dev/null +++ b/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/LiveBuildTest.csproj @@ -0,0 +1,28 @@ + + + + Exe + $(NetCoreAppCurrent) + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Program.cs b/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Program.cs new file mode 100644 index 00000000000000..9aae0259c2a1ed --- /dev/null +++ b/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Program.cs @@ -0,0 +1,17 @@ +using System; + +namespace LiveBuildTest +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("--------"); + if (args.Length > 0) + { + Console.WriteLine(args[0]); + } + Console.WriteLine(typeof(string).Assembly.Location); + } + } +} diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Build-Local.ps1 b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Build-Local.ps1 new file mode 100644 index 00000000000000..87c3548a9bd04f --- /dev/null +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Build-Local.ps1 @@ -0,0 +1,38 @@ +## This is a helper script for non-containerized local build and test execution. +## It downloads and uses the daily SDK which contains the compatible AspNetCore bits. +## Usage: +## ./build-local.ps1 [StressConfiguration] [LibrariesConfiguration] + +# Note that this script does much less than it's counterpart in HttpStress. +# In SslStress it's a thin utility to generate a runscript for running the app with the live-built testhost. +# The main reason to use an equivalent solution in SslStress is consistency with HttpStress. + +$Version="7.0" +$RepoRoot="$(git rev-parse --show-toplevel)" +$DailyDotnetRoot= "./.dotnet-daily" + +$StressConfiguration = "Release" +if (-not ([string]::IsNullOrEmpty($args[0]))) { + $StressConfiguration = $args[0] +} + +$LibrariesConfiguration = "Release" +if (-not ([string]::IsNullOrEmpty($args[1]))) { + $LibrariesConfiguration = $args[0] +} + +Write-Host "StressConfiguration: $StressConfiguration, LibrariesConfiguration: $LibrariesConfiguration" + +$TestHostRoot="$RepoRoot/artifacts/bin/testhost/net$Version-windows-$LibrariesConfiguration-x64" + +Write-Host "Building solution." +dotnet build -c $StressConfiguration + +$Runscript=".\run-stress-$LibrariesConfiguration-$StressConfiguration.ps1" +if (-not (Test-Path $Runscript)) { + Write-Host "Generating Runscript." + Add-Content -Path $Runscript -Value "& '$TestHostRoot/dotnet' exec ./bin/$StressConfiguration/net$Version/SslStress.dll `$args" +} + +Write-Host "To run tests type:" +Write-Host "$Runscript [stress test args]" \ No newline at end of file diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.props b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.props index 8998bf4546770d..cf816f6aa2c593 100644 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.props +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.props @@ -1 +1,16 @@ - + + + linux-x64 + win-x64 + osx-x64 + + ../../../../../../eng/targetingpacks.targets + 7.0.0 + net7.0 + 7.0 + Microsoft.NETCore.App + ../../../../../../artifacts/bin/microsoft.netcore.app.ref/ + ../../../../../../artifacts/bin/microsoft.netcore.app.runtime.$(PackageRid)/$(Configuration)/ + + + diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.targets b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.targets index 8998bf4546770d..bc43343b2c088e 100644 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.targets +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.targets @@ -1 +1,11 @@ - + + + + + + 7.0 + + diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Dockerfile b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Dockerfile index 8e97f642a73b4e..2f26960ee819b1 100644 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Dockerfile +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Dockerfile @@ -8,11 +8,20 @@ WORKDIR /app COPY . . WORKDIR /app/System.Net.Security/tests/StressTests/SslStress +ARG VERSION=7.0 ARG CONFIGURATION=Release -RUN dotnet build -c $CONFIGURATION +ARG ARCH=x64 + +RUN dotnet build -c $CONFIGURATION \ + -p:TargetingPacksTargetsLocation=/live-runtime-artifacts/targetingpacks.targets \ + -p:MicrosoftNetCoreAppRefPackDir=/live-runtime-artifacts/microsoft.netcore.app.ref/ \ + -p:MicrosoftNetCoreAppRuntimePackDir=/live-runtime-artifacts/microsoft.netcore.app.runtime.linux-$ARCH/$CONFIGURATION/ EXPOSE 5001 +ENV VERSION=$VERSION ENV CONFIGURATION=$CONFIGURATION +ENV ARCH=$ARCH ENV SSLSTRESS_ARGS='' -CMD dotnet run --no-build -c $CONFIGURATION -- $SSLSTRESS_ARGS + +CMD /live-runtime-artifacts/testhost/net$VERSION-Linux-$CONFIGURATION-$ARCH/dotnet exec ./bin/$CONFIGURATION/net$VERSION/SslStress.dll $SSLSTRESS_ARGS \ No newline at end of file diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Readme.md b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Readme.md index 18ed7562ace345..f58d5089a3c9a3 100644 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Readme.md +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Readme.md @@ -4,39 +4,47 @@ Provides stress testing scenaria for System.Net.Security.SslStream. ### Running the suite locally -Using the command line, +Prerequisite: the runtime and the libraries should be [live-built](https://github.com/dotnet/runtime/tree/main/docs/workflow/building/libraries) with `build.cmd`/`build.sh`. + +Use the script `build-local.sh` / `Build-Local.ps1` to build the stress project against the live-built runtime. + +```bash +$ build-local.sh [StressConfiguration] [LibrariesConfiguration] +``` + +The build script will also generate the runscript that runs the stress suite using the locally built testhost in the form of `run-stress--.sh`. To run the tests with the script, assuming that both the stress project and the libraries have been built against Release configuration: ```bash -$ dotnet run -- +$ run-stress-Release-Release.sh [stress suite args] ``` To get the full list of available parameters: ```bash -$ dotnet run -- -help +$ run-stress-Release-Release.sh.sh -help ``` -### Running with local runtime builds +### Building and running with Docker -Note that the stress suite will test the sdk available in the environment, -that is to say it will not necessarily test the implementation of the local runtime repo. -To achieve this, we will first need to build a new sdk from source. This can be done [using docker](https://github.com/dotnet/runtime/blob/main/eng/docker/Readme.md). +A docker image containing the live-built runtime bits and the latest daily SDK is created with the [`build-docker-sdk.sh/ps1` scripts](https://github.com/dotnet/runtime/blob/main/eng/docker/Readme.md). -### Running using docker-compose +It's possible to manually `docker build` a docker image containing the stress project based on the docker image created with `build-docker-sdk.sh/ps1`, however the preferred way is to use docker-compose, which can be used to target both linux and windows containers. -The preferred way of running the stress suite is using docker-compose, -which can be used to target both linux and windows containers. Docker and compose-compose are required for this step (both included in [docker for windows](https://docs.docker.com/docker-for-windows/)). #### Using Linux containers -From the stress folder on powershell: +From the stress folder: ```powershell PS> .\run-docker-compose.ps1 -b ``` -This will build the libraries and stress suite to a linux docker image and initialize a stress run using docker-compose. +```bash +$ ./run-docker-compose.sh -b +``` + +This will build libraries and stress suite to a linux docker image and initialize a stress run using docker-compose. #### Using Windows containers @@ -53,4 +61,4 @@ For more details on how the `run-docker-compose.ps1` script can be used: ```powershell Get-Help .\run-docker-compose.ps1 -``` +``` \ No newline at end of file diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/SslStress.csproj b/src/libraries/System.Net.Security/tests/StressTests/SslStress/SslStress.csproj index 8b0a7a0aea1882..c2ba4576af2491 100644 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/SslStress.csproj +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/SslStress.csproj @@ -1,7 +1,8 @@ Exe - net6.0 + + $(NetCoreAppCurrent) enable diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/build-local.sh b/src/libraries/System.Net.Security/tests/StressTests/SslStress/build-local.sh new file mode 100755 index 00000000000000..d7fb4cabc37acd --- /dev/null +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/build-local.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +## This is a helper script for non-containerized local build and test execution. +## Usage: +## ./build-local.sh [Configuration] + +# Note that this script does much less than it's counterpart in HttpStress. +# In SslStress it's a thin utility to generate a runscript for running the app with the live-built testhost. +# The main reason to use an equivalent solution in SslStress is consistency with HttpStress. + +version=7.0 +repo_root=$(git rev-parse --show-toplevel) + +stress_configuration="Release" +if [ "$1" != "" ] +then + stress_configuration=${1,,} # Lowercase all characters in $1 + stress_configuration=${stress_configuration^} # Uppercase first character +fi + +libraries_configuration="Release" +if [ "$2" != "" ] +then + libraries_configuration=${2,,} # Lowercase all characters in $1 + libraries_configuration=${libraries_configuration^} # Uppercase first character +fi + +echo "StressConfiguration: $stress_configuration, LibrariesConfiguration: $libraries_configuration" + +echo "Building solution." +dotnet build -c $stress_configuration + +testhost_root=$repo_root/artifacts/bin/testhost/net$version-Linux-$libraries_configuration-x64 + +runscript=./run-stress-${stress_configuration,,}-${libraries_configuration,,}.sh +if [ ! -f $runscript ] +then + echo "Generating runscript." + echo "$testhost_root/dotnet exec ./bin/$stress_configuration/net$version/SslStress.dll \$@" > $runscript + chmod +x $runscript +fi + +echo "To run tests type:" +echo "$runscript [stress test args]" \ No newline at end of file diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/run-docker-compose.sh b/src/libraries/System.Net.Security/tests/StressTests/SslStress/run-docker-compose.sh index e18b80fca1dc35..dd18b894cdf293 100755 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/run-docker-compose.sh +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/run-docker-compose.sh @@ -22,7 +22,6 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" imagename="dotnet-sdk-libs-current" configuration="Release" -privateaspnetcore=0 buildcurrentlibraries=0 buildonly=0 clientstressargs="" @@ -39,10 +38,6 @@ while [[ $# > 0 ]]; do configuration=$2 shift 2 ;; - -privateaspnetcore|-pa) - privateaspnetcore=1 - shift 1 - ;; -buildcurrentlibraries|-b) buildcurrentlibraries=1 shift 1 @@ -69,17 +64,10 @@ repo_root=$(git rev-parse --show-toplevel) if [[ buildcurrentlibraries -eq 1 ]]; then libraries_args=" -t $imagename -c $configuration" - if [[ $privateaspnetcore -eq 1 ]]; then - libraries_args="$libraries_args -pa" - fi if ! $repo_root/eng/docker/build-docker-sdk.sh $libraries_args; then exit 1 fi - -elif [[ $privateaspnetcore -eq 1 ]]; then - echo "Using a private Asp.Net Core package (-pa) requires using privately built libraries. Please, enable it with -b switch." - exit 1 fi build_args="" From 72c0b8121944afbf440cd7aee0e86ea3e6f6216d Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Tue, 16 Nov 2021 15:43:57 +0100 Subject: [PATCH 02/19] cleanup container scripts --- eng/docker/build-docker-sdk.ps1 | 45 ++++++++++--------- ...ibraries-sdk-aspnetcore.windows.Dockerfile | 26 ----------- .../libraries-sdk-daily.windows.Dockerfile | 28 ------------ eng/docker/libraries-sdk.linux.Dockerfile | 22 +++------ eng/docker/libraries-sdk.windows.Dockerfile | 28 +++++++----- eng/pipelines/libraries/stress/http.yml | 18 ++++---- 6 files changed, 54 insertions(+), 113 deletions(-) delete mode 100644 eng/docker/libraries-sdk-aspnetcore.windows.Dockerfile delete mode 100644 eng/docker/libraries-sdk-daily.windows.Dockerfile diff --git a/eng/docker/build-docker-sdk.ps1 b/eng/docker/build-docker-sdk.ps1 index c9c83577c0f255..f293f83d881aed 100755 --- a/eng/docker/build-docker-sdk.ps1 +++ b/eng/docker/build-docker-sdk.ps1 @@ -6,21 +6,16 @@ Param( [string][Alias('t')]$imageName = "dotnet-sdk-libs-current", [string][Alias('c')]$configuration = "Release", - [switch][Alias('w')]$buildWindowsContainers, - [switch][Alias('ds')]$dailySdk + [switch][Alias('w')]$buildWindowsContainers ) +$dotNetVersion="7.0" $ErrorActionPreference = "Stop" $REPO_ROOT_DIR=$(git -C "$PSScriptRoot" rev-parse --show-toplevel) $dockerFilePrefix="$PSScriptRoot/libraries-sdk" -if ($dailySdk) -{ - $dockerFilePrefix="$PSScriptRoot/libraries-sdk-daily" -} - if ($buildWindowsContainers) { # Due to size concerns, we don't currently do docker builds on windows. @@ -33,30 +28,36 @@ if ($buildWindowsContainers) exit $LASTEXITCODE } - $dockerFile="$dockerFilePrefix-daily.windows.Dockerfile" + $dockerFile="$dockerFilePrefix.windows.Dockerfile" - ## Collect the following artifacts under to a special folder that and copy it to the container, - ## so projects can build and test against the live-built runtime: - ## 1. Reference assembly pack (microsoft.netcore.app.ref) - ## 2. Runtime pack (microsoft.netcore.app.runtime.linux-x64) - ## 3. targetingpacks.targets, so stress test builds can target the live-built runtime instead of the one in the pre-installed SDK - ## 4. testhost + # Collect the following artifacts to folder, that will be used as build context for the container, + # so projects can build and test against the live-built runtime: + # 1. Reference assembly pack (microsoft.netcore.app.ref) + # 2. Runtime pack (microsoft.netcore.app.runtime.linux-x64) + # 3. targetingpacks.targets, so stress test builds can target the live-built runtime instead of the one in the pre-installed SDK + # 4. testhost $binArtifacts = "$REPO_ROOT_DIR\artifacts\bin" - $dockerArtifacts = "$REPO_ROOT_DIR\artifacts\docker-context" + $dockerContext = "$REPO_ROOT_DIR\artifacts\docker-context" - if (Test-Path $dockerArtifacts) { - Remove-Item -Recurse -Force $dockerArtifacts + if (Test-Path $dockerContext) { + Remove-Item -Recurse -Force $dockerContext } - Copy-Item -Recurse -Destination $dockerArtifacts\microsoft.netcore.app.ref -Path $binArtifacts\microsoft.netcore.app.ref - Copy-Item -Recurse -Destination $dockerArtifacts\microsoft.netcore.app.runtime.win-x64 -Path $binArtifacts\microsoft.netcore.app.runtime.win-x64 - Copy-Item -Recurse -Destination $dockerArtifacts\testhost -Path $binArtifacts\testhost - Copy-Item -Recurse -Destination $dockerArtifacts\targetingpacks.targets -Path $REPO_ROOT_DIR\eng\targetingpacks.targets + Copy-Item -Recurse -Destination $dockerContext\microsoft.netcore.app.ref -Path $binArtifacts\microsoft.netcore.app.ref + Copy-Item -Recurse -Destination $dockerContext\microsoft.netcore.app.runtime.win-x64 -Path $binArtifacts\microsoft.netcore.app.runtime.win-x64 + Copy-Item -Recurse -Destination $dockerContext\testhost -Path $binArtifacts\testhost + Copy-Item -Recurse -Destination $dockerContext\targetingpacks.targets -Path $REPO_ROOT_DIR\eng\targetingpacks.targets + + # In case of non-CI builds, testhost may already contain Microsoft.AspNetCore.App (see Build-Local.ps1 in HttpStress): + $testHostAspNetCorePath="$dockerContext\testhost\net$dotNetVersion-windows-$configuration-x64/shared/Microsoft.AspNetCore.App" + if (Test-Path $testHostAspNetCorePath) { + Remove-Item -Recurse -Force $testHostAspNetCorePath + } docker build --tag $imageName ` --build-arg CONFIGURATION=$configuration ` --file $dockerFile ` - $dockerArtifacts + $dockerContext } else { diff --git a/eng/docker/libraries-sdk-aspnetcore.windows.Dockerfile b/eng/docker/libraries-sdk-aspnetcore.windows.Dockerfile deleted file mode 100644 index 75cc112b6acb3e..00000000000000 --- a/eng/docker/libraries-sdk-aspnetcore.windows.Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -# escape=` -# Simple Dockerfile which copies library build artifacts into target dotnet sdk image -ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-nanoserver-1809 -FROM $SDK_BASE_IMAGE as target - -ARG TESTHOST_LOCATION=".\\artifacts\\bin\\testhost" -ARG TFM=net7.0 -ARG OS=windows -ARG ARCH=x64 -ARG CONFIGURATION=Release - -ARG COREFX_SHARED_FRAMEWORK_NAME=Microsoft.NETCore.App -ARG ASPNETCORE_SHARED_NAME=Microsoft.AspNetCore.App -ARG SOURCE_COREFX_VERSION=7.0.0 -ARG TARGET_SHARED_FRAMEWORK="C:\\Program Files\\dotnet\\shared" -ARG TARGET_COREFX_VERSION=$DOTNET_VERSION - -COPY ` - $TESTHOST_LOCATION\$TFM-$OS-$CONFIGURATION-$ARCH\shared\$COREFX_SHARED_FRAMEWORK_NAME\$SOURCE_COREFX_VERSION\ ` - $TARGET_SHARED_FRAMEWORK\$COREFX_SHARED_FRAMEWORK_NAME\$TARGET_COREFX_VERSION\ -COPY ` - $TESTHOST_LOCATION\$TFM-$OS-$CONFIGURATION-$ARCH\shared\$COREFX_SHARED_FRAMEWORK_NAME\$SOURCE_COREFX_VERSION\ ` - $TARGET_SHARED_FRAMEWORK\$COREFX_SHARED_FRAMEWORK_NAME\$SOURCE_COREFX_VERSION\ -COPY ` - $TESTHOST_LOCATION\$TFM-$OS-$CONFIGURATION-$ARCH\shared\$ASPNETCORE_SHARED_NAME\$SOURCE_COREFX_VERSION\ ` - $TARGET_SHARED_FRAMEWORK\$ASPNETCORE_SHARED_NAME\$TARGET_COREFX_VERSION\ diff --git a/eng/docker/libraries-sdk-daily.windows.Dockerfile b/eng/docker/libraries-sdk-daily.windows.Dockerfile deleted file mode 100644 index 5a7e448388c7ea..00000000000000 --- a/eng/docker/libraries-sdk-daily.windows.Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -# escape=` -# Simple Dockerfile which copies clr and library build artifacts into target dotnet sdk image -ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-nanoserver-1809 -FROM $SDK_BASE_IMAGE as target - -SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] - -USER ContainerAdministrator - -RUN Invoke-WebRequest -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile .\dotnet-install.ps1 -RUN & .\dotnet-install.ps1 -Channel 7.0.1xx -Quality daily -InstallDir 'C:/Program Files/dotnet' - -USER ContainerUser - -COPY . /live-runtime-artifacts - -ARG VERSION=7.0 -ARG CONFIGURATION=Release - -ENV _ASPNETCORE_SOURCE_DIR="C:/Program Files/dotnet/shared/Microsoft.AspNetCore.App/$VERSION*" -ENV _ASPNETCORE_DEST_DIR="C:/live-runtime-artifacts/testhost/net$VERSION-windows-$CONFIGURATION-x64/shared/Microsoft.AspNetCore.App" -RUN & New-Item -ItemType Directory -Path $env:_ASPNETCORE_DEST_DIR -RUN Copy-Item -Recurse -Path $env:_ASPNETCORE_SOURCE_DIR -Destination $env:_ASPNETCORE_DEST_DIR - -# COPY ./bin/microsoft.netcore.app.ref /live-runtime-artifacts/microsoft.netcore.app.ref -# COPY ./bin/microsoft.netcore.app.runtime.win-$ARCH /live-runtime-artifacts/microsoft.netcore.app.runtime.win-$ARCH -# COPY ./targetingpacks.targets /live-runtime-artifacts/targetingpacks.targets -# COPY ./bin/testhost /live-runtime-artifacts/testhost \ No newline at end of file diff --git a/eng/docker/libraries-sdk.linux.Dockerfile b/eng/docker/libraries-sdk.linux.Dockerfile index 6c835a5c66e968..89193e157cb9f2 100644 --- a/eng/docker/libraries-sdk.linux.Dockerfile +++ b/eng/docker/libraries-sdk.linux.Dockerfile @@ -9,28 +9,18 @@ COPY . . RUN ./build.sh clr+libs -runtimeconfiguration Release -configuration $CONFIGURATION -ci -# Mocks: -# RUN mkdir -p /repo/artifacts/bin/testhost/net7.0-Linux-Release-x64 -# RUN echo 'lol' > /repo/artifacts/bin/testhost/lol.txt -# -# RUN mkdir -p /repo/artifacts/bin/microsoft.netcore.app.ref -# RUN echo 'rofl' > /repo/artifacts/bin/microsoft.netcore.app.ref/rofl.txt -# -# RUN mkdir -p /repo/artifacts/bin/microsoft.netcore.app.runtime.linux-x64 -# RUN echo 'haha' > /repo/artifacts/bin/microsoft.netcore.app.runtime.linux-x64/haha.txt - FROM $SDK_BASE_IMAGE as target # Install 7.0 SDK: RUN wget https://dot.net/v1/dotnet-install.sh RUN bash ./dotnet-install.sh --channel 7.0.1xx --quality daily --install-dir /usr/share/dotnet -## Collect the following artifacts under /live-runtime-artifacts, -## so projects can build and test against the live-built runtime: -## 1. Reference assembly pack (microsoft.netcore.app.ref) -## 2. Runtime pack (microsoft.netcore.app.runtime.linux-x64) -## 3. targetingpacks.targets, so stress test builds can target the live-built runtime instead of the one in the pre-installed SDK -## 4. testhost +# Collect the following artifacts under /live-runtime-artifacts, +# so projects can build and test against the live-built runtime: +# 1. Reference assembly pack (microsoft.netcore.app.ref) +# 2. Runtime pack (microsoft.netcore.app.runtime.linux-x64) +# 3. targetingpacks.targets, so stress test builds can target the live-built runtime instead of the one in the pre-installed SDK +# 4. testhost ARG VERSION=7.0 ARG ARCH=x64 diff --git a/eng/docker/libraries-sdk.windows.Dockerfile b/eng/docker/libraries-sdk.windows.Dockerfile index 6a7b7764185b3b..b7ed63c13c1d68 100644 --- a/eng/docker/libraries-sdk.windows.Dockerfile +++ b/eng/docker/libraries-sdk.windows.Dockerfile @@ -3,17 +3,21 @@ ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-nanoserver-1809 FROM $SDK_BASE_IMAGE as target -ARG TESTHOST_LOCATION=".\\artifacts\\bin\\testhost" -ARG TFM=net7.0 -ARG OS=windows -ARG ARCH=x64 -ARG CONFIGURATION=Release +SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + +USER ContainerAdministrator + +RUN Invoke-WebRequest -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile .\dotnet-install.ps1 +RUN & .\dotnet-install.ps1 -Channel 7.0.1xx -Quality daily -InstallDir 'C:/Program Files/dotnet' -ARG COREFX_SHARED_FRAMEWORK_NAME=Microsoft.NETCore.App -ARG SOURCE_COREFX_VERSION=7.0.0 -ARG TARGET_SHARED_FRAMEWORK="C:\\Program Files\\dotnet\\shared" -ARG TARGET_COREFX_VERSION=$DOTNET_VERSION +USER ContainerUser + +COPY . /live-runtime-artifacts + +ARG VERSION=7.0 +ARG CONFIGURATION=Release -COPY ` - $TESTHOST_LOCATION\$TFM-$OS-$CONFIGURATION-$ARCH\shared\$COREFX_SHARED_FRAMEWORK_NAME\$SOURCE_COREFX_VERSION\ ` - $TARGET_SHARED_FRAMEWORK\$COREFX_SHARED_FRAMEWORK_NAME\$TARGET_COREFX_VERSION\ +ENV _ASPNETCORE_SOURCE_DIR="C:/Program Files/dotnet/shared/Microsoft.AspNetCore.App/$VERSION*" +ENV _ASPNETCORE_DEST_DIR="C:/live-runtime-artifacts/testhost/net$VERSION-windows-$CONFIGURATION-x64/shared/Microsoft.AspNetCore.App" +RUN & New-Item -ItemType Directory -Path $env:_ASPNETCORE_DEST_DIR +RUN Copy-Item -Recurse -Path $env:_ASPNETCORE_SOURCE_DIR -Destination $env:_ASPNETCORE_DEST_DIR \ No newline at end of file diff --git a/eng/pipelines/libraries/stress/http.yml b/eng/pipelines/libraries/stress/http.yml index 243271c6404ba1..b31a3bab625418 100644 --- a/eng/pipelines/libraries/stress/http.yml +++ b/eng/pipelines/libraries/stress/http.yml @@ -50,15 +50,15 @@ jobs: name: buildStress displayName: Build HttpStress - # - bash: | - # cd '$(httpStressProject)' - # export CLIENT_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/client/3.0" - # export SERVER_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/server/3.0" - # export HTTPSTRESS_CLIENT_ARGS="$HTTPSTRESS_CLIENT_ARGS -http 3.0" - # export HTTPSTRESS_SERVER_ARGS="$HTTPSTRESS_SERVER_ARGS -http 3.0" - # docker-compose up --abort-on-container-exit --no-color - # displayName: Run HttpStress - HTTP 3.0 - # condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true')) + - bash: | + cd '$(httpStressProject)' + export CLIENT_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/client/3.0" + export SERVER_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/server/3.0" + export HTTPSTRESS_CLIENT_ARGS="$HTTPSTRESS_CLIENT_ARGS -http 3.0" + export HTTPSTRESS_SERVER_ARGS="$HTTPSTRESS_SERVER_ARGS -http 3.0" + docker-compose up --abort-on-container-exit --no-color + displayName: Run HttpStress - HTTP 3.0 + condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true')) - bash: | cd '$(httpStressProject)' From 3b7058431f71d2fd4f55fcaa66bdb322d744a229 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Tue, 16 Nov 2021 15:49:54 +0100 Subject: [PATCH 03/19] delete LiveBuildTest --- .../LiveBuildTest/Directory.Build.props | 17 ----------- .../LiveBuildTest/Directory.Build.targets | 11 -------- .../StressTests/LiveBuildTest/Dockerfile | 4 --- .../LiveBuildTest/LiveBuildTest.csproj | 28 ------------------- .../StressTests/LiveBuildTest/Program.cs | 17 ----------- 5 files changed, 77 deletions(-) delete mode 100644 src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Directory.Build.props delete mode 100644 src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Directory.Build.targets delete mode 100644 src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Dockerfile delete mode 100644 src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/LiveBuildTest.csproj delete mode 100644 src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Program.cs diff --git a/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Directory.Build.props b/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Directory.Build.props deleted file mode 100644 index 5a1b7e92c1f341..00000000000000 --- a/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Directory.Build.props +++ /dev/null @@ -1,17 +0,0 @@ - - - $([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier) - linux-x64 - win-x64 - osx-x64 - - ../../../../../../eng/targetingpacks.targets - 7.0.0 - net7.0 - 7.0 - Microsoft.NETCore.App - ../../../../../../artifacts/bin/microsoft.netcore.app.ref/ - ../../../../../../artifacts/bin/microsoft.netcore.app.runtime.$(PackageRid)/$(Configuration)/ - - - diff --git a/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Directory.Build.targets b/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Directory.Build.targets deleted file mode 100644 index bc43343b2c088e..00000000000000 --- a/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Directory.Build.targets +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - 7.0 - - diff --git a/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Dockerfile b/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Dockerfile deleted file mode 100644 index 4a000303f0bf76..00000000000000 --- a/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM test03 - -WORKDIR /app -COPY . . diff --git a/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/LiveBuildTest.csproj b/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/LiveBuildTest.csproj deleted file mode 100644 index 0d699e50c3307d..00000000000000 --- a/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/LiveBuildTest.csproj +++ /dev/null @@ -1,28 +0,0 @@ - - - - Exe - $(NetCoreAppCurrent) - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Program.cs b/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Program.cs deleted file mode 100644 index 9aae0259c2a1ed..00000000000000 --- a/src/libraries/System.Net.Http/tests/StressTests/LiveBuildTest/Program.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace LiveBuildTest -{ - class Program - { - static void Main(string[] args) - { - Console.WriteLine("--------"); - if (args.Length > 0) - { - Console.WriteLine(args[0]); - } - Console.WriteLine(typeof(string).Assembly.Location); - } - } -} From 459611dd3fc12a74e1fe5411ab2f312ced9c52f2 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Tue, 16 Nov 2021 16:01:26 +0100 Subject: [PATCH 04/19] cleanup stress projects --- .../System.Net.Http/ref/System.Net.Http.cs | 1 - .../src/System/Net/Http/HttpClient.cs | 3 --- .../StressTests/HttpStress/HttpStress.csproj | 25 +------------------ .../tests/StressTests/HttpStress/Program.cs | 6 ++++- .../StressTests/HttpStress/StressClient.cs | 1 - .../StressTests/HttpStress/StressServer.cs | 10 ++++++-- .../StressTests/SslStress/SslStress.csproj | 1 - 7 files changed, 14 insertions(+), 33 deletions(-) diff --git a/src/libraries/System.Net.Http/ref/System.Net.Http.cs b/src/libraries/System.Net.Http/ref/System.Net.Http.cs index 996e23a3c4f547..0f63c2badb27ba 100644 --- a/src/libraries/System.Net.Http/ref/System.Net.Http.cs +++ b/src/libraries/System.Net.Http/ref/System.Net.Http.cs @@ -51,7 +51,6 @@ public partial class HttpClient : System.Net.Http.HttpMessageInvoker public HttpClient() : base (default(System.Net.Http.HttpMessageHandler)) { } public HttpClient(System.Net.Http.HttpMessageHandler handler) : base (default(System.Net.Http.HttpMessageHandler)) { } public HttpClient(System.Net.Http.HttpMessageHandler handler, bool disposeHandler) : base (default(System.Net.Http.HttpMessageHandler)) { } - public static bool DummyPropertyToTestLiveBuild { get; set; } public System.Uri? BaseAddress { get { throw null; } set { } } public static System.Net.IWebProxy DefaultProxy { get { throw null; } set { } } public System.Net.Http.Headers.HttpRequestHeaders DefaultRequestHeaders { get { throw null; } } diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs index 77e6d39e65ff0e..3b77aeafc0467b 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs +++ b/src/libraries/System.Net.Http/src/System/Net/Http/HttpClient.cs @@ -36,9 +36,6 @@ public partial class HttpClient : HttpMessageInvoker #endregion Fields #region Properties - - public static bool DummyPropertyToTestLiveBuild { get; set; } - public static IWebProxy DefaultProxy { get => LazyInitializer.EnsureInitialized(ref s_defaultProxy, () => SystemProxyInfo.Proxy); diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj index 08b3f91feb9667..edc9afa54d8348 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj @@ -1,12 +1,10 @@ - Exe $(NetCoreAppCurrent) - preview enable - True + True @@ -23,26 +21,6 @@ - - - - - - - - - - - - - - - - - - - - false @@ -55,5 +33,4 @@ false false - diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs index d2904ef525e7b4..bbc8fd63f1cbe9 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs @@ -28,7 +28,6 @@ public enum ExitCode { Success = 0, StressError = 1, CliError = 2 }; public static async Task Main(string[] args) { - Console.WriteLine("Does it work?"); if (!TryParseCli(args, out Configuration? config)) { return (int)ExitCode.CliError; @@ -37,6 +36,11 @@ public static async Task Main(string[] args) return (int)await Run(config); } + private static void ForceLoadingDependencies() + { + + } + private static bool TryParseCli(string[] args, [NotNullWhen(true)] out Configuration? config) { var cmd = new RootCommand(); diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs index bc4e5594811b74..76176390615a01 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressClient.cs @@ -32,7 +32,6 @@ public class StressClient : IDisposable public StressClient((string name, Func operation)[] clientOperations, Configuration configuration) { - HttpClient.DummyPropertyToTestLiveBuild = true; _clientOperations = clientOperations; _config = configuration; _baseAddress = new Uri(configuration.ServerUri); diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressServer.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressServer.cs index a54c0cab78c482..eb3f5db8b4a51b 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressServer.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressServer.cs @@ -41,8 +41,7 @@ public class StressServer : IDisposable public StressServer(Configuration configuration) { - // Force loading System.Security.Cryptography.Encoding - _ = new Oid(); + WorkaroundAssemblyResolutionIssues(); ServerUri = configuration.ServerUri; (string scheme, string hostname, int port) = ParseServerUri(configuration.ServerUri); @@ -318,6 +317,13 @@ private static void MapRoutes(IEndpointRouteBuilder endpoints) }); } + private static void WorkaroundAssemblyResolutionIssues() + { + // For some reason, System.Security.Cryptography.Encoding.dll fails to resolve when being loaded on-demand by AspNetCore. + // Enforce early-loading to workaround this issue. + _ = new Oid(); + } + private static void AppendChecksumHeader(IHeaderDictionary headers, ulong checksum) { headers.Add("crc32", checksum.ToString()); diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/SslStress.csproj b/src/libraries/System.Net.Security/tests/StressTests/SslStress/SslStress.csproj index c2ba4576af2491..91086ee3d6a720 100644 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/SslStress.csproj +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/SslStress.csproj @@ -1,7 +1,6 @@ Exe - $(NetCoreAppCurrent) enable From 49338ed0fbef3f1440da7a13b32361373bc3c6ea Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Tue, 16 Nov 2021 17:55:57 +0100 Subject: [PATCH 05/19] remove unnecessarry newlines --- .../tests/StressTests/HttpStress/Directory.Build.props | 3 +-- .../tests/StressTests/HttpStress/Directory.Build.targets | 2 +- .../tests/StressTests/HttpStress/HttpStress.csproj | 2 +- .../tests/StressTests/SslStress/Directory.Build.props | 3 +-- .../tests/StressTests/SslStress/Directory.Build.targets | 2 +- .../tests/StressTests/SslStress/SslStress.csproj | 2 +- 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props index cf816f6aa2c593..518f3d295eec79 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props @@ -12,5 +12,4 @@ ../../../../../../artifacts/bin/microsoft.netcore.app.ref/ ../../../../../../artifacts/bin/microsoft.netcore.app.runtime.$(PackageRid)/$(Configuration)/ - - + \ No newline at end of file diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.targets b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.targets index bc43343b2c088e..85e81c583072ee 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.targets +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.targets @@ -8,4 +8,4 @@ --> 7.0 - + \ No newline at end of file diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj index edc9afa54d8348..954019ae5b3a78 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/HttpStress.csproj @@ -33,4 +33,4 @@ false false - + \ No newline at end of file diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.props b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.props index cf816f6aa2c593..518f3d295eec79 100644 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.props +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.props @@ -12,5 +12,4 @@ ../../../../../../artifacts/bin/microsoft.netcore.app.ref/ ../../../../../../artifacts/bin/microsoft.netcore.app.runtime.$(PackageRid)/$(Configuration)/ - - + \ No newline at end of file diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.targets b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.targets index bc43343b2c088e..85e81c583072ee 100644 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.targets +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.targets @@ -8,4 +8,4 @@ --> 7.0 - + \ No newline at end of file diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/SslStress.csproj b/src/libraries/System.Net.Security/tests/StressTests/SslStress/SslStress.csproj index 91086ee3d6a720..a2c1d8dffa5691 100644 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/SslStress.csproj +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/SslStress.csproj @@ -11,4 +11,4 @@ - + \ No newline at end of file From cd243e613e375fa3e5215683e839a77a6cca3f51 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Tue, 16 Nov 2021 18:14:23 +0100 Subject: [PATCH 06/19] cleanup dockerfiles --- .../tests/StressTests/HttpStress/Dockerfile | 10 +++------- .../tests/StressTests/HttpStress/Program.cs | 5 ----- .../StressTests/HttpStress/windows.Dockerfile | 15 +++------------ .../tests/StressTests/SslStress/Dockerfile | 10 +++------- .../StressTests/SslStress/run-docker-compose.ps1 | 10 ---------- .../StressTests/SslStress/windows.Dockerfile | 15 ++++++++++----- 6 files changed, 19 insertions(+), 46 deletions(-) diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile index 54821d38e89185..5dabcafefd6ef3 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Dockerfile @@ -1,9 +1,6 @@ ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-bullseye-slim FROM $SDK_BASE_IMAGE -RUN echo "DOTNET_SDK_VERSION="$DOTNET_SDK_VERSION -RUN echo "DOTNET_VERSION="$DOTNET_VERSION - WORKDIR /app COPY . . @@ -21,12 +18,11 @@ RUN rm -rf $PACKAGES_DIR* ARG VERSION=7.0 ARG CONFIGURATION=Release -ARG ARCH=x64 RUN dotnet build -c $CONFIGURATION \ -p:TargetingPacksTargetsLocation=/live-runtime-artifacts/targetingpacks.targets \ -p:MicrosoftNetCoreAppRefPackDir=/live-runtime-artifacts/microsoft.netcore.app.ref/ \ - -p:MicrosoftNetCoreAppRuntimePackDir=/live-runtime-artifacts/microsoft.netcore.app.runtime.linux-$ARCH/$CONFIGURATION/ + -p:MicrosoftNetCoreAppRuntimePackDir=/live-runtime-artifacts/microsoft.netcore.app.runtime.linux-x64/$CONFIGURATION/ # Enable dump collection ENV COMPlus_DbgEnableMiniDump=1 @@ -37,6 +33,6 @@ EXPOSE 5001 ENV VERSION=$VERSION ENV CONFIGURATION=$CONFIGURATION -ENV ARCH=$ARCH ENV HTTPSTRESS_ARGS='' -CMD /live-runtime-artifacts/testhost/net$VERSION-Linux-$CONFIGURATION-$ARCH/dotnet exec ./bin/$CONFIGURATION/net$VERSION/HttpStress.dll $HTTPSTRESS_ARGS +CMD /live-runtime-artifacts/testhost/net$VERSION-Linux-$CONFIGURATION-x64/dotnet exec \ + ./bin/$CONFIGURATION/net$VERSION/HttpStress.dll $HTTPSTRESS_ARGS diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs index bbc8fd63f1cbe9..b411d637a54f14 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs @@ -36,11 +36,6 @@ public static async Task Main(string[] args) return (int)await Run(config); } - private static void ForceLoadingDependencies() - { - - } - private static bool TryParseCli(string[] args, [NotNullWhen(true)] out Configuration? config) { var cmd = new RootCommand(); diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/windows.Dockerfile b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/windows.Dockerfile index 8d13a83964225a..2876854606fda9 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/windows.Dockerfile +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/windows.Dockerfile @@ -5,18 +5,11 @@ FROM $SDK_BASE_IMAGE # Use powershell as the default shell SHELL ["pwsh", "-Command"] -RUN echo "DOTNET_SDK_VERSION="$env:DOTNET_SDK_VERSION -RUN echo "DOTNET_VERSION="$env:DOTNET_VERSION - WORKDIR /app COPY . . -# ARG CONFIGURATION=Release -# RUN dotnet build -c $env:CONFIGURATION ARG VERSION=7.0 -ENV VERSION=$VERSION ARG CONFIGURATION=Release -ENV CONFIGURATION=$CONFIGURATION RUN dotnet build -c $env:CONFIGURATION ` -p:TargetingPacksTargetsLocation=C:/live-runtime-artifacts/targetingpacks.targets ` @@ -30,11 +23,9 @@ ENV COMPlus_DbgMiniDumpName="C:/share/coredump.%p" EXPOSE 5001 -# ENV CONFIGURATION=$CONFIGURATION -# ENV HTTPSTRESS_ARGS="" -# CMD dotnet run --no-build -c $env:CONFIGURATION -- $env:HTTPSTRESS_ARGS.Split() - ENV VERSION=$VERSION ENV CONFIGURATION=$CONFIGURATION ENV HTTPSTRESS_ARGS="" -CMD & C:/live-runtime-artifacts/testhost/net$env:VERSION-windows-$env:CONFIGURATION-x64/dotnet.exe exec ./bin/$env:CONFIGURATION/net$env:VERSION/HttpStress.dll $env:HTTPSTRESS_ARGS.Split() + +CMD & C:/live-runtime-artifacts/testhost/net$env:VERSION-windows-$env:CONFIGURATION-x64/dotnet.exe exec ` + ./bin/$env:CONFIGURATION/net$env:VERSION/HttpStress.dll $env:HTTPSTRESS_ARGS.Split() \ No newline at end of file diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Dockerfile b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Dockerfile index 2f26960ee819b1..d47c4c9be1be2c 100644 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Dockerfile +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Dockerfile @@ -1,27 +1,23 @@ ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-bullseye-slim FROM $SDK_BASE_IMAGE -RUN echo "DOTNET_SDK_VERSION="$DOTNET_SDK_VERSION -RUN echo "DOTNET_VERSION="$DOTNET_VERSION - WORKDIR /app COPY . . WORKDIR /app/System.Net.Security/tests/StressTests/SslStress ARG VERSION=7.0 ARG CONFIGURATION=Release -ARG ARCH=x64 RUN dotnet build -c $CONFIGURATION \ -p:TargetingPacksTargetsLocation=/live-runtime-artifacts/targetingpacks.targets \ -p:MicrosoftNetCoreAppRefPackDir=/live-runtime-artifacts/microsoft.netcore.app.ref/ \ - -p:MicrosoftNetCoreAppRuntimePackDir=/live-runtime-artifacts/microsoft.netcore.app.runtime.linux-$ARCH/$CONFIGURATION/ + -p:MicrosoftNetCoreAppRuntimePackDir=/live-runtime-artifacts/microsoft.netcore.app.runtime.linux-x64/$CONFIGURATION/ EXPOSE 5001 ENV VERSION=$VERSION ENV CONFIGURATION=$CONFIGURATION -ENV ARCH=$ARCH ENV SSLSTRESS_ARGS='' -CMD /live-runtime-artifacts/testhost/net$VERSION-Linux-$CONFIGURATION-$ARCH/dotnet exec ./bin/$CONFIGURATION/net$VERSION/SslStress.dll $SSLSTRESS_ARGS \ No newline at end of file +CMD /live-runtime-artifacts/testhost/net$VERSION-Linux-$CONFIGURATION-x64/dotnet exec \ + ./bin/$CONFIGURATION/net$VERSION/SslStress.dll $SSLSTRESS_ARGS \ No newline at end of file diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/run-docker-compose.ps1 b/src/libraries/System.Net.Security/tests/StressTests/SslStress/run-docker-compose.ps1 index 3d3959021d4390..99981196fd3513 100755 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/run-docker-compose.ps1 +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/run-docker-compose.ps1 @@ -6,7 +6,6 @@ Param( [string][Alias('c')]$configuration = "Release", # Build configuration for libraries and stress suite [switch][Alias('w')]$useWindowsContainers, # Use windows containers, if available [switch][Alias('b')]$buildCurrentLibraries, # Drives the stress test using libraries built from current source - [switch][Alias('pa')]$privateAspNetCore, # Drive the stress test using a private Asp.Net Core package, requires -b to be set [switch][Alias('o')]$buildOnly, # Build, but do not run the stress app [string][Alias('t')]$sdkImageName, # Name of the sdk image name, if built from source. [string]$clientStressArgs = "", @@ -30,20 +29,11 @@ if ($buildCurrentLibraries) { $LIBRARIES_BUILD_ARGS += " -w" } - if($privateAspNetCore) - { - $LIBRARIES_BUILD_ARGS += " -p" - } Invoke-Expression "& $REPO_ROOT_DIR/eng/docker/build-docker-sdk.ps1 $LIBRARIES_BUILD_ARGS" if (!$?) { exit 1 } } -elseif ($privateAspNetCore) { - write-output "Using a private Asp.Net Core package (-pa) requires using privately built libraries. Please, enable it with -b switch." - write-output "USAGE: . $($MyInvocation.InvocationName) -b -pa " - exit 1 -} # Dockerize the stress app using docker-compose diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/windows.Dockerfile b/src/libraries/System.Net.Security/tests/StressTests/SslStress/windows.Dockerfile index a1449eb4d54157..542a5d7a20a215 100644 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/windows.Dockerfile +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/windows.Dockerfile @@ -5,18 +5,23 @@ FROM $SDK_BASE_IMAGE # Use powershell as the default shell SHELL ["pwsh", "-Command"] -RUN echo "DOTNET_SDK_VERSION="$env:DOTNET_SDK_VERSION -RUN echo "DOTNET_VERSION="$env:DOTNET_VERSION - WORKDIR /app COPY . . WORKDIR /app/System.Net.Security/tests/StressTests/SslStress +ARG VERSION=7.0 ARG CONFIGURATION=Release -RUN dotnet build -c $env:CONFIGURATION + +RUN dotnet build -c $env:CONFIGURATION ` + -p:TargetingPacksTargetsLocation=C:/live-runtime-artifacts/targetingpacks.targets ` + -p:MicrosoftNetCoreAppRefPackDir=C:/live-runtime-artifacts/microsoft.netcore.app.ref/ ` + -p:MicrosoftNetCoreAppRuntimePackDir=C:/live-runtime-artifacts/microsoft.netcore.app.runtime.win-x64/$env:CONFIGURATION/ EXPOSE 5001 +ENV VERSION=$VERSION ENV CONFIGURATION=$CONFIGURATION ENV SSLSTRESS_ARGS="" -CMD dotnet run --no-build -c $env:CONFIGURATION -- $env:SSLSTRESS_ARGS.Split() + +CMD & C:/live-runtime-artifacts/testhost/net$env:VERSION-windows-$env:CONFIGURATION-x64/dotnet.exe exec ` + ./bin/$env:CONFIGURATION/net$env:VERSION/SslStress.dll $env:SSLSTRESS_ARGS.Split() \ No newline at end of file From f27e4f0ccc3827051abe10bd63c67eec97391b84 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Thu, 18 Nov 2021 13:45:16 +0100 Subject: [PATCH 07/19] better way to find reference locations in stress .props also delete OSX , since OSX stress runs are practically unsupported --- .../tests/StressTests/HttpStress/Directory.Build.props | 10 ++++++---- .../tests/StressTests/SslStress/Directory.Build.props | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props index 518f3d295eec79..a1d1b3174a394a 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Directory.Build.props @@ -2,14 +2,16 @@ linux-x64 win-x64 - osx-x64 + + + $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)../, global.json))/ - ../../../../../../eng/targetingpacks.targets + $(RepositoryRoot)eng/targetingpacks.targets 7.0.0 net7.0 7.0 Microsoft.NETCore.App - ../../../../../../artifacts/bin/microsoft.netcore.app.ref/ - ../../../../../../artifacts/bin/microsoft.netcore.app.runtime.$(PackageRid)/$(Configuration)/ + $(RepositoryRoot)artifacts/bin/microsoft.netcore.app.ref/ + $(RepositoryRoot)artifacts/bin/microsoft.netcore.app.runtime.$(PackageRid)/$(Configuration)/ \ No newline at end of file diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.props b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.props index 518f3d295eec79..74036484c18dd0 100644 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.props +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Directory.Build.props @@ -2,14 +2,16 @@ linux-x64 win-x64 - osx-x64 - ../../../../../../eng/targetingpacks.targets + + $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)../, global.json))/ + + $(RepositoryRoot)eng/targetingpacks.targets 7.0.0 net7.0 7.0 Microsoft.NETCore.App - ../../../../../../artifacts/bin/microsoft.netcore.app.ref/ - ../../../../../../artifacts/bin/microsoft.netcore.app.runtime.$(PackageRid)/$(Configuration)/ + $(RepositoryRoot)artifacts/bin/microsoft.netcore.app.ref/ + $(RepositoryRoot)artifacts/bin/microsoft.netcore.app.runtime.$(PackageRid)/$(Configuration)/ \ No newline at end of file From 5e90f14f2a34be42a3a0b0601682947f5ee64e09 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Thu, 18 Nov 2021 14:13:20 +0100 Subject: [PATCH 08/19] Dockerfiles: use $VERSION, delete $ARCH --- eng/docker/libraries-sdk.linux.Dockerfile | 20 +++++++++----------- eng/docker/libraries-sdk.windows.Dockerfile | 8 ++++---- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/eng/docker/libraries-sdk.linux.Dockerfile b/eng/docker/libraries-sdk.linux.Dockerfile index 89193e157cb9f2..da471e5e6502bc 100644 --- a/eng/docker/libraries-sdk.linux.Dockerfile +++ b/eng/docker/libraries-sdk.linux.Dockerfile @@ -3,17 +3,19 @@ ARG BUILD_BASE_IMAGE=mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-f39df2 ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-bullseye-slim FROM $BUILD_BASE_IMAGE as corefxbuild + ARG CONFIGURATION=Release +ARG VERSION=7.0 + WORKDIR /repo COPY . . - RUN ./build.sh clr+libs -runtimeconfiguration Release -configuration $CONFIGURATION -ci FROM $SDK_BASE_IMAGE as target -# Install 7.0 SDK: +# Install latest daily SDK: RUN wget https://dot.net/v1/dotnet-install.sh -RUN bash ./dotnet-install.sh --channel 7.0.1xx --quality daily --install-dir /usr/share/dotnet +RUN bash ./dotnet-install.sh --channel $VERSION.1xx --quality daily --install-dir /usr/share/dotnet # Collect the following artifacts under /live-runtime-artifacts, # so projects can build and test against the live-built runtime: @@ -22,17 +24,13 @@ RUN bash ./dotnet-install.sh --channel 7.0.1xx --quality daily --install-dir /us # 3. targetingpacks.targets, so stress test builds can target the live-built runtime instead of the one in the pre-installed SDK # 4. testhost -ARG VERSION=7.0 -ARG ARCH=x64 -ARG CONFIGURATION=Release - COPY --from=corefxbuild \ /repo/artifacts/bin/microsoft.netcore.app.ref \ /live-runtime-artifacts/microsoft.netcore.app.ref COPY --from=corefxbuild \ - /repo/artifacts/bin/microsoft.netcore.app.runtime.linux-$ARCH \ - /live-runtime-artifacts/microsoft.netcore.app.runtime.linux-$ARCH + /repo/artifacts/bin/microsoft.netcore.app.runtime.linux-x64 \ + /live-runtime-artifacts/microsoft.netcore.app.runtime.linux-x64 COPY --from=corefxbuild \ /repo/eng/targetingpacks.targets \ @@ -43,5 +41,5 @@ COPY --from=corefxbuild \ /live-runtime-artifacts/testhost # Add AspNetCore bits to testhost: -RUN mkdir -p /live-runtime-artifacts/testhost/net$VERSION-Linux-$CONFIGURATION-$ARCH/shared/Microsoft.AspNetCore.App -RUN cp -r /usr/share/dotnet/shared/Microsoft.AspNetCore.App/$VERSION* /live-runtime-artifacts/testhost/net$VERSION-Linux-$CONFIGURATION-$ARCH/shared/Microsoft.AspNetCore.App \ No newline at end of file +RUN mkdir -p /live-runtime-artifacts/testhost/net$VERSION-Linux-$CONFIGURATION-x64/shared/Microsoft.AspNetCore.App +RUN cp -r /usr/share/dotnet/shared/Microsoft.AspNetCore.App/$VERSION* /live-runtime-artifacts/testhost/net$VERSION-Linux-$CONFIGURATION-x64/shared/Microsoft.AspNetCore.App \ No newline at end of file diff --git a/eng/docker/libraries-sdk.windows.Dockerfile b/eng/docker/libraries-sdk.windows.Dockerfile index b7ed63c13c1d68..a55c93cbec754b 100644 --- a/eng/docker/libraries-sdk.windows.Dockerfile +++ b/eng/docker/libraries-sdk.windows.Dockerfile @@ -3,20 +3,20 @@ ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-nanoserver-1809 FROM $SDK_BASE_IMAGE as target +ARG VERSION=7.0 +ARG CONFIGURATION=Release + SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] USER ContainerAdministrator RUN Invoke-WebRequest -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile .\dotnet-install.ps1 -RUN & .\dotnet-install.ps1 -Channel 7.0.1xx -Quality daily -InstallDir 'C:/Program Files/dotnet' +RUN & .\dotnet-install.ps1 -Channel $VERSION.1xx -Quality daily -InstallDir 'C:/Program Files/dotnet' USER ContainerUser COPY . /live-runtime-artifacts -ARG VERSION=7.0 -ARG CONFIGURATION=Release - ENV _ASPNETCORE_SOURCE_DIR="C:/Program Files/dotnet/shared/Microsoft.AspNetCore.App/$VERSION*" ENV _ASPNETCORE_DEST_DIR="C:/live-runtime-artifacts/testhost/net$VERSION-windows-$CONFIGURATION-x64/shared/Microsoft.AspNetCore.App" RUN & New-Item -ItemType Directory -Path $env:_ASPNETCORE_DEST_DIR From 673b5f615843e66abc9082256b128901a63d63bb Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Thu, 18 Nov 2021 14:21:06 +0100 Subject: [PATCH 09/19] fix windows.Dockerfile --- eng/docker/libraries-sdk.windows.Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/docker/libraries-sdk.windows.Dockerfile b/eng/docker/libraries-sdk.windows.Dockerfile index a55c93cbec754b..8620e0031d5a13 100644 --- a/eng/docker/libraries-sdk.windows.Dockerfile +++ b/eng/docker/libraries-sdk.windows.Dockerfile @@ -3,15 +3,15 @@ ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-nanoserver-1809 FROM $SDK_BASE_IMAGE as target +SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] + ARG VERSION=7.0 ARG CONFIGURATION=Release -SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] - USER ContainerAdministrator RUN Invoke-WebRequest -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile .\dotnet-install.ps1 -RUN & .\dotnet-install.ps1 -Channel $VERSION.1xx -Quality daily -InstallDir 'C:/Program Files/dotnet' +RUN & .\dotnet-install.ps1 -Channel '${env:VERSION}.1xx' -Quality daily -InstallDir 'C:/Program Files/dotnet' USER ContainerUser From 0af9f7b44d5628d4a12289270a561ae54a6a7fc7 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Thu, 18 Nov 2021 14:27:33 +0100 Subject: [PATCH 10/19] fix Dockerfiles --- eng/docker/libraries-sdk.linux.Dockerfile | 3 ++- eng/docker/libraries-sdk.windows.Dockerfile | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/eng/docker/libraries-sdk.linux.Dockerfile b/eng/docker/libraries-sdk.linux.Dockerfile index da471e5e6502bc..9a74e893242b75 100644 --- a/eng/docker/libraries-sdk.linux.Dockerfile +++ b/eng/docker/libraries-sdk.linux.Dockerfile @@ -5,6 +5,7 @@ ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-bullseye-slim FROM $BUILD_BASE_IMAGE as corefxbuild ARG CONFIGURATION=Release +ENV _DOTNET_INSTALL_CHANNEL="$VERSION.1xx" ARG VERSION=7.0 WORKDIR /repo @@ -15,7 +16,7 @@ FROM $SDK_BASE_IMAGE as target # Install latest daily SDK: RUN wget https://dot.net/v1/dotnet-install.sh -RUN bash ./dotnet-install.sh --channel $VERSION.1xx --quality daily --install-dir /usr/share/dotnet +RUN bash ./dotnet-install.sh --channel $_DOTNET_INSTALL_CHANNEL --quality daily --install-dir /usr/share/dotnet # Collect the following artifacts under /live-runtime-artifacts, # so projects can build and test against the live-built runtime: diff --git a/eng/docker/libraries-sdk.windows.Dockerfile b/eng/docker/libraries-sdk.windows.Dockerfile index 8620e0031d5a13..a39f41ed770f0f 100644 --- a/eng/docker/libraries-sdk.windows.Dockerfile +++ b/eng/docker/libraries-sdk.windows.Dockerfile @@ -6,12 +6,13 @@ FROM $SDK_BASE_IMAGE as target SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] ARG VERSION=7.0 +ENV _DOTNET_INSTALL_CHANNEL="$VERSION.1xx" ARG CONFIGURATION=Release USER ContainerAdministrator RUN Invoke-WebRequest -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile .\dotnet-install.ps1 -RUN & .\dotnet-install.ps1 -Channel '${env:VERSION}.1xx' -Quality daily -InstallDir 'C:/Program Files/dotnet' +RUN & .\dotnet-install.ps1 -Channel $env:_DOTNET_INSTALL_CHANNEL -Quality daily -InstallDir 'C:/Program Files/dotnet' USER ContainerUser From 5a049631ae8a1b978d70766679af06b749fc1329 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Thu, 18 Nov 2021 14:37:49 +0100 Subject: [PATCH 11/19] fix linux.Dockerfile --- eng/docker/libraries-sdk.linux.Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eng/docker/libraries-sdk.linux.Dockerfile b/eng/docker/libraries-sdk.linux.Dockerfile index 9a74e893242b75..d518b3d4fe7d82 100644 --- a/eng/docker/libraries-sdk.linux.Dockerfile +++ b/eng/docker/libraries-sdk.linux.Dockerfile @@ -5,8 +5,6 @@ ARG SDK_BASE_IMAGE=mcr.microsoft.com/dotnet/nightly/sdk:6.0-bullseye-slim FROM $BUILD_BASE_IMAGE as corefxbuild ARG CONFIGURATION=Release -ENV _DOTNET_INSTALL_CHANNEL="$VERSION.1xx" -ARG VERSION=7.0 WORKDIR /repo COPY . . @@ -14,6 +12,9 @@ RUN ./build.sh clr+libs -runtimeconfiguration Release -configuration $CONFIGURAT FROM $SDK_BASE_IMAGE as target +ARG VERSION=7.0 +ENV _DOTNET_INSTALL_CHANNEL="$VERSION.1xx" + # Install latest daily SDK: RUN wget https://dot.net/v1/dotnet-install.sh RUN bash ./dotnet-install.sh --channel $_DOTNET_INSTALL_CHANNEL --quality daily --install-dir /usr/share/dotnet From 361f1e5d05256d3e67669f4e9cb78f2ce8ef156b Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Fri, 19 Nov 2021 12:25:15 +0000 Subject: [PATCH 12/19] fix linux linux.Dockerfile --- eng/docker/libraries-sdk.linux.Dockerfile | 7 +++++-- eng/docker/libraries-sdk.windows.Dockerfile | 9 +++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/eng/docker/libraries-sdk.linux.Dockerfile b/eng/docker/libraries-sdk.linux.Dockerfile index d518b3d4fe7d82..9d7b339383ac6a 100644 --- a/eng/docker/libraries-sdk.linux.Dockerfile +++ b/eng/docker/libraries-sdk.linux.Dockerfile @@ -13,6 +13,7 @@ RUN ./build.sh clr+libs -runtimeconfiguration Release -configuration $CONFIGURAT FROM $SDK_BASE_IMAGE as target ARG VERSION=7.0 +ARG CONFIGURATION=Release ENV _DOTNET_INSTALL_CHANNEL="$VERSION.1xx" # Install latest daily SDK: @@ -43,5 +44,7 @@ COPY --from=corefxbuild \ /live-runtime-artifacts/testhost # Add AspNetCore bits to testhost: -RUN mkdir -p /live-runtime-artifacts/testhost/net$VERSION-Linux-$CONFIGURATION-x64/shared/Microsoft.AspNetCore.App -RUN cp -r /usr/share/dotnet/shared/Microsoft.AspNetCore.App/$VERSION* /live-runtime-artifacts/testhost/net$VERSION-Linux-$CONFIGURATION-x64/shared/Microsoft.AspNetCore.App \ No newline at end of file +ENV _ASPNETCORE_SOURCE="/usr/share/dotnet/shared/Microsoft.AspNetCore.App/$VERSION*" +ENV _ASPNETCORE_DEST="/live-runtime-artifacts/testhost/net$VERSION-Linux-$CONFIGURATION-x64/shared/Microsoft.AspNetCore.App" +RUN mkdir -p $_ASPNETCORE_DEST +RUN cp -r $_ASPNETCORE_SOURCE $_ASPNETCORE_DEST \ No newline at end of file diff --git a/eng/docker/libraries-sdk.windows.Dockerfile b/eng/docker/libraries-sdk.windows.Dockerfile index a39f41ed770f0f..c3be811a2cae73 100644 --- a/eng/docker/libraries-sdk.windows.Dockerfile +++ b/eng/docker/libraries-sdk.windows.Dockerfile @@ -18,7 +18,8 @@ USER ContainerUser COPY . /live-runtime-artifacts -ENV _ASPNETCORE_SOURCE_DIR="C:/Program Files/dotnet/shared/Microsoft.AspNetCore.App/$VERSION*" -ENV _ASPNETCORE_DEST_DIR="C:/live-runtime-artifacts/testhost/net$VERSION-windows-$CONFIGURATION-x64/shared/Microsoft.AspNetCore.App" -RUN & New-Item -ItemType Directory -Path $env:_ASPNETCORE_DEST_DIR -RUN Copy-Item -Recurse -Path $env:_ASPNETCORE_SOURCE_DIR -Destination $env:_ASPNETCORE_DEST_DIR \ No newline at end of file +# Add AspNetCore bits to testhost: +ENV _ASPNETCORE_SOURCE="C:/Program Files/dotnet/shared/Microsoft.AspNetCore.App/$VERSION*" +ENV _ASPNETCORE_DEST="C:/live-runtime-artifacts/testhost/net$VERSION-windows-$CONFIGURATION-x64/shared/Microsoft.AspNetCore.App" +RUN & New-Item -ItemType Directory -Path $env:_ASPNETCORE_DEST +RUN Copy-Item -Recurse -Path $env:_ASPNETCORE_SOURCE -Destination $env:_ASPNETCORE_DEST \ No newline at end of file From f87f45bbfe8e967b588c986ce0d470c0fbb4a5be Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Mon, 22 Nov 2021 14:45:26 +0100 Subject: [PATCH 13/19] disable HTTP/3 to see if the rest succeeds --- eng/pipelines/libraries/stress/http.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/eng/pipelines/libraries/stress/http.yml b/eng/pipelines/libraries/stress/http.yml index b31a3bab625418..243271c6404ba1 100644 --- a/eng/pipelines/libraries/stress/http.yml +++ b/eng/pipelines/libraries/stress/http.yml @@ -50,15 +50,15 @@ jobs: name: buildStress displayName: Build HttpStress - - bash: | - cd '$(httpStressProject)' - export CLIENT_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/client/3.0" - export SERVER_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/server/3.0" - export HTTPSTRESS_CLIENT_ARGS="$HTTPSTRESS_CLIENT_ARGS -http 3.0" - export HTTPSTRESS_SERVER_ARGS="$HTTPSTRESS_SERVER_ARGS -http 3.0" - docker-compose up --abort-on-container-exit --no-color - displayName: Run HttpStress - HTTP 3.0 - condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true')) + # - bash: | + # cd '$(httpStressProject)' + # export CLIENT_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/client/3.0" + # export SERVER_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/server/3.0" + # export HTTPSTRESS_CLIENT_ARGS="$HTTPSTRESS_CLIENT_ARGS -http 3.0" + # export HTTPSTRESS_SERVER_ARGS="$HTTPSTRESS_SERVER_ARGS -http 3.0" + # docker-compose up --abort-on-container-exit --no-color + # displayName: Run HttpStress - HTTP 3.0 + # condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true')) - bash: | cd '$(httpStressProject)' From e0a3ef849a63aea891fd677001e1606ee1501366 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Mon, 22 Nov 2021 17:55:21 +0000 Subject: [PATCH 14/19] rename Build-Local.ps1 and extend README.md --- .../tests/StressTests/HttpStress/Readme.md | 22 ++++++++++++++----- .../{Build-Local.ps1 => build-local.ps1} | 0 2 files changed, 17 insertions(+), 5 deletions(-) rename src/libraries/System.Net.Http/tests/StressTests/HttpStress/{Build-Local.ps1 => build-local.ps1} (100%) diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Readme.md b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Readme.md index bc1a0490d9b6dd..a2507033ddc87c 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Readme.md +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Readme.md @@ -6,7 +6,7 @@ Provides stress testing scenaria for System.Net.Http.HttpClient and the underlyi Prerequisite: the runtime and the libraries should be [live-built](https://github.com/dotnet/runtime/tree/main/docs/workflow/building/libraries) with `build.cmd`/`build.sh`. -Use the script `build-local.sh` / `Build-Local.ps1` to build the stress project against the live-built runtime. This will acquire the latest daily SDK, which is TFM-compatible with the live-built runtime. +Use the script `build-local.sh` / `build-local.ps1` to build the stress project against the live-built runtime. This will acquire the latest daily SDK, which is TFM-compatible with the live-built runtime. ```bash $ build-local.sh [StressConfiguration] [LibrariesConfiguration] @@ -21,7 +21,7 @@ $ run-stress-Release-Release.sh [stress suite args] To get the full list of available parameters: ```bash -$ run-stress-Release-Release.sh.sh -help +$ run-stress-Release-Release.sh -help ``` ### Building and running with Docker @@ -37,11 +37,11 @@ Docker and compose-compose are required for this step (both included in [docker From the stress folder: ```powershell -PS> .\run-docker-compose.ps1 -b +PS> .\run-docker-compose.ps1 ``` ```bash -$ ./run-docker-compose.sh -b +$ ./run-docker-compose.sh ``` This will build libraries and stress suite to a linux docker image and initialize a stress run using docker-compose. @@ -54,7 +54,7 @@ on how windows containers can be enabled on your machine. Once ready, simply run: ```powershell -PS> .\run-docker-compose.ps1 -b -w +PS> .\run-docker-compose.ps1 -w ``` For more details on how the `run-docker-compose.ps1` script can be used: @@ -62,3 +62,15 @@ For more details on how the `run-docker-compose.ps1` script can be used: ```powershell Get-Help .\run-docker-compose.ps1 ``` + +#### Passing arguments to HttpStress + +The following will run the stress client and server containers passing the argument `-http 2.0` to both: + +```bash +./run-docker-compose.sh -clientstressargs "-http 2.0" -serverstressargs "-http 2.0" +``` + +```powershell +./run-docker-compose.sh -w -clientStressArgs "-http 2.0" -serverStressArgs "-http 2.0" +``` \ No newline at end of file diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Build-Local.ps1 b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.ps1 similarity index 100% rename from src/libraries/System.Net.Http/tests/StressTests/HttpStress/Build-Local.ps1 rename to src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.ps1 From 83b083563f1f1c642ccfc0c722ba51ac6f2ad4d5 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Mon, 22 Nov 2021 17:57:59 +0000 Subject: [PATCH 15/19] re-enable HTTP3 with timeout --- eng/pipelines/libraries/stress/http.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/eng/pipelines/libraries/stress/http.yml b/eng/pipelines/libraries/stress/http.yml index 243271c6404ba1..3561011fa6292a 100644 --- a/eng/pipelines/libraries/stress/http.yml +++ b/eng/pipelines/libraries/stress/http.yml @@ -50,15 +50,16 @@ jobs: name: buildStress displayName: Build HttpStress - # - bash: | - # cd '$(httpStressProject)' - # export CLIENT_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/client/3.0" - # export SERVER_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/server/3.0" - # export HTTPSTRESS_CLIENT_ARGS="$HTTPSTRESS_CLIENT_ARGS -http 3.0" - # export HTTPSTRESS_SERVER_ARGS="$HTTPSTRESS_SERVER_ARGS -http 3.0" - # docker-compose up --abort-on-container-exit --no-color - # displayName: Run HttpStress - HTTP 3.0 - # condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true')) + - bash: | + cd '$(httpStressProject)' + export CLIENT_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/client/3.0" + export SERVER_DUMPS_SHARE="$(Build.ArtifactStagingDirectory)/dumps/server/3.0" + export HTTPSTRESS_CLIENT_ARGS="$HTTPSTRESS_CLIENT_ARGS -http 3.0" + export HTTPSTRESS_SERVER_ARGS="$HTTPSTRESS_SERVER_ARGS -http 3.0" + docker-compose up --abort-on-container-exit --no-color + timeoutInMinutes: 35 # In case the HTTP/3.0 run hangs, we timeout shortly after the expected 30 minute run + displayName: Run HttpStress - HTTP 3.0 + condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true')) - bash: | cd '$(httpStressProject)' From 48a960215db417874803660e0667dce13df42dd5 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Mon, 22 Nov 2021 19:37:38 +0000 Subject: [PATCH 16/19] remove trailing whitespace --- .../System.Net.Http/tests/StressTests/HttpStress/Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Readme.md b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Readme.md index a2507033ddc87c..653b96c4169de5 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Readme.md +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/Readme.md @@ -6,7 +6,7 @@ Provides stress testing scenaria for System.Net.Http.HttpClient and the underlyi Prerequisite: the runtime and the libraries should be [live-built](https://github.com/dotnet/runtime/tree/main/docs/workflow/building/libraries) with `build.cmd`/`build.sh`. -Use the script `build-local.sh` / `build-local.ps1` to build the stress project against the live-built runtime. This will acquire the latest daily SDK, which is TFM-compatible with the live-built runtime. +Use the script `build-local.sh` / `build-local.ps1` to build the stress project against the live-built runtime. This will acquire the latest daily SDK, which is TFM-compatible with the live-built runtime. ```bash $ build-local.sh [StressConfiguration] [LibrariesConfiguration] From 280a3df1a727efb1511908fce9e5b67cb55f591b Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Fri, 26 Nov 2021 16:01:10 +0000 Subject: [PATCH 17/19] nits --- eng/docker/build-docker-sdk.ps1 | 16 ++++++++++------ .../tests/StressTests/HttpStress/build-local.ps1 | 6 ++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/eng/docker/build-docker-sdk.ps1 b/eng/docker/build-docker-sdk.ps1 index f293f83d881aed..570d4c5ba738aa 100755 --- a/eng/docker/build-docker-sdk.ps1 +++ b/eng/docker/build-docker-sdk.ps1 @@ -33,7 +33,7 @@ if ($buildWindowsContainers) # Collect the following artifacts to folder, that will be used as build context for the container, # so projects can build and test against the live-built runtime: # 1. Reference assembly pack (microsoft.netcore.app.ref) - # 2. Runtime pack (microsoft.netcore.app.runtime.linux-x64) + # 2. Runtime pack (microsoft.netcore.app.runtime.win-x64) # 3. targetingpacks.targets, so stress test builds can target the live-built runtime instead of the one in the pre-installed SDK # 4. testhost $binArtifacts = "$REPO_ROOT_DIR\artifacts\bin" @@ -43,12 +43,16 @@ if ($buildWindowsContainers) Remove-Item -Recurse -Force $dockerContext } - Copy-Item -Recurse -Destination $dockerContext\microsoft.netcore.app.ref -Path $binArtifacts\microsoft.netcore.app.ref - Copy-Item -Recurse -Destination $dockerContext\microsoft.netcore.app.runtime.win-x64 -Path $binArtifacts\microsoft.netcore.app.runtime.win-x64 - Copy-Item -Recurse -Destination $dockerContext\testhost -Path $binArtifacts\testhost - Copy-Item -Recurse -Destination $dockerContext\targetingpacks.targets -Path $REPO_ROOT_DIR\eng\targetingpacks.targets + Copy-Item -Recurse -Path $binArtifacts\microsoft.netcore.app.ref ` + -Destination $dockerContext\microsoft.netcore.app.ref + Copy-Item -Recurse -Path $binArtifacts\microsoft.netcore.app.runtime.win-x64 ` + -Destination $dockerContext\microsoft.netcore.app.runtime.win-x64 + Copy-Item -Recurse -Path $binArtifacts\testhost ` + -Destination $dockerContext\testhost + Copy-Item -Recurse -Path $REPO_ROOT_DIR\eng\targetingpacks.targets ` + -Destination $dockerContext\targetingpacks.targets - # In case of non-CI builds, testhost may already contain Microsoft.AspNetCore.App (see Build-Local.ps1 in HttpStress): + # In case of non-CI builds, testhost may already contain Microsoft.AspNetCore.App (see build-local.ps1 in HttpStress): $testHostAspNetCorePath="$dockerContext\testhost\net$dotNetVersion-windows-$configuration-x64/shared/Microsoft.AspNetCore.App" if (Test-Path $testHostAspNetCorePath) { Remove-Item -Recurse -Force $testHostAspNetCorePath diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.ps1 b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.ps1 index 98fc2f0bed4721..d5b15e2c65ffcf 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.ps1 +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.ps1 @@ -24,8 +24,7 @@ if (-not (Test-Path -Path $DailyDotnetRoot)) { New-Item -ItemType Directory -Path $DailyDotnetRoot Invoke-WebRequest -Uri https://dot.net/v1/dotnet-install.ps1 -OutFile "$DailyDotnetRoot\dotnet-install.ps1" & "$DailyDotnetRoot\dotnet-install.ps1" -NoPath -Channel "$Version.1xx" -Quality daily -InstallDir $DailyDotnetRoot -} -else { +} else { Write-Host "Daily SDK found in $DailyDotnetRoot" } @@ -38,8 +37,7 @@ $env:DOTNET_MULTILEVEL_LOOKUP=0 if (-not (Test-Path -Path "$TestHostRoot/shared/Microsoft.AspNetCore.App")) { Write-Host "Copying Microsoft.AspNetCore.App bits from daily SDK to testhost: $TestHostRoot" Copy-Item -Recurse -Path "$DailyDotnetRoot/shared/Microsoft.AspNetCore.App" -Destination "$TestHostRoot/shared" -} -else { +} else { Write-Host "Microsoft.AspNetCore.App found in testhost: $TestHostRoot" } From ab4072f23235a2cd1888470f5c7fd54e6b264664 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Fri, 26 Nov 2021 16:01:30 +0000 Subject: [PATCH 18/19] improve build-local.sh --- .../StressTests/HttpStress/build-local.sh | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.sh b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.sh index 0c7902d14c2e46..78e0545150b9fc 100755 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.sh +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.sh @@ -10,23 +10,30 @@ repo_root=$(git rev-parse --show-toplevel) daily_dotnet_root=./.dotnet-daily stress_configuration="Release" -if [ "$1" != "" ] -then +if [ "$1" != "" ]; then stress_configuration=${1,,} # Lowercase all characters in $1 stress_configuration=${stress_configuration^} # Uppercase first character fi libraries_configuration="Release" -if [ "$2" != "" ] -then +if [ "$2" != "" ]; then libraries_configuration=${2,,} # Lowercase all characters in $1 libraries_configuration=${libraries_configuration^} # Uppercase first character fi -echo "StressConfiguration: $stress_configuration, LibrariesConfiguration: $libraries_configuration" +testhost_root=$repo_root/artifacts/bin/testhost/net$version-Linux-$libraries_configuration-x64 +echo "StressConfiguration: $stress_configuration, LibrariesConfiguration: $libraries_configuration, testhost: $testhost_root" + +if [[ ! -d $testhost_root ]]; then + echo "Cannot find testhost in: $testhost_root" + echo "Make sure libraries with the requested configuration are built!" + echo "Usage:" + echo "./build-local.sh [StressConfiguration] [LibrariesConfiguration]" + echo "StressConfiguration and LibrariesConfiguration default to Release!" + exit 2 +fi -if [ ! -d $daily_dotnet_root ]; -then +if [[ ! -d $daily_dotnet_root ]]; then echo "Downloading daily SDK to $daily_dotnet_root" mkdir $daily_dotnet_root wget https://dot.net/v1/dotnet-install.sh -O $daily_dotnet_root/dotnet-install.sh @@ -35,14 +42,11 @@ else echo "Daily SDK found in $daily_dotnet_root" fi -testhost_root=$repo_root/artifacts/bin/testhost/net$version-Linux-$libraries_configuration-x64 - export DOTNET_ROOT=$daily_dotnet_root export PATH=$DOTNET_ROOT:$PATH export DOTNET_MULTILEVEL_LOOKUP=0 -if [ ! -d "$testhost_root/shared/Microsoft.AspNetCore.App" ] -then +if [[ ! -d "$testhost_root/shared/Microsoft.AspNetCore.App" ]]; then echo "Copying Microsoft.AspNetCore.App bits from daily SDK to testhost: $testhost_root" cp -r $daily_dotnet_root/shared/Microsoft.AspNetCore.App $testhost_root/shared/Microsoft.AspNetCore.App else @@ -53,8 +57,7 @@ echo "Building solution." dotnet build -c $stress_configuration runscript=./run-stress-${stress_configuration,,}-${libraries_configuration,,}.sh -if [ ! -f $runscript ] -then +if [[ ! -f $runscript ]]; then echo "Generating runscript." echo "$testhost_root/dotnet exec ./bin/$stress_configuration/net$version/HttpStress.dll \$@" > $runscript chmod +x $runscript From 6557474e9539e7688866aa0fb192bb8c0c7466f7 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Fri, 26 Nov 2021 17:25:05 +0000 Subject: [PATCH 19/19] improve the rest of the scripts --- .../StressTests/HttpStress/build-local.ps1 | 15 +++++++++--- .../StressTests/HttpStress/build-local.sh | 2 +- .../StressTests/SslStress/Build-Local.ps1 | 13 +++++++++-- .../StressTests/SslStress/build-local.sh | 23 +++++++++++-------- 4 files changed, 38 insertions(+), 15 deletions(-) diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.ps1 b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.ps1 index d5b15e2c65ffcf..077dbdb922591b 100644 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.ps1 +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.ps1 @@ -17,7 +17,18 @@ if (-not ([string]::IsNullOrEmpty($args[1]))) { $LibrariesConfiguration = $args[0] } -Write-Host "StressConfiguration: $StressConfiguration, LibrariesConfiguration: $LibrariesConfiguration" +$TestHostRoot="$RepoRoot/artifacts/bin/testhost/net$Version-windows-$LibrariesConfiguration-x64" + +Write-Host "StressConfiguration: $StressConfiguration, LibrariesConfiguration: $LibrariesConfiguration, testhost: $TestHostRoot" + +if (-not (Test-Path -Path $TestHostRoot)) { + Write-Host "Cannot find testhost in: $TestHostRoot" + Write-Host "Make sure libraries with the requested configuration are built!" + Write-Host "Usage:" + Write-Host "./build-local.sh [StressConfiguration] [LibrariesConfiguration]" + Write-Host "StressConfiguration and LibrariesConfiguration default to Release!" + exit 1 +} if (-not (Test-Path -Path $DailyDotnetRoot)) { Write-Host "Downloading daily SDK to: $DailyDotnetRoot" @@ -28,8 +39,6 @@ if (-not (Test-Path -Path $DailyDotnetRoot)) { Write-Host "Daily SDK found in $DailyDotnetRoot" } -$TestHostRoot="$RepoRoot/artifacts/bin/testhost/net$Version-windows-$LibrariesConfiguration-x64" - $env:DOTNET_ROOT=$DailyDotnetRoot $env:PATH="$DailyDotnetRoot;$env:PATH" $env:DOTNET_MULTILEVEL_LOOKUP=0 diff --git a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.sh b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.sh index 78e0545150b9fc..9455c31c1ce6b2 100755 --- a/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.sh +++ b/src/libraries/System.Net.Http/tests/StressTests/HttpStress/build-local.sh @@ -30,7 +30,7 @@ if [[ ! -d $testhost_root ]]; then echo "Usage:" echo "./build-local.sh [StressConfiguration] [LibrariesConfiguration]" echo "StressConfiguration and LibrariesConfiguration default to Release!" - exit 2 + exit 1 fi if [[ ! -d $daily_dotnet_root ]]; then diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Build-Local.ps1 b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Build-Local.ps1 index 87c3548a9bd04f..dc8ae9b4494094 100644 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/Build-Local.ps1 +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/Build-Local.ps1 @@ -21,10 +21,19 @@ if (-not ([string]::IsNullOrEmpty($args[1]))) { $LibrariesConfiguration = $args[0] } -Write-Host "StressConfiguration: $StressConfiguration, LibrariesConfiguration: $LibrariesConfiguration" - $TestHostRoot="$RepoRoot/artifacts/bin/testhost/net$Version-windows-$LibrariesConfiguration-x64" +Write-Host "StressConfiguration: $StressConfiguration, LibrariesConfiguration: $LibrariesConfiguration, testhost: $TestHostRoot" + +if (-not (Test-Path -Path $TestHostRoot)) { + Write-Host "Cannot find testhost in: $TestHostRoot" + Write-Host "Make sure libraries with the requested configuration are built!" + Write-Host "Usage:" + Write-Host "./build-local.sh [StressConfiguration] [LibrariesConfiguration]" + Write-Host "StressConfiguration and LibrariesConfiguration default to Release!" + exit 1 +} + Write-Host "Building solution." dotnet build -c $StressConfiguration diff --git a/src/libraries/System.Net.Security/tests/StressTests/SslStress/build-local.sh b/src/libraries/System.Net.Security/tests/StressTests/SslStress/build-local.sh index d7fb4cabc37acd..80237579a1467a 100755 --- a/src/libraries/System.Net.Security/tests/StressTests/SslStress/build-local.sh +++ b/src/libraries/System.Net.Security/tests/StressTests/SslStress/build-local.sh @@ -12,29 +12,34 @@ version=7.0 repo_root=$(git rev-parse --show-toplevel) stress_configuration="Release" -if [ "$1" != "" ] -then +if [ "$1" != "" ]; then stress_configuration=${1,,} # Lowercase all characters in $1 stress_configuration=${stress_configuration^} # Uppercase first character fi libraries_configuration="Release" -if [ "$2" != "" ] -then +if [ "$2" != "" ]; then libraries_configuration=${2,,} # Lowercase all characters in $1 libraries_configuration=${libraries_configuration^} # Uppercase first character fi -echo "StressConfiguration: $stress_configuration, LibrariesConfiguration: $libraries_configuration" +testhost_root=$repo_root/artifacts/bin/testhost/net$version-Linux-$libraries_configuration-x64 +echo "StressConfiguration: $stress_configuration, LibrariesConfiguration: $libraries_configuration, testhost: $testhost_root" + +if [[ ! -d $testhost_root ]]; then + echo "Cannot find testhost in: $testhost_root" + echo "Make sure libraries with the requested configuration are built!" + echo "Usage:" + echo "./build-local.sh [StressConfiguration] [LibrariesConfiguration]" + echo "StressConfiguration and LibrariesConfiguration default to Release!" + exit 1 +fi echo "Building solution." dotnet build -c $stress_configuration -testhost_root=$repo_root/artifacts/bin/testhost/net$version-Linux-$libraries_configuration-x64 - runscript=./run-stress-${stress_configuration,,}-${libraries_configuration,,}.sh -if [ ! -f $runscript ] -then +if [[ ! -f $runscript ]]; then echo "Generating runscript." echo "$testhost_root/dotnet exec ./bin/$stress_configuration/net$version/SslStress.dll \$@" > $runscript chmod +x $runscript