Diff
Modified: trunk/Tools/ChangeLog (109241 => 109242)
--- trunk/Tools/ChangeLog 2012-02-29 20:02:13 UTC (rev 109241)
+++ trunk/Tools/ChangeLog 2012-02-29 20:04:07 UTC (rev 109242)
@@ -16,6 +16,57 @@
2012-02-29 Dirk Pranke <dpra...@chromium.org>
+ nrwt: port/Driver needs to support per-test command line args
+ https://bugs.webkit.org/show_bug.cgi?id=79733
+
+ Reviewed by Adam Barth.
+
+ As part of removing the 'gpu' configurations and adding support
+ for 'virtual test suites', the Driver classes need to support
+ per-test command lines (since different tests will need to be
+ run with different command line options).
+
+ The per-test args are not yet used, so this change should have
+ no visible effects and need no additional testing.
+
+ * Scripts/webkitpy/layout_tests/port/base.py:
+ (Port.driver_cmd_line):
+ * Scripts/webkitpy/layout_tests/port/chromium.py:
+ (ChromiumDriver.cmd_line):
+ (ChromiumDriver._start):
+ (ChromiumDriver.start):
+ * Scripts/webkitpy/layout_tests/port/chromium_unittest.py:
+ (ChromiumDriverTest.test_two_drivers.MockDriver.cmd_line):
+ (ChromiumDriverTest):
+ (ChromiumDriverTest.test_two_drivers):
+ * Scripts/webkitpy/layout_tests/port/driver.py:
+ (Driver.cmd_line):
+ (DriverProxy.__init__):
+ (DriverProxy.start):
+ (DriverProxy.cmd_line):
+ * Scripts/webkitpy/layout_tests/port/driver_unittest.py:
+ (DriverTest.test_virtual_driver_methods):
+ * Scripts/webkitpy/layout_tests/port/gtk.py:
+ (GtkDriver.cmd_line):
+ * Scripts/webkitpy/layout_tests/port/mock_drt.py:
+ * Scripts/webkitpy/layout_tests/port/test.py:
+ (TestPort._path_to_driver):
+ (TestDriver.cmd_line):
+ (TestDriver.start):
+ * Scripts/webkitpy/layout_tests/port/webkit.py:
+ (WebKitDriver.cmd_line):
+ (WebKitDriver._start):
+ (WebKitDriver.run_test):
+ (WebKitDriver.start):
+ * Scripts/webkitpy/layout_tests/port/webkit_unittest.py:
+ (WebKitDriverTest.test_no_timeout):
+ * Scripts/webkitpy/performance_tests/perftestsrunner.py:
+ (PerfTestsRunner._run_tests_set):
+ * Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py:
+ (test_run_test_pause_before_testing):
+
+2012-02-29 Dirk Pranke <dpra...@chromium.org>
+
perftestsrunner can call printer.write() after printer.cleanup()
https://bugs.webkit.org/show_bug.cgi?id=79872
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py (109241 => 109242)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py 2012-02-29 20:02:13 UTC (rev 109241)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/base.py 2012-02-29 20:04:07 UTC (rev 109242)
@@ -533,7 +533,7 @@
def driver_cmd_line(self):
"""Prints the DRT command line that will be used."""
driver = self.create_driver(0)
- return driver.cmd_line()
+ return driver.cmd_line(self.get_option('pixel_tests'), [])
def update_baseline(self, baseline_path, data):
"""Updates the baseline for a test.
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py (109241 => 109242)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py 2012-02-29 20:02:13 UTC (rev 109241)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py 2012-02-29 20:04:07 UTC (rev 109242)
@@ -398,9 +398,9 @@
if self._pixel_tests:
self._image_path = self._port._filesystem.join(self._port.results_directory(), 'png_result%s.png' % self._worker_number)
- def _wrapper_options(self):
+ def _wrapper_options(self, pixel_tests):
cmd = []
- if self._pixel_tests:
+ if pixel_tests or self._pixel_tests:
# See note above in diff_image() for why we need _convert_path().
cmd.append("--pixel-tests=" + self._port._convert_path(self._image_path))
# FIXME: This is not None shouldn't be necessary, unless --js-flags="''" changes behavior somehow?
@@ -433,21 +433,23 @@
cmd.extend(self._port.get_option('additional_drt_flag', []))
return cmd
- def cmd_line(self):
+ 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())
# FIXME: Why does --test-shell exist? TestShell is dead, shouldn't this be removed?
# It seems it's still in use in Tools/DumpRenderTree/chromium/DumpRenderTree.cpp as of 8/10/11.
cmd.append('--test-shell')
- cmd.extend(self._wrapper_options())
+ cmd.extend(self._wrapper_options(pixel_tests))
+ cmd.extend(per_test_args)
+
return cmd
- def _start(self):
+ def _start(self, pixel_tests, per_test_args):
assert not self._proc
# FIXME: This should use ServerProcess like WebKitDriver does.
# FIXME: We should be reading stderr and stdout separately like how WebKitDriver does.
close_fds = sys.platform != 'win32'
- self._proc = subprocess.Popen(self.cmd_line(), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=close_fds)
+ self._proc = subprocess.Popen(self.cmd_line(pixel_tests, per_test_args), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=close_fds)
def has_crashed(self):
if self._proc is None:
@@ -508,7 +510,7 @@
def run_test(self, driver_input):
if not self._proc:
- self._start()
+ self._start(driver_input.is_reftest or self._pixel_tests, [])
output = []
error = []
@@ -594,9 +596,9 @@
return DriverOutput(text, output_image, actual_checksum, audio=audio_bytes,
crash=crash, crashed_process_name=crashed_process_name, test_time=run_time, timeout=timeout, error=error)
- def start(self):
+ def start(self, pixel_tests, per_test_args):
if not self._proc:
- self._start()
+ self._start(pixel_tests, per_test_args)
def stop(self):
if not self._proc:
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py (109241 => 109242)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py 2012-02-29 20:02:13 UTC (rev 109241)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_unittest.py 2012-02-29 20:04:07 UTC (rev 109242)
@@ -138,15 +138,15 @@
def __init__(self):
chromium.ChromiumDriver.__init__(self, mock_port, worker_number=0, pixel_tests=False)
- def cmd_line(self):
+ def cmd_line(self, pixel_test, per_test_args):
return 'python'
# get_option is used to get the timeout (ms) for a process before we kill it.
mock_port.get_option = lambda name: 60 * 1000
driver1 = MockDriver()
- driver1._start()
+ driver1._start(False, [])
driver2 = MockDriver()
- driver2._start()
+ driver2._start(False, [])
# It's possible for driver1 to timeout when stopping if it's sharing stdin with driver2.
start_time = time.time()
driver1.stop()
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/driver.py (109241 => 109242)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/driver.py 2012-02-29 20:02:13 UTC (rev 109241)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/driver.py 2012-02-29 20:04:07 UTC (rev 109242)
@@ -162,7 +162,7 @@
def stop(self):
raise NotImplementedError('Driver.stop')
- def cmd_line(self):
+ def cmd_line(self, pixel_tests, per_test_args):
raise NotImplementedError('Driver.cmd_line')
@@ -172,6 +172,7 @@
single driver."""
def __init__(self, port, worker_number, driver_instance_constructor, pixel_tests, no_timeout):
+ self._pixel_tests = pixel_tests
self._driver = driver_instance_constructor(port, worker_number, pixel_tests, no_timeout)
if pixel_tests:
self._reftest_driver = self._driver
@@ -196,14 +197,21 @@
return self._driver.has_crashed() or self._reftest_driver.has_crashed()
def start(self):
- self._driver.start()
+ # FIXME: Callers shouldn't normally call this, since this routine
+ # may not be specifying the correct combination of pixel test and
+ # per_test args.
+ #
+ # 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, [])
def stop(self):
self._driver.stop()
self._reftest_driver.stop()
- def cmd_line(self):
- cmd_line = self._driver.cmd_line()
+ def cmd_line(self, pixel_tests, per_test_args):
+ cmd_line = self._driver.cmd_line(pixel_tests, per_test_args)
if self._driver != self._reftest_driver:
- cmd_line += ['; '] + self._reftest_driver.cmd_line()
+ cmd_line += ['; '] + self._reftest_driver.cmd_line(pixel_tests, per_test_args)
return cmd_line
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/driver_unittest.py (109241 => 109242)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/driver_unittest.py 2012-02-29 20:02:13 UTC (rev 109241)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/driver_unittest.py 2012-02-29 20:04:07 UTC (rev 109242)
@@ -91,7 +91,7 @@
driver = Driver(self.make_port(), None, pixel_tests=False)
self.assertVirtual(driver.run_test, None)
self.assertVirtual(driver.stop)
- self.assertVirtual(driver.cmd_line)
+ self.assertVirtual(driver.cmd_line, False, [])
def test_command_wrapper(self):
self._assert_wrapper(None, [])
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk.py (109241 => 109242)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk.py 2012-02-29 20:02:13 UTC (rev 109241)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/gtk.py 2012-02-29 20:04:07 UTC (rev 109242)
@@ -64,9 +64,9 @@
self._xvfb_process.wait()
self._xvfb_process = None
- def cmd_line(self):
+ def cmd_line(self, pixel_tests, per_test_args):
wrapper_path = self._port.path_from_webkit_base("Tools", "gtk", "run-with-jhbuild")
- return [wrapper_path] + WebKitDriver.cmd_line(self)
+ return [wrapper_path] + WebKitDriver.cmd_line(self, pixel_tests, per_test_args)
class GtkPort(WebKitPort):
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py (109241 => 109242)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py 2012-02-29 20:02:13 UTC (rev 109241)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py 2012-02-29 20:04:07 UTC (rev 109242)
@@ -93,8 +93,8 @@
@staticmethod
def _overriding_cmd_line(original_cmd_line, driver_path, python_exe, this_file, port_name):
- def new_cmd_line():
- cmd_line = original_cmd_line()
+ def new_cmd_line(pixel_tests, per_test_args):
+ cmd_line = original_cmd_line(pixel_tests, per_test_args)
index = cmd_line.index(driver_path)
cmd_line[index:index + 1] = [python_exe, this_file, '--platform', port_name]
return cmd_line
@@ -275,6 +275,7 @@
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):
self._stdout.write("#MD5:%s\n" % output.image_hash)
+ self._host.filesystem.maybe_make_directory(self._host.filesystem.dirname(self._options.pixel_path))
self._host.filesystem.write_binary_file(self._options.pixel_path,
output.image)
self._stdout.write(output.text)
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py (109241 => 109242)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py 2012-02-29 20:02:13 UTC (rev 109241)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py 2012-02-29 20:04:07 UTC (rev 109242)
@@ -352,7 +352,7 @@
def _path_to_driver(self):
# This routine shouldn't normally be called, but it is called by
# the mock_drt Driver. We return something, but make sure it's useless.
- return 'junk'
+ return 'MOCK _path_to_driver'
def baseline_search_path(self):
search_paths = {
@@ -493,8 +493,9 @@
class TestDriver(Driver):
"""Test/Dummy implementation of the DumpRenderTree interface."""
- def cmd_line(self):
- return [self._port._path_to_driver()] + self._port.get_option('additional_drt_flag', [])
+ def cmd_line(self, pixel_tests, per_test_args):
+ pixel_tests_flag = '-p' if pixel_tests else ''
+ return [self._port._path_to_driver()] + [pixel_tests_flag] + self._port.get_option('additional_drt_flag', []) + per_test_args
def run_test(self, test_input):
start_time = time.time()
@@ -520,7 +521,7 @@
crashed_process_name=crashed_process_name,
test_time=time.time() - start_time, timeout=test.timeout, error=test.error)
- def start(self):
+ def start(self, pixel_tests, per_test_args):
pass
def stop(self):
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py (109241 => 109242)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py 2012-02-29 20:02:13 UTC (rev 109241)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py 2012-02-29 20:04:07 UTC (rev 109242)
@@ -464,13 +464,11 @@
def __del__(self):
self._port._filesystem.rmtree(str(self._driver_tempdir))
- def cmd_line(self):
+ 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._pixel_tests:
- cmd.append('--pixel-tests')
if self._port.get_option('gc_between_tests'):
cmd.append('--gc-between-tests')
if self._port.get_option('complex_text'):
@@ -482,10 +480,15 @@
# FIXME: We need to pass --timeout=SECONDS to WebKitTestRunner for WebKit2.
cmd.extend(self._port.get_option('additional_drt_flag', []))
+
+ if pixel_tests or self._pixel_tests:
+ cmd.append('--pixel-tests')
+ cmd.extend(per_test_args)
+
cmd.append('-')
return cmd
- def _start(self):
+ def _start(self, pixel_tests, per_test_args):
server_name = self._port.driver_name()
environment = self._port.setup_environ_for_server(server_name)
environment['DYLD_FRAMEWORK_PATH'] = self._port._build_path()
@@ -493,7 +496,7 @@
environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir)
environment['LOCAL_RESOURCE_ROOT'] = self._port.layout_tests_dir()
self._crashed_subprocess_name = None
- self._server_process = server_process.ServerProcess(self._port, server_name, self.cmd_line(), environment)
+ self._server_process = server_process.ServerProcess(self._port, server_name, self.cmd_line(pixel_tests, per_test_args), environment)
def has_crashed(self):
if self._server_process is None:
@@ -553,7 +556,7 @@
def run_test(self, driver_input):
if not self._server_process:
- self._start()
+ self._start(driver_input.is_reftest or self._pixel_tests, [])
self.error_from_test = str()
self.err_seen_eof = False
@@ -645,9 +648,9 @@
block.decode_content()
return block
- def start(self):
+ def start(self, pixel_tests, per_test_args):
if not self._server_process:
- self._start()
+ self._start(pixel_tests, per_test_args)
def stop(self):
if self._server_process:
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py (109241 => 109242)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py 2012-02-29 20:02:13 UTC (rev 109241)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py 2012-02-29 20:04:07 UTC (rev 109242)
@@ -300,4 +300,4 @@
def test_no_timeout(self):
port = TestWebKitPort()
driver = WebKitDriver(port, 0, pixel_tests=True, no_timeout=True)
- self.assertEquals(driver.cmd_line(), ['MOCK output of child process/DumpRenderTree', '--pixel-tests', '--no-timeout', '-'])
+ self.assertEquals(driver.cmd_line(True, []), ['MOCK output of child process/DumpRenderTree', '--no-timeout', '--pixel-tests', '-'])
Modified: trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py (109241 => 109242)
--- trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py 2012-02-29 20:02:13 UTC (rev 109241)
+++ trunk/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_unittest.py 2012-02-29 20:04:07 UTC (rev 109242)
@@ -174,7 +174,7 @@
unexpected_result_count = runner._run_tests_set(tests, runner._port)
self.assertEqual(TestDriverWithStopCount.stop_count, 6)
- def test_run_test_set_kills_drt_per_run(self):
+ def test_run_test_pause_before_testing(self):
class TestDriverWithStartCount(MainTest.TestDriver):
start_count = 0