diff options
author | Michael Vogt <mvo@debian.org> | 2014-04-10 09:39:35 +0200 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2014-04-10 09:39:35 +0200 |
commit | a1a253e8be978998b66af62240a25864db2cc694 (patch) | |
tree | 485efb6b77d063b08045153478e704e804242b7e /test/integration/framework | |
parent | 4c3722e3a74f183b331b0a782017ae442ca143fb (diff) | |
parent | 5ff678f7a22bb3206f5e46fcbdd00e56cb44b99e (diff) |
Merge branch 'debian/sid' into ubuntu/master
Diffstat (limited to 'test/integration/framework')
-rw-r--r-- | test/integration/framework | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/integration/framework b/test/integration/framework index 1c6f041b0..8d8a0becc 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -879,6 +879,20 @@ rewritesourceslist() { done } +# wait for up to 10s for a pid file to appear to avoid possible race +# when a helper is started and dosn't write the PID quick enough +waitforpidfile() { + local PIDFILE="$1" + for i in $(seq 10); do + if test -s "$PIDFILE"; then + return 0 + fi + sleep 1 + done + msgdie "waiting for $PIDFILE failed" + return 1 +} + changetowebserver() { if [ "$1" != '--no-rewrite' ]; then rewritesourceslist 'http://localhost:8080/' @@ -892,6 +906,7 @@ changetowebserver() { cat $LOG false fi + waitforpidfile aptwebserver.pid local PID="$(cat aptwebserver.pid)" if [ -z "$PID" ]; then msgdie 'Could not fork aptwebserver successfully' @@ -919,7 +934,11 @@ accept = 4433 connect = 8080 " > ${TMPWORKINGDIRECTORY}/stunnel.conf stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf" + waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid" local PID="$(cat ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid)" + if [ -z "$PID" ]; then + msgdie 'Could not fork stunnel4 successfully' + fi addtrap 'prefix' "kill ${PID};" rewritesourceslist 'https://localhost:4433/' } |