Skip to content

Enable test hang support for libraries tests #126272

@danmoseley

Description

@danmoseley

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 #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 Move libraries tests to xunit3 #125019 to get onto xunit v3 (by far the hard part)
  2. add <PackageReference Include="Microsoft.Testing.Extensions.HangDump" Version="..." /> toxunit.props or whatever
  3. 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
  4. 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 #121873

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions