Repository navigation
Stabilize HangDump template-filename tests on macOS - #8323
Amaury Levé (Evangelink) merged 1 commit into
Conversation
HangDump_TemplateFileName_CreateDump and HangDump_TemplateFileNameWithSubdirectory_CreateDump set SLEEPTIMEMS2=20000 (20 s) while every other hang-triggering test in HangDumpTests.cs uses 600000 (10 min). On macOS, `createdump` writes a full ~5.6 GB core dump that takes ~140 s to flush. When the test host's second sleep is only 20 s, the host completes its run and exits with code 0 before createdump can kill it, so AssertExitCodeIs(TestHostProcessExitedNonGracefully) (expected exit code 7) fails. The pattern shows up consistently on the macOS Debug leg, e.g.: Hang dump timeout of '00:00:08' expired ... [createdump] Dump successfully written in 139717ms Test run summary: Passed! ... ExitCode: 0 Align both tests with the surrounding hang-triggering tests (HangDump_DefaultSetting_CreateDump, HangDump_CustomFileName_CreateDump, HangDump_PathWithSpaces_CreateDump, HangDump_Formats_CreateDump, etc.) by using SLEEPTIMEMS2=600000 so the test host stays alive long enough for createdump to terminate it on all platforms. The path-traversal test (HangDump_TemplateWithPathTraversal_RejectsAndFails) intentionally keeps 20000 because its hangdump-filename is rejected at option validation time before any sleep matters. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR stabilizes HangDump template filename acceptance tests by keeping the test host alive long enough for dump collection to complete and terminate the process, matching existing hang-triggering test behavior.
Changes:
- Increased
SLEEPTIMEMS2from 20 seconds to 10 minutes in two template filename hang dump tests. - Left validation-only path traversal test behavior unchanged.
Show a summary per file
| File | Description |
|---|---|
test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpTests.cs |
Aligns two hang-triggering template dump tests with sibling tests by using a longer second sleep. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
Amaury Levé (Evangelink)
left a comment
There was a problem hiding this comment.
Review Summary
✅ 21/21 dimensions clean — no findings.
Analysis
This is a minimal, well-targeted flakiness fix. The root cause is clearly documented and the fix is consistent with the established pattern throughout the file.
Why the fix is correct:
SLEEPTIMEMS2is the sleep after the first test node is published. It keeps the test host alive while the hang-dump timeout fires and whilecreatedumpwrites its dump and kills the host.- On macOS,
createdumpwrites a full core dump (~5.6 GB, ~140 s). With only 20 s of sleep, the host finishes its run and exits with code0beforecreatedumpcan terminate it — soAssertExitCodeIs(TestHostProcessExitedNonGracefully)(expected exit code7) fails. - 600000 ms (10 min) matches every other hang-triggering test in this file (
HangDump_DefaultSetting_CreateDump,HangDump_CustomFileName_CreateDump,HangDump_PathWithSpaces_CreateDump,HangDump_Formats_CreateDump,HangDump_WithDotnetTest_CreateDump). HangDump_TemplateWithPathTraversal_RejectsAndFailsintentionally retains 20 s — its--hangdump-filenameis rejected at option-validation time before any sleep executes, so it is not subject to the createdump race. This exception is correct and clearly reasoned.
Test isolation: Each test creates its result directory under Guid.NewGuid().ToString("N"), so no cross-test file-system contention.
This is the same well-established mitigation applied in #7172, #7005, and #7028 for sibling tests. The fix is appropriate and complete.
Generated by Expert Code Review (on open) for issue #8323 · ● 3.8M
HangDump_TemplateFileName_CreateDumpandHangDump_TemplateFileNameWithSubdirectory_CreateDumpsetSLEEPTIMEMS2=20000(20 s) while every other hang-triggering test inHangDumpTests.csuses600000(10 min).On macOS,
createdumpwrites a full ~5.6 GB core dump that takes ~140 s to flush. When the test host's second sleep is only 20 s, the host completes its run and exits with code 0 beforecreatedumpcan kill it, soAssertExitCodeIs(TestHostProcessExitedNonGracefully)(expected exit code7) fails. The pattern shows up consistently on the macOS Debug leg, e.g.:This is the same class of macOS flake that #7172, #7005, #7028 etc. addressed for sibling tests.
Fix
Align both tests with the surrounding hang-triggering tests (
HangDump_DefaultSetting_CreateDump,HangDump_CustomFileName_CreateDump,HangDump_PathWithSpaces_CreateDump,HangDump_Formats_CreateDump,HangDump_WithDotnetTest_CreateDump) by usingSLEEPTIMEMS2=600000so the test host stays alive long enough forcreatedumpto terminate it on all platforms.Out of scope
HangDump_TemplateWithPathTraversal_RejectsAndFailsintentionally keepsSLEEPTIMEMS2=20000- its--hangdump-filenameis rejected during option validation before any sleep matters, so it isn't subject to the createdump race.Validation
Microsoft.Testing.Platform.Acceptance.IntegrationTestssucceeds.