Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
20895:f52e4ca93529 | 20896:9fae01831dea |
---|---|
9 Do test while holding fifo open | 9 Do test while holding fifo open |
10 | 10 |
11 $ ( | 11 $ ( |
12 > echo lock | 12 > echo lock |
13 > echo addchangegroup | 13 > echo addchangegroup |
14 > while [ ! -s .hg/store/journal ]; do sleep 0; done | 14 > start=`date +%s` |
15 > # 10 second seems much enough to let the server catch up | |
16 > deadline=`expr $start + 10` | |
17 > while [ ! -s .hg/store/journal ]; do | |
18 > sleep 0; | |
19 > if [ `date +%s` -gt $deadline ]; then | |
20 > echo "transaction did not start after 10 seconds" >&2; | |
21 > exit 1; | |
22 > fi | |
23 > done | |
15 > kill -HUP $P | 24 > kill -HUP $P |
16 > ) > p | 25 > ) > p |
17 | 26 |
18 $ wait | 27 $ wait |
19 $ cat out | 28 $ cat out |