Diff
Modified: trunk/Tools/ChangeLog (114787 => 114788)
--- trunk/Tools/ChangeLog 2012-04-20 22:18:04 UTC (rev 114787)
+++ trunk/Tools/ChangeLog 2012-04-20 22:32:04 UTC (rev 114788)
@@ -1,3 +1,63 @@
+2012-04-20 Nandor Huszka <hnan...@inf.u-szeged.hu>
+
+ NRWT: option --skip-pixel-test-if-no-baseline support on DRT
+ https://bugs.webkit.org/show_bug.cgi?id=72841
+
+ Reviewed by Dirk Pranke
+
+ This patch implements support for --skip-pixel-test-if-no-baseline generically in NRWT,
+ instead of in every DRT and WTR implementation. We add 'should_run_pixel_test'
+ and 'reference_files' fields to the TestInput objects, and use those flags
+ to select the right driver to use in the DriverProxy.
+
+ * Scripts/webkitpy/layout_tests/controllers/single_test_runner.py:
+ (SingleTestRunner.__init__):
+ (SingleTestRunner._driver_input):
+ (SingleTestRunner._run_reftest):
+ * Scripts/webkitpy/layout_tests/controllers/worker.py:
+ (Worker.handle_test_list):
+ (Worker._update_test_input):
+ * Scripts/webkitpy/layout_tests/models/test_input.py:
+ (TestInput):
+ (TestInput.__init__):
+ (TestInput.__repr__):
+ * Scripts/webkitpy/layout_tests/port/chromium.py:
+ (ChromiumDriver._wrapper_options):
+ (ChromiumDriver.run_test):
+ * Scripts/webkitpy/layout_tests/port/chromium_unittest.py:
+ (ChromiumDriverTest.test_crash_log):
+ * Scripts/webkitpy/layout_tests/port/driver.py:
+ (DriverInput.__init__):
+ (Driver.__init__):
+ (DriverProxy.__init__):
+ (DriverProxy.run_test):
+ (DriverProxy.start):
+ (DriverProxy.cmd_line):
+ * Scripts/webkitpy/layout_tests/port/gtk.py:
+ (GtkDriver._start):
+ * Scripts/webkitpy/layout_tests/port/mock_drt.py:
+ (MockDRT.run):
+ (MockDRT.input_from_line):
+ (MockDRT.output_for_test):
+ (MockDRT.write_test_output):
+ (MockChromiumDRT.input_from_line):
+ (MockChromiumDRT.output_for_test):
+ (MockChromiumDRT.write_test_output):
+ * Scripts/webkitpy/layout_tests/port/webkit.py:
+ (WebKitDriver.cmd_line):
+ (WebKitDriver.run_test):
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::TestController):
+ (WTR::TestController::initialize):
+ (WTR::TestController::runTest):
+ * WebKitTestRunner/TestController.h:
+ (TestController):
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::TestInvocation):
+ (WTR::TestInvocation::setIsPixelTest):
+ * WebKitTestRunner/TestInvocation.h:
+ (TestInvocation):
+
2012-04-20 Thiago Marcos P. Santos <thiago.san...@intel.com>
[EFL] Make it possible to define offline storage quota per origin
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py (114787 => 114788)
--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py 2012-04-20 22:18:04 UTC (rev 114787)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/single_test_runner.py 2012-04-20 22:32:04 UTC (rev 114788)
@@ -57,10 +57,8 @@
self._worker_name = worker_name
self._test_name = test_input.test_name
self._should_run_pixel_test = test_input.should_run_pixel_test
+ self._reference_files = test_input.reference_files
- self._is_reftest = False
- self._reference_files = port.reference_files(self._test_name)
-
if self._reference_files:
# Detect and report a test which has a wrong combination of expectation files.
# For example, if 'foo.html' has two expectation files, 'foo-expected.html' and
@@ -92,7 +90,7 @@
image_hash = None
if self._should_fetch_expected_checksum():
image_hash = self._port.expected_checksum(self._test_name)
- return DriverInput(self._test_name, self._timeout, image_hash, bool(self._reference_files))
+ return DriverInput(self._test_name, self._timeout, image_hash, self._should_run_pixel_test)
def run(self):
if self._reference_files:
@@ -290,7 +288,7 @@
putAllMismatchBeforeMatch = sorted
for expectation, reference_filename in putAllMismatchBeforeMatch(self._reference_files):
reference_test_name = self._port.relative_test_filename(reference_filename)
- reference_output = self._driver.run_test(DriverInput(reference_test_name, self._timeout, test_output.image_hash, is_reftest=True))
+ reference_output = self._driver.run_test(DriverInput(reference_test_name, self._timeout, test_output.image_hash, should_run_pixel_test=True))
test_result = self._compare_output_with_reference(test_output, reference_output, reference_filename, expectation == '!=')
if (expectation == '!=' and test_result.failures) or (expectation == '==' and not test_result.failures):
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/worker.py (114787 => 114788)
--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/worker.py 2012-04-20 22:18:04 UTC (rev 114787)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/worker.py 2012-04-20 22:32:04 UTC (rev 114788)
@@ -140,9 +140,7 @@
start_time = time.time()
num_tests = 0
for test_input in test_list:
- #FIXME: When the DRT support also this function, that would be useful
- if self._port.driver_name() == "WebKitTestRunner" and self._port.get_option('skip_pixel_test_if_no_baseline') and self._port.get_option('pixel_tests'):
- test_input.should_run_pixel_test = (self._port.expected_image(test_input.test_name) != None)
+ self._update_test_input(test_input)
self._run_test(test_input)
num_tests += 1
self._worker_connection.yield_to_broker()
@@ -153,6 +151,18 @@
def handle_stop(self, src):
self.stop_handling_messages()
+ def _update_test_input(self, test_input):
+ test_input.reference_files = self._port.reference_files(test_input.test_name)
+ if test_input.reference_files:
+ test_input.should_run_pixel_test = True
+ elif self._options.pixel_tests:
+ if self._options.skip_pixel_test_if_no_baseline:
+ test_input.should_run_pixel_test = bool(self._port.expected_image(test_input.test_name))
+ else:
+ test_input.should_run_pixel_test = True
+ else:
+ test_input.should_run_pixel_test = False
+
def _run_test(self, test_input):
test_timeout_sec = self.timeout(test_input)
start = time.time()
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_input.py (114787 => 114788)
--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_input.py 2012-04-20 22:18:04 UTC (rev 114787)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_input.py 2012-04-20 22:32:04 UTC (rev 114788)
@@ -29,24 +29,24 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-class TestInput:
+class TestInput(object):
"""Groups information about a test for easy passing of data."""
- # To save footprints since most TestInput instances don't have to have these fields.
- ref_file = None
- is_mismatch_reftest = None
-
- def __init__(self, test_name, timeout, should_run_pixel_test=True):
+ def __init__(self, test_name, timeout):
"""Holds the input parameters for a test.
Args:
test: name of test (not an absolute path!)
timeout: Timeout in msecs the driver should use while running the test
- ref_file: name of reference_filename (not an absolute path!)
- is_mismatch_test: true when the test is a mismatch reftest.
"""
self.test_name = test_name
self.timeout = timeout
- self.should_run_pixel_test = should_run_pixel_test
+ # TestInput objects are normally constructed by the manager and passed
+ # to the workers, but these two fields are set lazily in the workers
+ # because they require us to figure out if the test is a reftest or not
+ # and we want to be able to do that in parallel.
+ self.should_run_pixel_tests = None
+ self.reference_files = None
+
def __repr__(self):
- return "TestInput('%s', %d)" % (self.test_name, self.timeout)
+ return "TestInput('%s', %d, %s, %s)" % (self.test_name, self.timeout, self.should_run_pixel_tests, self.reference_files)
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py (114787 => 114788)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py 2012-04-20 22:18:04 UTC (rev 114787)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py 2012-04-20 22:32:04 UTC (rev 114788)
@@ -402,7 +402,7 @@
def _wrapper_options(self, pixel_tests):
cmd = []
- if pixel_tests or self._pixel_tests:
+ if pixel_tests:
if not self._image_path:
self._image_path = self._port._filesystem.join(self._port.results_directory(), 'png_result%s.png' % self._worker_number)
# See note above in diff_image() for why we need _convert_path().
@@ -514,7 +514,7 @@
def run_test(self, driver_input):
if not self._proc:
- self._start(driver_input.is_reftest or self._pixel_tests, driver_input.args)
+ self._start(driver_input.should_run_pixel_test, driver_input.args)
output = []
error = []
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py (114787 => 114788)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py 2012-04-20 22:18:04 UTC (rev 114787)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py 2012-04-20 22:32:04 UTC (rev 114788)
@@ -104,7 +104,7 @@
self.driver.test_to_uri = lambda test: 'mocktesturi'
self.driver._port.driver_name = lambda: 'mockdriver'
self.driver._port._get_crash_log = lambda name, pid, out, err, newer_than: 'mockcrashlog'
- driver_output = self.driver.run_test(DriverInput(test_name='some/test.html', timeout=1, image_hash=None, is_reftest=False))
+ driver_output = self.driver.run_test(DriverInput(test_name='some/test.html', timeout=1, image_hash=None, should_run_pixel_test=False))
self.assertTrue(driver_output.crash)
self.assertEqual(driver_output.crashed_process_name, 'mockdriver')
self.assertEqual(driver_output.crashed_pid, 1234)
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/driver.py (114787 => 114788)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/driver.py 2012-04-20 22:18:04 UTC (rev 114787)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/driver.py 2012-04-20 22:32:04 UTC (rev 114788)
@@ -34,11 +34,11 @@
class DriverInput(object):
- def __init__(self, test_name, timeout, image_hash, is_reftest, args=None):
+ def __init__(self, test_name, timeout, image_hash, should_run_pixel_test, args=None):
self.test_name = test_name
self.timeout = timeout # in ms
self.image_hash = image_hash
- self.is_reftest = is_reftest
+ self.should_run_pixel_test = should_run_pixel_test
self.args = args or []
@@ -104,7 +104,6 @@
"""
self._port = port
self._worker_number = worker_number
- self._pixel_tests = pixel_tests
self._no_timeout = no_timeout
def run_test(self, driver_input):
@@ -181,7 +180,6 @@
self._worker_number = worker_number
self._driver_instance_constructor = driver_instance_constructor
self._no_timeout = no_timeout
- self._pixel_tests = pixel_tests
# FIXME: We shouldn't need to create a driver until we actually run a test.
self._driver = self._make_driver(pixel_tests)
@@ -211,7 +209,7 @@
virtual_driver_input.args = self._port.lookup_virtual_test_args(driver_input.test_name)
return self.run_test(virtual_driver_input)
- pixel_tests_needed = self._pixel_tests or driver_input.is_reftest
+ pixel_tests_needed = driver_input.should_run_pixel_test
cmd_line_key = self._cmd_line_as_key(pixel_tests_needed, driver_input.args)
if not cmd_line_key in self._running_drivers:
self._running_drivers[cmd_line_key] = self._make_driver(pixel_tests_needed)
@@ -226,7 +224,7 @@
# The only reason we have this routine at all is so the perftestrunner
# can pause before running a test; it might be better to push that
# into run_test() directly.
- self._driver.start(self._pixel_tests, [])
+ self._driver.start(self._port.get_option('pixel_tests'), [])
def has_crashed(self):
return any(driver.has_crashed() for driver in self._running_drivers.values())
@@ -237,7 +235,7 @@
# FIXME: this should be a @classmethod (or implemented on Port instead).
def cmd_line(self, pixel_tests=None, per_test_args=None):
- return self._driver.cmd_line(pixel_tests or self._pixel_tests, per_test_args or [])
+ return self._driver.cmd_line(pixel_tests, per_test_args or [])
def _cmd_line_as_key(self, pixel_tests, per_test_args):
return ' '.join(self.cmd_line(pixel_tests, per_test_args))
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk.py (114787 => 114788)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk.py 2012-04-20 22:18:04 UTC (rev 114787)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk.py 2012-04-20 22:32:04 UTC (rev 114788)
@@ -53,7 +53,7 @@
# DriverProxy creates two drivers, one for normal and the other for ref tests. Both have
# the same worker number, so this prevents them from using the same Xvfb instance.
display_id = self._worker_number * 2 + running_displays
- if self._pixel_tests:
+ if self._port.get_option('pixel_tests'):
display_id += 1
run_xvfb = ["Xvfb", ":%d" % (display_id), "-screen", "0", "800x600x24", "-nolisten", "tcp"]
with open(os.devnull, 'w') as devnull:
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py (114787 => 114788)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py 2012-04-20 22:18:04 UTC (rev 114787)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py 2012-04-20 22:32:04 UTC (rev 114788)
@@ -184,7 +184,12 @@
line = self._stdin.readline()
if not line:
return 0
- self.run_one_test(self.input_from_line(line))
+ driver_input = self.input_from_line(line)
+ dirname, basename = self._port.split_test(driver_input.test_name)
+ is_reftest = (self._port.reference_files(driver_input.test_name) or
+ self._port.is_reference_html_file(self._port._filesystem, dirname, basename))
+ output = self.output_for_test(driver_input, is_reftest)
+ self.write_test_output(driver_input, output, is_reftest)
def input_from_line(self, line):
vals = line.strip().split("'")
@@ -199,18 +204,15 @@
else:
test_name = self._port.relative_test_filename(uri)
- dirname, basename = self._port.split_test(test_name)
- is_reftest = (self._port.reference_files(test_name) or
- self._port.is_reference_html_file(self._port._filesystem, dirname, basename))
- return DriverInput(test_name, 0, checksum, is_reftest)
+ return DriverInput(test_name, 0, checksum, self._options.pixel_tests)
- def output_for_test(self, test_input):
+ def output_for_test(self, test_input, is_reftest):
port = self._port
actual_text = port.expected_text(test_input.test_name)
actual_audio = port.expected_audio(test_input.test_name)
actual_image = None
actual_checksum = None
- if test_input.is_reftest:
+ if is_reftest:
# Make up some output for reftests.
actual_text = 'reference text\n'
actual_checksum = 'mock-checksum'
@@ -225,9 +227,7 @@
return DriverOutput(actual_text, actual_image, actual_checksum, actual_audio)
- def run_one_test(self, test_input):
- output = self.output_for_test(test_input)
-
+ def write_test_output(self, test_input, output, is_reftest):
if output.audio:
self._stdout.write('Content-Type: audio/wav\n')
self._stdout.write('Content-Transfer-Encoding: base64\n')
@@ -241,7 +241,7 @@
self._stdout.write('#EOF\n')
- if self._options.pixel_tests and (test_input.image_hash or test_input.is_reftest):
+ if self._options.pixel_tests and output.image_hash:
self._stdout.write('\n')
self._stdout.write('ActualHash: %s\n' % output.image_hash)
self._stdout.write('ExpectedHash: %s\n' % test_input.image_hash)
@@ -265,26 +265,20 @@
checksum = None
test_name = self._driver.uri_to_test(uri)
- dirname, basename = self._port.split_test(test_name)
- is_reftest = (self._port.reference_files(test_name) or
- self._port.is_reference_html_file(self._port._filesystem, dirname, basename))
+ return DriverInput(test_name, timeout, checksum, self._options.pixel_tests)
- return DriverInput(test_name, timeout, checksum, is_reftest)
-
- def output_for_test(self, test_input):
+ def output_for_test(self, test_input, is_reftest):
# FIXME: This is a hack to make virtual tests work. Need something more general.
original_test_name = test_input.test_name
if '--enable-accelerated-2d-canvas' in self._args and 'canvas' in test_input.test_name:
test_input.test_name = 'platform/chromium/virtual/gpu/' + test_input.test_name
- output = super(MockChromiumDRT, self).output_for_test(test_input)
+ output = super(MockChromiumDRT, self).output_for_test(test_input, is_reftest)
test_input.test_name = original_test_name
return output
- def run_one_test(self, test_input):
- output = self.output_for_test(test_input)
-
+ def write_test_output(self, test_input, output, is_reftest):
self._stdout.write("#URL:%s\n" % self._driver.test_to_uri(test_input.test_name))
- if self._options.pixel_tests and (test_input.image_hash or test_input.is_reftest):
+ if self._options.pixel_tests and output.image_hash:
self._stdout.write("#MD5:%s\n" % output.image_hash)
if output.image:
self._host.filesystem.maybe_make_directory(self._host.filesystem.dirname(self._options.pixel_path))
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py (114787 => 114788)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py 2012-04-20 22:18:04 UTC (rev 114787)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py 2012-04-20 22:32:04 UTC (rev 114788)
@@ -452,8 +452,6 @@
def cmd_line(self, pixel_tests, per_test_args):
cmd = self._command_wrapper(self._port.get_option('wrapper'))
cmd.append(self._port._path_to_driver())
- if self._port.get_option('skip_pixel_test_if_no_baseline'):
- cmd.append('--skip-pixel-test-if-no-baseline')
if self._port.get_option('gc_between_tests'):
cmd.append('--gc-between-tests')
if self._port.get_option('complex_text'):
@@ -466,7 +464,7 @@
cmd.extend(self._port.get_option('additional_drt_flag', []))
- if pixel_tests or self._pixel_tests:
+ if pixel_tests:
cmd.append('--pixel-tests')
cmd.extend(per_test_args)
@@ -545,7 +543,7 @@
def run_test(self, driver_input):
start_time = time.time()
if not self._server_process:
- self._start(driver_input.is_reftest or self._pixel_tests, [])
+ self._start(driver_input.should_run_pixel_test, [])
self.error_from_test = str()
self.err_seen_eof = False
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (114787 => 114788)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2012-04-20 22:18:04 UTC (rev 114787)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2012-04-20 22:32:04 UTC (rev 114788)
@@ -68,7 +68,6 @@
TestController::TestController(int argc, const char* argv[])
: m_dumpPixels(false)
- , m_skipPixelTestOption(false)
, m_verbose(false)
, m_printSeparators(false)
, m_usingServerMode(false)
@@ -260,11 +259,6 @@
continue;
}
- if (argument == "--skip-pixel-test-if-no-baseline") {
- m_skipPixelTestOption = true;
- continue;
- }
-
if (argument == "--pixel-tests") {
m_dumpPixels = true;
continue;
@@ -519,7 +513,6 @@
m_state = RunningTest;
m_currentInvocation = adoptPtr(new TestInvocation(pathOrURL));
- m_currentInvocation->setSkipPixelTestOption(m_skipPixelTestOption);
if (m_dumpPixels)
m_currentInvocation->setIsPixelTest(expectedPixelHash);
Modified: trunk/Tools/WebKitTestRunner/TestController.h (114787 => 114788)
--- trunk/Tools/WebKitTestRunner/TestController.h 2012-04-20 22:18:04 UTC (rev 114787)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2012-04-20 22:32:04 UTC (rev 114788)
@@ -105,7 +105,6 @@
OwnPtr<TestInvocation> m_currentInvocation;
bool m_dumpPixels;
- bool m_skipPixelTestOption;
bool m_verbose;
bool m_printSeparators;
bool m_usingServerMode;
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (114787 => 114788)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2012-04-20 22:18:04 UTC (rev 114787)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2012-04-20 22:32:04 UTC (rev 114788)
@@ -96,7 +96,6 @@
: m_url(AdoptWK, createWKURL(pathOrURL.c_str()))
, m_pathOrURL(pathOrURL)
, m_dumpPixels(false)
- , m_skipPixelTestOption(false)
, m_gotInitialResponse(false)
, m_gotFinalMessage(false)
, m_gotRepaint(false)
@@ -110,8 +109,6 @@
void TestInvocation::setIsPixelTest(const std::string& expectedPixelHash)
{
- if (m_skipPixelTestOption && !expectedPixelHash.length())
- return;
m_dumpPixels = true;
m_expectedPixelHash = expectedPixelHash;
}
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.h (114787 => 114788)
--- trunk/Tools/WebKitTestRunner/TestInvocation.h 2012-04-20 22:18:04 UTC (rev 114787)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.h 2012-04-20 22:32:04 UTC (rev 114788)
@@ -39,7 +39,6 @@
~TestInvocation();
void setIsPixelTest(const std::string& expectedPixelHash);
- void setSkipPixelTestOption(bool option) { m_skipPixelTestOption = option; }
void invoke();
void didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
@@ -55,7 +54,6 @@
bool m_dumpPixels;
std::string m_expectedPixelHash;
- bool m_skipPixelTestOption;
// Invocation state
bool m_gotInitialResponse;