corert/tests/CoreCLR/tests.targets

83 строки
4.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<_SkipTestAssemblies Include="$(SkipTestAssemblies)" />
</ItemGroup>
<PropertyGroup>
<TestAssemblyDir Condition="'$(TestAssemblyDir)' == ''">$(BaseOutputPathWithConfig)</TestAssemblyDir>
<__TestRunHtmlLog Condition="'$(__TestRunHtmlLog)' == ''">$(__LogsDir)\testResults.html</__TestRunHtmlLog>
<__TestRunXmlLog Condition="'$(__TestRunXmlLog)' == ''">$(__LogsDir)\testResults.xml</__TestRunXmlLog>
</PropertyGroup>
<Target Name="FindTestDirectories">
<ItemGroup>
<AllTestAssemblies Include="$(BaseOutputPathWithConfig)**\*.XUnitWrapper.dll" />
<TestAssemblies Include="@(AllTestAssemblies)" Exclude="@(_SkipTestAssemblies -> '$(TestAssemblyDir)%(Identity)\%(Identity).XUnitWrapper.dll')" />
</ItemGroup>
<Error Text=" The wrappers must be compiled and placed at $(TestAssemblyDir)\*\ before they can be run, Do a clean Test Run"
Condition="'@(AllTestAssemblies)' == ''" />
<Message Text= "AllTestAssemblies= @(AllTestAssemblies)"/>
<Message Text= "TestAssemblies= @(TestAssemblies)"/>
<Message Text= "_SkipTestAssemblies= @(_SkipTestAssemblies -> '$(TestAssemblyDir)%(Identity)\%(Identity).XUnitWrapper.dll')"/>
</Target>
<Target Name="RunTests"
DependsOnTargets="FindTestDirectories"
Condition="'$(SkipTests)' != 'True'">
<PropertyGroup>
<ExcludeTraits Condition="'$(ExcludeTraits)'==''">category=outerloop;category=failing</ExcludeTraits>
<!-- Run one assembly at a time on Linux/arm to avoid OutOfMemory (see https://github.com/dotnet/runtime/issues/11216) -->
<ParallelRun Condition="'$(ParallelRun)'=='' and '$(__BuildOS)'=='Linux' and '$(__BuildArch)'=='arm'">collections</ParallelRun>
<!-- Run one assembly at a time on arm64 to avoid excessive parallelism leading to test timeouts (see https://github.com/dotnet/runtime/issues/11981) -->
<ParallelRun Condition="'$(ParallelRun)'=='' and '$(__BuildArch)'=='arm64'">collections</ParallelRun>
<ParallelRun Condition="'$(ParallelRun)'==''">all</ParallelRun>
</PropertyGroup>
<ItemGroup>
<IncludeTraitsItems Include="$(IncludeTraits)" />
<ExcludeTraitsItems Include="$(ExcludeTraits)" />
</ItemGroup>
<Error Condition="'$(CORE_ROOT)' == ''" Text="CORE_ROOT is not set." />
<PropertyGroup>
<XunitConsoleRunner>$(CORE_ROOT)\xunit.console.dll</XunitConsoleRunner>
<XunitArgs>-parallel $(ParallelRun)</XunitArgs>
<XunitArgs>$(XunitArgs) -html $(__TestRunHtmlLog)</XunitArgs>
<XunitArgs>$(XunitArgs) -xml $(__TestRunXmlLog)</XunitArgs>
<XunitArgs>$(XunitArgs) @(IncludeTraitsItems->'-trait %(Identity)', ' ')</XunitArgs>
<XunitArgs>$(XunitArgs) @(ExcludeTraitsItems->'-notrait %(Identity)', ' ')</XunitArgs>
<!-- Color output doesn't work well when capturing the output in the CI system -->
<XunitArgs>$(XunitArgs) -nocolor</XunitArgs>
<CorerunExecutable Condition="'$(RunningOnUnix)' == 'true'">$(CORE_ROOT)\corerun</CorerunExecutable>
<CorerunExecutable Condition="'$(RunningOnUnix)' != 'true'">$(CORE_ROOT)\corerun.exe</CorerunExecutable>
</PropertyGroup>
<!-- Work around cmd command length limit by using relative paths
from working directory instead of full paths (see
https://github.com/Microsoft/msbuild/issues/2530) -->
<ItemGroup Condition="'$(RunningOnUnix)' != 'true'">
<_TestAssembliesRelative Include="@(TestAssemblies -> Replace('$(BaseOutputPathWithConfig)', '.\'))" />
<TestAssemblies Remove="@(TestAssemblies)" />
<TestAssemblies Include="@(_TestAssembliesRelative)" />
</ItemGroup>
<PropertyGroup>
<XunitCommandLine>$(CorerunExecutable) $(XunitConsoleRunner) @(TestAssemblies->'%(Identity)', ' ') $(XunitArgs)</XunitCommandLine>
</PropertyGroup>
<Message Text="Using $(BaseOutputPathWithConfig) as working directory." Importance="High" />
<Error Condition="$(XunitCommandLine.Length) > 8191 and '$(RunningOnUnix)' != 'true'" Text="Xunit command line is too long." />
<Exec Command="$(XunitCommandLine)"
WorkingDirectory="$(BaseOutputPathWithConfig)"/>
</Target>
</Project>