# HG changeset patch # User Matt Mackall # Date 2012-04-02 21:04:07 # Node ID 7e24d34837a91fd44076b4c38532f9814925d2ac # Parent 91eec29dd7ded557530d16b6b71444cbb34cd01e tests: make test-hup more race-proof We need to wait until a journal exists AND is non-empty before aborting a transaction to get stable output. We move the kill wait outside the fifo block to avoid potential deadlock. diff --git a/tests/test-hup.t b/tests/test-hup.t --- a/tests/test-hup.t +++ b/tests/test-hup.t @@ -3,7 +3,7 @@ Test hangup signal in the middle of tran $ "$TESTDIR/hghave" serve fifo || exit 80 $ hg init $ mkfifo p - $ hg serve --stdio < p & + $ hg serve --stdio < p 1>out 2>&1 & $ P=$! Do test while holding fifo open @@ -11,10 +11,12 @@ Do test while holding fifo open $ ( > echo lock > echo addchangegroup - > while [ ! -e .hg/store/00changelog.i.a ]; do true; done + > while [ ! -s .hg/store/journal ]; do true; done > kill -HUP $P - > while kill -0 $P 2>/dev/null; do true; done > ) > p + + $ while kill -0 $P 2>/dev/null; do true; done + $ cat out 0 0 adding changesets