Skip to content

--hangdump-timeout is for the whole test run instead of per-test on macOS #7060

@elinor-fung

Description

@elinor-fung

Describe the bug

When using the --hangdump-timeout option, the value is considered for the entire test run on macOS. I would expect --hangdump-timeout to be the equivalent of --blame-hang-timeout, which is per-test. It is per-test on Windows.

Steps To Reproduce

  1. Create an xunit v3 test project
    dotnet new install xunit.v3.templates
    dotnet new xunit3 -o xunit-test
    
  2. Add a reference to Microsoft.Testing.Extensions.HangDump
  3. Add the following test methods:
    [Fact]
    public void Test1() => Thread.Sleep(2000);
    
    [Fact]
    public void Test2() => Thread.Sleep(2000);
  4. Build and run the tests, specifying 3s as the timeout:
    xunit3-test --hangdump --hangdump-timeout 3s --no-progress --output Detailed

Expected behavior

The --hangdump-timeout of 3s is per-test and the test run does not hit the timeout. This is the case when running on Windows.

passed xunit3_test.UnitTest1.Test1 (2s 010ms)
passed xunit3_test.UnitTest1.Test2 (2s 001ms)

Actual behavior

The --hangdump-timeout of 3s appears to be for the entire test run, so the run hits the timeout and fails. This happens on macOS, but not Windows.

passed xunit3_test.UnitTest1.Test1 (2s 011ms)
Hang dump timeout of '00:00:03' expired
Dumping process 52649 - xunit3-test
The following tests were still running when dump was taken (format: [<time-elapsed-since-start>] <name>):
[00:00:01] xunit3_test.UnitTest1.Test2

Additional context

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" />

I have tried this with both MTP v2:

<PackageReference Include="xunit.v3.mtp-v2" Version="3.2.1" />
<PackageReference Include="Microsoft.Testing.Extensions.HangDump" Version="2.0.2" />

And v1:

<PackageReference Include="xunit.v3" Version="3.2.1" />
<PackageReference Include="Microsoft.Testing.Extensions.HangDump" Version="1.9.1" />

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions