Fix the flaky crash-report case in swift-test-summary.test.sh

Merged
TE
16d ago
+7-1

The "test helper dies on a signal" case in scripts/cmux-next/tests/swift-test-summary.test.sh flakes in two ways. This PR fixes both in the test only; the sampler script is unchanged.

  1. The sampler's log vanished on CI. On #23076's Linux CI (job 119082777090) the check printed "no crash ::error line". Its log shows awk: fatal: cannot open file /tmp/swift-test-log.RQ7ALW and sed: can't read the same file: the sampler's mktemp log in the shared /tmp was gone before the report step read it. Without the log it never saw the signal line, so it printed no crash error at all. The check runs beside many others under scripts/ci/run-checks-concurrently.sh. I did not find what deletes the file. The test now gives every sampler run TMPDIR=$TMP/tmp, so the log lives in the test's own temp dir.
  2. A whole-second mtime race (macOS, locally). The sampler records started_at=$(date +%s), and ips-crash-summary.py skips reports with mtime below it. A report written at second X.9 with a run start at X+1 counts as from before the run, and the test fails with "the crash error does not name the crashed thread's test frame". The test now sets the fresh report's mtime 60 s ahead with python3 os.utime; nothing in the test sorts by mtime or bounds it from above. The old-report touch -t 202001010000 line is unchanged.

Review (claude-review-subagent) at c55857b found that change 2 alone could not cause the CI failure above; change 1 is the response.

Changelog

none

Observed / Not run

  • Observed (macOS, this Mac, 2 = only the mtime change): 15/15 passed. Base: 14/15 in the same loop, and 1 of 3 on an untouched tree, both with the frame message.
  • Observed (macOS, with both changes at 9093e36): 86 of 87 runs passed. The output of the one failure was not kept, so I don't know its cause.
  • Not reproduced: the CI deletion of the sampler log. Change 1 removes the shared /tmp from the path; whether it fully stops the CI flake shows only on CI over time.
  • Observed: python3 scripts/cmux-next/prepush-gate.py reported no new violations.

Agent session: cosmic-gray

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes the flaky "test helper dies on a signal" case in scripts/cmux-next/tests/swift-test-summary.test.sh where a fresh crash report was sometimes skipped as too old.

The run wrapper records started_at in whole seconds; a report written at second X.9 followed by a start at X+1 is read as predating the run, so ips-crash-summary.py skips it. The test now sets the report's mtime 60 seconds ahead via python3 os.utime, leaving the script's skip rule unchanged. python3 is used instead of date -v/date -d since the test runs on both macOS and Linux.