Changeset 121812 in webkit


Ignore:
Timestamp:
Jul 3, 2012 4:53:26 PM (12 years ago)
Author:
dpranke@chromium.org
Message:

nrwt: fix mock port
https://bugs.webkit.org/show_bug.cgi?id=90500

Reviewed by Ojan Vafai.

The MockDRT code was never updated when we switched the chromium
ports to using "drt mode" by default. This change updates that
code, fixes a typo in the chromium port that went undetected
(default_test_timeout_ms -> default_timeout_ms), and adds tests
that actually exercise some of the mock ports. These tests are
useful in that they will exercise the port-specific code in an
end-to-end-manner, but they are a bit slow for some reason (>1s
each) that I need to look into.

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

(ChromiumDriver.stop):

  • Scripts/webkitpy/layout_tests/port/chromium_android.py:

(ChromiumAndroidPort.default_timeout_ms):

  • Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py:

(TestChromiumAndroidPort.test_default_timeout_ms):

  • Scripts/webkitpy/layout_tests/port/mock_drt.py:

(main):
(parse_options):
(MockTestShell):
(MockTestShell.output_for_test):

  • Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py:

(MockDRTTest.assertTest):
(MockTestShellTest):
(MockTestShellTest.make_drt):
(MockTestShellTest.test_test_shell_parse_options):

  • Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:

(PortTest):
(PortTest.assert_mock_port_works):
(PortTest.test_chromium_mac_lion):
(PortTest.test_chromium_mac_lion_in_test_shell_mode):
(PortTest.test_qt_linux):
(PortTest.test_mac_lion):

Location:
trunk/Tools
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r121809 r121812  
     12012-07-03  Dirk Pranke  <dpranke@chromium.org>
     2
     3        nrwt: fix mock port
     4        https://bugs.webkit.org/show_bug.cgi?id=90500
     5
     6        Reviewed by Ojan Vafai.
     7
     8        The MockDRT code was never updated when we switched the chromium
     9        ports to using "drt mode" by default. This change updates that
     10        code, fixes a typo in the chromium port that went undetected
     11        (default_test_timeout_ms -> default_timeout_ms), and adds tests
     12        that actually exercise some of the mock ports. These tests are
     13        useful in that they will exercise the port-specific code in an
     14        end-to-end-manner, but they are a bit slow for some reason (>1s
     15        each) that I need to look into.
     16
     17        * Scripts/webkitpy/layout_tests/port/chromium.py:
     18        (ChromiumDriver.stop):
     19        * Scripts/webkitpy/layout_tests/port/chromium_android.py:
     20        (ChromiumAndroidPort.default_timeout_ms):
     21        * Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py:
     22        (TestChromiumAndroidPort.test_default_timeout_ms):
     23        * Scripts/webkitpy/layout_tests/port/mock_drt.py:
     24        (main):
     25        (parse_options):
     26        (MockTestShell):
     27        (MockTestShell.output_for_test):
     28        * Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py:
     29        (MockDRTTest.assertTest):
     30        (MockTestShellTest):
     31        (MockTestShellTest.make_drt):
     32        (MockTestShellTest.test_test_shell_parse_options):
     33        * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
     34        (PortTest):
     35        (PortTest.assert_mock_port_works):
     36        (PortTest.test_chromium_mac_lion):
     37        (PortTest.test_chromium_mac_lion_in_test_shell_mode):
     38        (PortTest.test_qt_linux):
     39        (PortTest.test_mac_lion):
     40
    1412012-07-03  Dirk Pranke  <dpranke@chromium.org>
    242
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium.py

    r121784 r121812  
    694694        time_out_ms = self._port.get_option('time_out_ms')
    695695        if time_out_ms and not self._no_timeout:
    696             timeout_ratio = float(time_out_ms) / self._port.default_test_timeout_ms()
     696            timeout_ratio = float(time_out_ms) / self._port.default_timeout_ms()
    697697            kill_timeout_seconds = self.KILL_TIMEOUT_DEFAULT * timeout_ratio if timeout_ratio > 1.0 else self.KILL_TIMEOUT_DEFAULT
    698698        else:
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py

    r121614 r121812  
    179179        self._drt_retry_after_killed = 0
    180180
    181     def default_test_timeout_ms(self):
     181    def default_timeout_ms(self):
    182182        # Android platform has less computing power than desktop platforms.
    183183        # Using 10 seconds allows us to pass most slow tests which are not
     
    215215
    216216    # FIXME: Remove this function when chromium-android is fully upstream.
    217     def expectations_files(self):   
     217    def expectations_files(self):
    218218        android_expectations_file = self.path_from_webkit_base('LayoutTests', 'platform', 'chromium', 'test_expectations_android.txt')
    219219        return super(ChromiumAndroidPort, self).expectations_files() + [android_expectations_file]
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/chromium_android_unittest.py

    r121497 r121812  
    2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828
     29import optparse
    2930import StringIO
    3031import unittest
     
    4950        self.assertTrue(port.get_option('enable_hardware_gpu'))
    5051        self.assertEquals(port.baseline_path(), port._webkit_baseline_path('chromium-android'))
     52
     53    def test_default_timeout_ms(self):
     54        self.assertEquals(self.make_port(options=optparse.Values({'configuration': 'Release'})).default_timeout_ms(), 10000)
     55        self.assertEquals(self.make_port(options=optparse.Values({'configuration': 'Debug'})).default_timeout_ms(), 10000)
    5156
    5257    def test_expectations_files(self):
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py

    r121497 r121812  
    4040import base64
    4141import logging
     42import optparse
    4243import os
    4344import sys
     
    5253from webkitpy.layout_tests.port.driver import DriverInput, DriverOutput, DriverProxy
    5354from webkitpy.layout_tests.port.factory import PortFactory
    54 from webkitpy.tool.mocktool import MockOptions
    5555
    5656_log = logging.getLogger(__name__)
     
    131131
    132132    options, args = parse_options(argv)
    133     if options.chromium:
    134         drt = MockChromiumDRT(options, args, host, stdin, stdout, stderr)
     133    if options.test_shell:
     134        drt = MockTestShell(options, args, host, stdin, stdout, stderr)
    135135    else:
    136136        drt = MockDRT(options, args, host, stdin, stdout, stderr)
     
    152152    pixel_tests = False
    153153    pixel_path = None
    154     chromium = False
    155     if platform.startswith('chromium'):
    156         chromium = True
     154    test_shell = '--test-shell' in argv
     155    if test_shell:
    157156        for arg in argv:
    158157            if arg.startswith('--pixel-tests'):
     
    161160    else:
    162161        pixel_tests = '--pixel-tests' in argv
    163     options = MockOptions(chromium=chromium, platform=platform, pixel_tests=pixel_tests, pixel_path=pixel_path)
     162    options = optparse.Values({'test_shell': test_shell, 'platform': platform, 'pixel_tests': pixel_tests, 'pixel_path': pixel_path})
    164163    return (options, argv)
    165164
     
    256255
    257256
    258 class MockChromiumDRT(MockDRT):
     257class MockTestShell(MockDRT):
    259258    def input_from_line(self, line):
    260259        vals = line.strip().split()
     
    273272        if '--enable-accelerated-2d-canvas' in self._args and 'canvas' in test_input.test_name:
    274273            test_input.test_name = 'platform/chromium/virtual/gpu/' + test_input.test_name
    275         output = super(MockChromiumDRT, self).output_for_test(test_input, is_reftest)
     274        output = super(MockTestShell, self).output_for_test(test_input, is_reftest)
    276275        test_input.test_name = original_test_name
    277276        return output
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py

    r119520 r121812  
    151151        # the StringIO might be a mix of unicode/ascii and 8-bit strings.
    152152        self.assertEqual(stdout.buflist, drt_output)
    153         self.assertEqual(stderr.getvalue(), '' if options.chromium else '#EOF\n')
     153        self.assertEqual(stderr.getvalue(), '' if options.test_shell else '#EOF\n')
    154154
    155155    def test_main(self):
     
    202202
    203203
    204 
    205 class MockChromiumDRTTest(MockDRTTest):
     204class MockTestShellTest(MockDRTTest):
    206205    def extra_args(self, pixel_tests):
    207206        if pixel_tests:
     
    210209
    211210    def make_drt(self, options, args, host, stdin, stdout, stderr):
    212         options.chromium = True
     211        options.test_shell = True
    213212
    214213        # We have to set these by hand because --platform test won't trigger
     
    217216        options.pixel_tests = True
    218217
    219         return mock_drt.MockChromiumDRT(options, args, host, stdin, stdout, stderr)
     218        return mock_drt.MockTestShell(options, args, host, stdin, stdout, stderr)
    220219
    221220    def input_line(self, port, test_name, checksum=None):
     
    252251            {'/tmp/png_result0.png': 'image_checksum\x8a-pngtEXtchecksum\x00image_checksum-checksum'})
    253252
    254     def test_chromium_parse_options(self):
    255         options, args = mock_drt.parse_options(['--platform', 'chromium-mac',
     253    def test_test_shell_parse_options(self):
     254        options, args = mock_drt.parse_options(['--platform', 'chromium-mac', '--test-shell',
    256255            '--pixel-tests=/tmp/png_result0.png'])
    257         self.assertTrue(options.chromium)
     256        self.assertTrue(options.test_shell)
    258257        self.assertTrue(options.pixel_tests)
    259258        self.assertEquals(options.pixel_path, '/tmp/png_result0.png')
  • trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py

    r121509 r121812  
    4747from webkitpy.common.system.crashlogs_unittest import make_mock_crash_report_darwin
    4848from webkitpy.common.system.systemhost import SystemHost
     49from webkitpy.common.host import Host
    4950from webkitpy.common.host_mock import MockHost
    5051
     
    10121013
    10131014
     1015class PortTest(unittest.TestCase):
     1016    def assert_mock_port_works(self, port_name, args=[]):
     1017        self.assertTrue(passing_run(args + ['--platform', 'mock-' + port_name, 'fast/harness/results.html'], tests_included=True, host=Host()))
     1018
     1019    def test_chromium_mac_lion(self):
     1020        self.assert_mock_port_works('chromium-mac-lion')
     1021
     1022    def test_chromium_mac_lion_in_test_shell_mode(self):
     1023        self.assert_mock_port_works('chromium-mac-lion', args=['--additional-drt-flag=--test-shell'])
     1024
     1025    def test_qt_linux(self):
     1026        self.assert_mock_port_works('qt-linux')
     1027
     1028    def test_mac_lion(self):
     1029        self.assert_mock_port_works('mac-lion')
     1030
    10141031if __name__ == '__main__':
    10151032    unittest.main()
Note: See TracChangeset for help on using the changeset viewer.