Bug 1164618 - Start Xvfb in a loop in docker images; r=dustin

Sometimes the Xvfb sanity check can fail due to slow startup times,
this introduces a simple retry system, with sleeps, to ensure that failures are
due to another cause.

--HG--
extra : amend_source : efed55e9eb5f44779595a1f1293ae17ebb48a9b8
This commit is contained in:
Morgan Phillips 2015-05-22 13:15:18 -04:00
Родитель 029439cade
Коммит ba92d60a25
1 изменённых файлов: 15 добавлений и 3 удалений

Просмотреть файл

@ -80,9 +80,21 @@ if $NEED_XVFB; then
xvfb_pid=$!
# Only error code 255 matters, because it signifies that no
# display could be opened. As long as we can open the display
# tests should work.
sleep 2 # we need to sleep so that Xvfb has time to startup
xvinfo || if [ $? == 255 ]; then exit 255; fi
# tests should work. We'll retry a few times with a sleep before
# failing.
retry_count=0
max_retries=2
xvfb_test=0
until [ $retry_count -gt $max_retries ]; do
xvinfo || xvfb_test=$?
if [ $xvfb_test != 255 ]; then
retry_count=$(($max_retries + 1))
else
retry_count=$(($retry_count + 1))
echo "Failed to start Xvfb, retry: $retry_count"
sleep 2
fi done
if [ $xvfb_test == 255 ]; then exit 255; fi
fi
# set up mozharness configuration, via command line, env, etc.