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,9 +145,11 @@ 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
|
||||||
sed -e 's,Serving HTTP on 0.0.0.0 port \([0-9]*\) \.\.\.,\1,' < ${test_tmpdir}/httpd-output > ${test_tmpdir}/httpd-port
|
if test -e ${test_tmpdir}/httpd-output; then
|
||||||
if ! cmp ${test_tmpdir}/httpd-output ${test_tmpdir}/httpd-port 1>/dev/null; then
|
sed -e 's,Serving HTTP on 0.0.0.0 port \([0-9]*\) \.\.\.,\1,' < ${test_tmpdir}/httpd-output > ${test_tmpdir}/httpd-port
|
||||||
break
|
if ! cmp ${test_tmpdir}/httpd-output ${test_tmpdir}/httpd-port 1>/dev/null; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user