This is an archive of the discontinued Mercurial Phabricator instance.

test-run-tests: stabilize the test (issue5735)
ClosedPublic

Authored by quark on Jan 8 2018, 8:07 PM.

Details

Summary

Previously there is a race condition because things happen in this order:

  1. Check shouldStop
  2. If shouldStop is false, print the diff
  3. Call fail() -> set shouldStop

The check and set should really happen in a same critical section.

This patch adds a lock to address the issue.

Test Plan

Run run-tests.py -l test-run-tests.t 20 times on gcc112 and the race
condition does not reproduce.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

quark created this revision.Jan 8 2018, 8:07 PM
yuja accepted this revision.Jan 10 2018, 8:21 AM
yuja added a subscriber: yuja.

Queued for stable. Thanks for fixing this issue.

This revision is now accepted and ready to land.Jan 10 2018, 8:21 AM
This revision was automatically updated to reflect the committed changes.

As a note (re your test plan): there's a --runs-per-test flag on run-tests for exactly this kind of "did I fix a flaky test" debugging. I often set it to 100. :)