From f5a2245957db4aa49584cb263280687343d2d441 Mon Sep 17 00:00:00 2001 From: Brennan <brecon@microsoft.com> Date: Tue, 17 Mar 2020 12:26:40 -0700 Subject: [PATCH] Use xunit.runner.json in Helix runs (#19922) --- eng/helix/content/default.runner.json | 5 +++++ eng/helix/content/runtests.cmd | 9 +++++++-- eng/helix/content/runtests.sh | 13 +++++++++---- src/ProjectTemplates/Directory.Build.props | 6 ++++++ src/ProjectTemplates/xunit.runner.json | 5 +++++ src/SignalR/xunit.runner.json | 2 +- 6 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 eng/helix/content/default.runner.json create mode 100644 src/ProjectTemplates/xunit.runner.json diff --git a/eng/helix/content/default.runner.json b/eng/helix/content/default.runner.json new file mode 100644 index 00000000000..dfb6dacb887 --- /dev/null +++ b/eng/helix/content/default.runner.json @@ -0,0 +1,5 @@ +{ + "longRunningTestSeconds": 60, + "diagnosticMessages": true, + "maxParallelThreads": -1 +} diff --git a/eng/helix/content/runtests.cmd b/eng/helix/content/runtests.cmd index f119653782d..ce069ddcd61 100644 --- a/eng/helix/content/runtests.cmd +++ b/eng/helix/content/runtests.cmd @@ -27,13 +27,13 @@ echo "Checking for Microsoft.AspNetCore.App" if EXIST ".\Microsoft.AspNetCore.App" ( echo "Found Microsoft.AspNetCore.App, copying to %DOTNET_ROOT%\shared\Microsoft.AspNetCore.App\%runtimeVersion%" xcopy /i /y ".\Microsoft.AspNetCore.App" %DOTNET_ROOT%\shared\Microsoft.AspNetCore.App\%runtimeVersion%\ - + echo "Adding current directory to nuget sources: %HELIX_WORKITEM_ROOT%" dotnet nuget add source %HELIX_WORKITEM_ROOT% dotnet nuget add source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json dotnet nuget list source dotnet tool install dotnet-ef --global --version %$efVersion% - + set PATH=!PATH!;%DOTNET_CLI_HOME%\.dotnet\tools ) @@ -49,6 +49,11 @@ echo Creating nuget restore directory: %NUGET_RESTORE% mkdir %NUGET_RESTORE% mkdir logs +REM "Rename default.runner.json to xunit.runner.json if there is not a custom one from the project" +if not EXIST ".\xunit.runner.json" ( + copy default.runner.json xunit.runner.json +) + dir %DOTNET_ROOT%\dotnet vstest %$target% -lt >discovered.txt diff --git a/eng/helix/content/runtests.sh b/eng/helix/content/runtests.sh index 2d3b9d8ad0e..9ff0133e34f 100644 --- a/eng/helix/content/runtests.sh +++ b/eng/helix/content/runtests.sh @@ -98,17 +98,22 @@ if [ -d "Microsoft.AspNetCore.App" ] then echo "Found Microsoft.AspNetCore.App directory, copying to $DOTNET_ROOT/shared/Microsoft.AspNetCore.App/$dotnet_runtime_version." cp -r Microsoft.AspNetCore.App $DOTNET_ROOT/shared/Microsoft.AspNetCore.App/$dotnet_runtime_version - + echo "Adding current directory to nuget sources: $DIR" dotnet nuget add source $DIR dotnet nuget add source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json dotnet nuget list source - + dotnet tool install dotnet-ef --global --version $efVersion - + # Ensure tools are on on PATH export PATH="$PATH:$DOTNET_CLI_HOME/.dotnet/tools" - +fi + +# Rename default.runner.json to xunit.runner.json if there is not a custom one from the project +if [ ! -f "xunit.runner.json" ] +then + cp default.runner.json xunit.runner.json fi if [ -e /proc/self/coredump_filter ]; then diff --git a/src/ProjectTemplates/Directory.Build.props b/src/ProjectTemplates/Directory.Build.props index c12abcf463e..c97ca68bd06 100644 --- a/src/ProjectTemplates/Directory.Build.props +++ b/src/ProjectTemplates/Directory.Build.props @@ -8,4 +8,10 @@ </PropertyGroup> <Import Project="TemplateProjects.props" Condition="'$(IsTestProject)' != 'true' AND '$(IsTestAssetProject)' != 'true'" /> + + <ItemGroup Condition="'$(IsTestProject)' == 'true'"> + <Content Include="$(MSBuildThisFileDirectory)xunit.runner.json" Link="xunit.runner.json"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Content> + </ItemGroup> </Project> diff --git a/src/ProjectTemplates/xunit.runner.json b/src/ProjectTemplates/xunit.runner.json new file mode 100644 index 00000000000..dfb6dacb887 --- /dev/null +++ b/src/ProjectTemplates/xunit.runner.json @@ -0,0 +1,5 @@ +{ + "longRunningTestSeconds": 60, + "diagnosticMessages": true, + "maxParallelThreads": -1 +} diff --git a/src/SignalR/xunit.runner.json b/src/SignalR/xunit.runner.json index d25ea9035a2..221b37e42dc 100644 --- a/src/SignalR/xunit.runner.json +++ b/src/SignalR/xunit.runner.json @@ -2,4 +2,4 @@ "longRunningTestSeconds": 30, "diagnosticMessages": true, "maxParallelThreads": -1 -} +} \ No newline at end of file -- GitLab