# HG changeset patch # User Pierre-Yves David # Date 1396422081 25200 # Node ID 9fae01831deab65c66879a2b0eb7fd13427c1c52 # Parent f52e4ca93529d876f36631583645b8fa34b5a8d2 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. diff -r f52e4ca93529 -r 9fae01831dea tests/test-hup.t --- a/tests/test-hup.t Mon Mar 31 16:03:34 2014 -0700 +++ b/tests/test-hup.t Wed Apr 02 00:01:21 2014 -0700 @@ -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