libtest: Squash a race in temp webserver setup
Saw this in one of the PR contexts. Closes: #1031 Approved by: jlebon
This commit is contained in:
parent
d4af84d428
commit
57937d0e63
@ -145,10 +145,12 @@ setup_test_repository () {
|
|||||||
run_temp_webserver() {
|
run_temp_webserver() {
|
||||||
env PYTHONUNBUFFERED=1 setsid python -m SimpleHTTPServer 0 >${test_tmpdir}/httpd-output &
|
env PYTHONUNBUFFERED=1 setsid python -m SimpleHTTPServer 0 >${test_tmpdir}/httpd-output &
|
||||||
for x in $(seq 50); do
|
for x in $(seq 50); do
|
||||||
|
if test -e ${test_tmpdir}/httpd-output; then
|
||||||
sed -e 's,Serving HTTP on 0.0.0.0 port \([0-9]*\) \.\.\.,\1,' < ${test_tmpdir}/httpd-output > ${test_tmpdir}/httpd-port
|
sed -e 's,Serving HTTP on 0.0.0.0 port \([0-9]*\) \.\.\.,\1,' < ${test_tmpdir}/httpd-output > ${test_tmpdir}/httpd-port
|
||||||
if ! cmp ${test_tmpdir}/httpd-output ${test_tmpdir}/httpd-port 1>/dev/null; then
|
if ! cmp ${test_tmpdir}/httpd-output ${test_tmpdir}/httpd-port 1>/dev/null; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
done
|
done
|
||||||
port=$(cat ${test_tmpdir}/httpd-port)
|
port=$(cat ${test_tmpdir}/httpd-port)
|
||||||
|
Loading…
Reference in New Issue
Block a user