Commit 876dadc4 authored by hayato@chromium.org's avatar hayato@chromium.org

2010-11-22 Hayato Ito <hayato@chromium.org>

        Reviewed by Tony Chang.

        [NRWT] Retry a few times in reading a png image to avoid a race condition.

        https://bugs.webkit.org/show_bug.cgi?id=49924

        * Scripts/webkitpy/layout_tests/port/chromium.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72547 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 590b37e7
2010-11-22 Hayato Ito <hayato@chromium.org>
Reviewed by Tony Chang.
[NRWT] Retry a few times in reading a png image to avoid a race condition.
https://bugs.webkit.org/show_bug.cgi?id=49924
* Scripts/webkitpy/layout_tests/port/chromium.py:
2010-11-22 João Paulo Rechi Vita <jprvita@profusion.mobi>
Reviewed by Kenneth Rohde Christiansen.
......
......@@ -32,6 +32,7 @@
from __future__ import with_statement
import codecs
import errno
import logging
import os
import re
......@@ -454,6 +455,21 @@ class ChromiumDriver(base.Driver):
else:
return None
def _output_image_with_retry(self):
# Retry a few more times because open() sometimes fails on Windows,
# raising "IOError: [Errno 13] Permission denied:"
retry_num = 50
timeout_seconds = 5.0
for i in range(retry_num):
try:
return self._output_image()
except IOError, e:
if e.errno == errno.EACCES:
time.sleep(timeout_seconds / retry_num)
else:
raise e
return self._output_image()
def run_test(self, uri, timeoutms, checksum):
output = []
error = []
......@@ -505,9 +521,10 @@ class ChromiumDriver(base.Driver):
(line, crash) = self._write_command_and_read_line(input=None)
run_time = time.time() - start_time
return test_output.TestOutput(
''.join(output), self._output_image(), actual_checksum,
crash, time.time() - start_time, timeout, ''.join(error))
''.join(output), self._output_image_with_retry(), actual_checksum,
crash, run_time, timeout, ''.join(error))
def stop(self):
if self._proc:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment