Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Work around cmd command length limit in xunit Exec task #19095

Merged
merged 1 commit into from
Jul 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/src/dir.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

<!-- Setup the default output and intermediate paths -->
<PropertyGroup>
<BaseOutputPath>$(ProjectDir)\..\bin\tests</BaseOutputPath>
<BaseOutputPath>$(ProjectDir)..\bin\tests</BaseOutputPath>
<BaseOutputPath Condition="'$(__TestRootDir)' != ''">$(__TestRootDir)</BaseOutputPath>
<BaseOutputPathWithConfig>$(BaseOutputPath)\$(OSPlatformConfig)\</BaseOutputPathWithConfig>
<BinDir>$(BaseOutputPathWithConfig)</BinDir>
Expand Down
17 changes: 16 additions & 1 deletion tests/tests.targets
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,24 @@

<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>
<Exec Command="$(XunitCommandLine)" />

<Error Condition="$(XunitCommandLine.Length) > 8191" Text="Xunit command line is too long." />
<Exec Command="$(XunitCommandLine)"
WorkingDirectory="$(BaseOutputPathWithConfig)"/>

</Target>

Expand Down