tests: make test-hup more race-proof stable
authorMatt Mackall <mpm@selenic.com>
Mon, 02 Apr 2012 16:04:07 -0500
branchstable
changeset 16342 7e24d34837a9
parent 16341 91eec29dd7de
child 16343 7df81cec14a4
child 16344 fb765286f2f9
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.
tests/test-hup.t
--- a/tests/test-hup.t	Mon Apr 02 15:06:36 2012 -0500
+++ b/tests/test-hup.t	Mon Apr 02 16:04:07 2012 -0500
@@ -3,7 +3,7 @@
   $ "$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 @@
   $ (
   > 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