diff options
author | Sven Boemer <sbomer@gmail.com> | 2018-07-24 08:22:31 -0700 |
---|---|---|
committer | Jarret Shook <jashoo@microsoft.com> | 2018-07-24 08:22:31 -0700 |
commit | ad4df07bf2ea70334ada357d1240099e61b1d170 (patch) | |
tree | 5844cc8e92b15a9b8a9a2ac423871715dc7f5a32 /tests/tests.targets | |
parent | 40286fc32e89c9eeda8b97d74cf0fb887469298b (diff) | |
download | coreclr-ad4df07bf2ea70334ada357d1240099e61b1d170.tar.gz coreclr-ad4df07bf2ea70334ada357d1240099e61b1d170.tar.bz2 coreclr-ad4df07bf2ea70334ada357d1240099e61b1d170.zip |
Work around cmd command length limit in xunit Exec task (#19095)
On Windows, the Exec task passes the command to cmd, so long commands
run into the command length limit (see
https://github.com/Microsoft/msbuild/issues/2530). This workaround
shortens the xunit command line by replacing the path to the test
binary directory with an environment variable.
Diffstat (limited to 'tests/tests.targets')
-rw-r--r-- | tests/tests.targets | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/tests.targets b/tests/tests.targets index 9a16cb0e0b..e1e6f58ba8 100644 --- a/tests/tests.targets +++ b/tests/tests.targets @@ -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> |