[PATCH] test: prevent test-hup to hang forever if the transaction does not start
pierre-yves.david at ens-lyon.org
pierre-yves.david at ens-lyon.org
Wed Apr 2 07:15:41 UTC 2014
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1396422081 25200
# Wed Apr 02 00:01:21 2014 -0700
# Node ID 108f59ec681455498e7fd32410554241f2ec82b5
# Parent 9e9e3a4e9261d31318f0f177538636370c50fe57
test: prevent test-hup to hang forever if the transaction does not start
If the transaction fails to start because of some programing errors, the test
would stay stuck in this while loop forever.
We now added a basic safeguard that abort the loop if nothing happen in 10
seconds. 10 seconds sounds enough to let the server catch up and open a
transaction.
diff --git a/tests/test-hup.t b/tests/test-hup.t
--- a/tests/test-hup.t
+++ b/tests/test-hup.t
@@ -9,11 +9,20 @@ Test hangup signal in the middle of tran
Do test while holding fifo open
$ (
> echo lock
> echo addchangegroup
- > while [ ! -s .hg/store/journal ]; do sleep 0; done
+ > start=`date +%s`
+ > # 10 second seems much enough to let the server catch up
+ > deadline=`expr $start + 10`
+ > while [ ! -s .hg/store/journal ]; do
+ > sleep 0;
+ > if [ `date +%s` -gt $deadline ]; then
+ > echo "transaction did not started after 10 seconds" >&2;
+ > exit 1;
+ > fi
+ > done
> kill -HUP $P
> ) > p
$ wait
$ cat out
More information about the Mercurial-devel
mailing list