Diff
Modified: trunk/Tools/ChangeLog (160645 => 160646)
--- trunk/Tools/ChangeLog 2013-12-16 17:58:16 UTC (rev 160645)
+++ trunk/Tools/ChangeLog 2013-12-16 18:01:07 UTC (rev 160646)
@@ -1,3 +1,18 @@
+2013-12-16 Eva Balazsfalvi <[email protected]>
+
+ Remove mock_drt.py: parse_options() - --test-shell and --pixel-tests=<path>
+ https://bugs.webkit.org/show_bug.cgi?id=125780
+
+ Reviewed by Darin Adler.
+
+ * Scripts/webkitpy/port/mock_drt.py:
+ (main):
+ (parse_options):
+ (MockDRT.write_test_output):
+ * Scripts/webkitpy/port/mock_drt_unittest.py:
+ (MockDRTTest.assertTest):
+ (MockDRTTest.test_reftest_mismatch):
+
2013-12-16 Gergo Balogh <[email protected]>
prepare-Changelog treats CSS keyframes as mismatched parentheses.
Modified: trunk/Tools/Scripts/webkitpy/port/mock_drt.py (160645 => 160646)
--- trunk/Tools/Scripts/webkitpy/port/mock_drt.py 2013-12-16 17:58:16 UTC (rev 160645)
+++ trunk/Tools/Scripts/webkitpy/port/mock_drt.py 2013-12-16 18:01:07 UTC (rev 160646)
@@ -132,10 +132,7 @@
"""Run the tests."""
options, args = parse_options(argv)
- if options.test_shell:
- drt = MockTestShell(options, args, host, stdin, stdout, stderr)
- else:
- drt = MockDRT(options, args, host, stdin, stdout, stderr)
+ drt = MockDRT(options, args, host, stdin, stdout, stderr)
return drt.run()
@@ -151,18 +148,8 @@
platform_index = argv.index('--platform')
platform = argv[platform_index + 1]
- pixel_tests = False
- pixel_path = None
- test_shell = '--test-shell' in argv
- if test_shell:
- for arg in argv:
- if arg.startswith('--pixel-tests'):
- pixel_tests = True
- pixel_path = arg[len('--pixel-tests='):]
- else:
- pixel_tests = '--pixel-tests' in argv
- options = optparse.Values({'test_shell': test_shell, 'platform': platform, 'pixel_tests': pixel_tests, 'pixel_path': pixel_path})
- return (options, argv)
+ pixel_tests = '--pixel-tests' in argv
+ return (optparse.Values({'platform': platform, 'pixel_tests': pixel_tests}), argv)
class MockDRT(object):
@@ -255,42 +242,6 @@
self._stderr.write('#EOF\n')
self._stderr.flush()
-
-class MockTestShell(MockDRT):
- def input_from_line(self, line):
- vals = line.strip().split()
- if len(vals) == 3:
- uri, timeout, checksum = vals
- else:
- uri, timeout = vals
- checksum = None
-
- test_name = self._driver.uri_to_test(uri)
- return DriverInput(test_name, timeout, checksum, self._options.pixel_tests)
-
- 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
- output = super(MockTestShell, self).output_for_test(test_input, is_reftest)
- test_input.test_name = original_test_name
- return output
-
- 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 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))
- self._host.filesystem.write_binary_file(self._options.pixel_path, output.image)
- if output.text:
- self._stdout.write(output.text)
-
- if output.text and not output.text.endswith('\n'):
- self._stdout.write('\n')
- self._stdout.write('#EOF\n')
- self._stdout.flush()
-
-
if __name__ == '__main__':
# Note that the Mock in MockDRT refers to the fact that it is emulating a
# real DRT, and as such, it needs access to a real SystemHost, not a MockSystemHost.
Modified: trunk/Tools/Scripts/webkitpy/port/mock_drt_unittest.py (160645 => 160646)
--- trunk/Tools/Scripts/webkitpy/port/mock_drt_unittest.py 2013-12-16 17:58:16 UTC (rev 160645)
+++ trunk/Tools/Scripts/webkitpy/port/mock_drt_unittest.py 2013-12-16 18:01:07 UTC (rev 160646)
@@ -159,7 +159,7 @@
# We use the StringIO.buflist here instead of getvalue() because
# the StringIO might be a mix of unicode/ascii and 8-bit strings.
self.assertEqual(stdout.buflist, drt_output)
- self.assertEqual(stderr.getvalue(), '' if options.test_shell else '#EOF\n')
+ self.assertEqual(stderr.getvalue(), '#EOF\n')
def test_main(self):
host = MockSystemHost()
@@ -208,60 +208,3 @@
def test_reftest_mismatch(self):
self.assertTest('passes/mismatch.html', False, expected_checksum='mock-checksum', expected_text='reference text\n')
self.assertTest('passes/mismatch.html', True, expected_checksum='mock-checksum', expected_text='reference text\n')
-
-
-class MockTestShellTest(MockDRTTest):
- def extra_args(self, pixel_tests):
- if pixel_tests:
- return ['--pixel-tests=/tmp/png_result0.png']
- return []
-
- def make_drt(self, options, args, host, stdin, stdout, stderr):
- options.test_shell = True
-
- # We have to set these by hand because --platform test won't trigger
- # the Chromium code paths.
- options.pixel_path = '/tmp/png_result0.png'
- options.pixel_tests = True
-
- return mock_drt.MockTestShell(options, args, host, stdin, stdout, stderr)
-
- def input_line(self, port, test_name, checksum=None):
- url = ""
- if checksum:
- return url + ' 6000 ' + checksum + '\n'
- return url + ' 6000\n'
-
- def expected_output(self, port, test_name, pixel_tests, text_output, expected_checksum):
- url = ""
- output = ['#URL:%s\n' % url]
- if expected_checksum:
- output.append('#MD5:%s\n' % expected_checksum)
- if text_output:
- output.append(text_output)
- if not text_output.endswith('\n'):
- output.append('\n')
- output.append('#EOF\n')
- return output
-
- def test_pixeltest__fails(self):
- host = MockSystemHost()
- url = ''
- url = "" + '%s/failures/expected/image_checksum.html' % PortFactory(host).get('test').layout_tests_dir()
- self.assertTest('failures/expected/image_checksum.html', pixel_tests=True,
- expected_checksum='image_checksum',
- drt_output=[url + '\n',
- '#MD5:image_checksum-checksum\n',
- 'image_checksum-txt',
- '\n',
- '#EOF\n'],
- host=host)
- self.assertEqual(host.filesystem.written_files,
- {'/tmp/png_result0.png': 'image_checksum\x8a-pngtEXtchecksum\x00image_checksum-checksum'})
-
- def test_test_shell_parse_options(self):
- options, args = mock_drt.parse_options(['--platform', 'chromium-mac', '--test-shell',
- '--pixel-tests=/tmp/png_result0.png'])
- self.assertTrue(options.test_shell)
- self.assertTrue(options.pixel_tests)
- self.assertEqual(options.pixel_path, '/tmp/png_result0.png')