Mercurial > hg > mercurial-crew
diff tests/test-hup.t @ 20896:9fae01831dea
tests: prevent test-hup from hanging 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.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 02 Apr 2014 00:01:21 -0700 |
parents | f64b25f147d7 |
children | 7a9cbb315d84 |
line wrap: on
line diff
--- a/tests/test-hup.t +++ b/tests/test-hup.t @@ -11,7 +11,16 @@ $ ( > 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 start after 10 seconds" >&2; + > exit 1; + > fi + > done > kill -HUP $P > ) > p