changeset 16342:7e24d34837a9 stable

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.
author Matt Mackall <mpm@selenic.com>
date Mon, 02 Apr 2012 16:04:07 -0500
parents 91eec29dd7de
children 7df81cec14a4 fb765286f2f9
files tests/test-hup.t
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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