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.
This commit is contained in:
Morgan Phillips 2015-05-22 13:15:18 -04:00
parent 76d0709cbe
commit 362b14807e

View File

@ -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.