dotnet / dotnet/runtime

Enable test hang support for libraries tests

Open
#126,272 2 comments 0 reactions 1 assignee Claimed by @danmoseley View on GitHub
area-Infrastructure-libraries
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

We have next to no support for dumps of hanging tests/child processes in libraries test runs. (there is a little bit in RemoteExecutor that only works on Windows)

On xunit v2 the answer would likely be wrapping with vstest which has timeout/dump feature. But once https://github.com/dotnet/runtime/pull/125019 is merged and libraries are on xunit v3 it seems adding full hang support is straightforward. here is the work to do then:

1. merge https://github.com/dotnet/runtime/pull/125019 to get onto xunit v3 (by far the hard part)
1. add `` to`xunit.props `or whatever
1. add `--hangdump --hangdump-timeout 10m --hangdump-type Full --hangdump-filename $HELIX_DUMP_FOLDER/hangdump.dmp` where timeout is a bit less than the Helix timeout (which varies by arch) to `xunit.console.targets`
1. for the dump code in `RemoteExecutor` today we have two options
a. remove it, because HangDump dumps all the processes in the tree on a test hang
b. keep it, because it gives us a fine grained timeout, and a dump with only a single test failure, other tests continue, that is really nice. If we do this option, we should move from the current Win32 minidump API to use `DiagnosticsClient` (https://github.com/dotnet/diagnostics/blob/3d151d818166737df8a248d1f7a14f958012ebd5/src/Microsoft.Diagnostics.NETCore.Client/DiagnosticsClient/DiagnosticsClient.cs#L169) the same as `HangDump` does, which would give us dumps on all OS. And optionally-optionally, consider dumps on indirect children here.

==== unrelated ===
* there is also Microsoft.Testing.Extensions.CrashDump package but it's not clear what this would add (if anything) over our current use of DOTNET_DbgEnableMiniDump=1
* how CoreCLR gets hang dumps today - they wrap corerun executions in a timeout that then gets the dumps - ultimately through the same IPC that dotnet dump etc does. What we need to do for libraries is something analogous that fits around xunit/remote exec
* for crash dumps -- DOTNET_DbgEnableMiniDump=1 gets us these for all processes - -the test process, child processes, on all OS today. Nothing to do

summarizing notes from https://github.com/dotnet/runtime/issues/121873

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.