Bug 1263815 - retry xvfb startup. r?dustin
MozReview-Commit-ID: 95IDKC1vHPx
--- a/taskcluster/scripts/tester/test-linux.sh
+++ b/taskcluster/scripts/tester/test-linux.sh
@@ -65,40 +65,63 @@ fi
# start up the pulseaudio daemon. Note that it's important this occur
# before the Xvfb startup.
if $NEED_PULSEAUDIO; then
pulseaudio --fail --daemonize --start
pactl load-module module-null-sink
fi
-# run XVfb in the background, if necessary
-if $NEED_XVFB; then
+start_xvfb() {
Xvfb :0 -nolisten tcp -screen 0 1600x1200x24 \
> ~/artifacts/public/xvfb.log 2>&1 &
- export DISPLAY=:0
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. We'll retry a few times with a sleep before
# failing.
retry_count=0
- max_retries=2
+ max_retries=5
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 fail "xvfb did not start properly"; fi
+ if [ $xvfb_test == 255 ]; then
+ return false
+ else
+ return true
+ fi
+done
+}
+
+# run XVfb in the background, if necessary
+if $NEED_XVFB; then
+ xvfb_retry_count=0
+ xvfb_max_retries=2
+ success=false
+ export DISPLAY=:0
+ until [ $xvfb_retry_count -gt $xvfb_max_retries ]; do
+ success = start_xvfb()
+ if success; then
+ xvfb_retry_count=$(($xvfb_max_retries + 1))
+ else
+ xvfb_retry_count=$(($xvfb_retry_count + 1))
+ fi
+ sleep 10
+ done
+ if [ ! success ]; then
+ fail "Could not start xvfb after ${xvfb_max_retries} attempts"
+ fi
fi
if $START_VNC; then
x11vnc > ~/artifacts/public/x11vnc.log 2>&1 &
fi
if $NEED_WINDOW_MANAGER; then
# This is read by xsession to select the window manager