Skip to content

Commit

Permalink
Hot patch vstest.console to not terminate processes
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Mar 9, 2019
1 parent d0ff389 commit c032056
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions build/PatchVSTestConsole.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Replaces 'ldc.i4.s 100' with 'ldc.i4.m1, nop' to fix incorrect termination of the test host
# https://github.com/Microsoft/vstest/issues/1900

$file = Join-Path $PSScriptRoot '..\Tools\dotnetcli\sdk\2.1.503\Microsoft.TestPlatform.CrossPlatEngine.bin';
$bytes = [System.IO.File]::ReadAllBytes($file);
If ($bytes[0xE259] -eq 0x15 -and $bytes[0xE25A] -eq 0x00) {
# Already patched
Exit 0
}

If ($bytes[0xE259] -ne 0x1F -or $bytes[0xE25A] -ne 0x64) {
# Unexpected file
Exit 1
}

$bytes[0xE259] = 0x15;
$bytes[0xE25A] = 0x00;
[System.IO.File]::WriteAllBytes($file, $bytes);
3 changes: 3 additions & 0 deletions build/ci/phase-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ phases:
- ${{ if eq(parameters.name, 'MacOS') }}:
- script: brew update && brew install libomp mono-libgdiplus gettext && brew link gettext --force
displayName: Install runtime dependencies
- powershell: $(Build.SourcesDirectory)/build/PatchVSTestConsole.ps1
displayName: Hot patch vstest.console
condition: and(succeeded(), eq(variables._codeCoverage, 'true'))
- script: $(_buildScript) -$(_configuration) -runtests -coverage=$(_codeCoverage)
displayName: Run Tests.
- script: $(Build.SourcesDirectory)/Tools/dotnetcli/dotnet msbuild build/Codecoverage.proj /p:CodeCovToken=$(CODECOV_TOKEN)
Expand Down

0 comments on commit c032056

Please sign in to comment.