Changeset 76982 in webkit


Ignore:
Timestamp:
Jan 28, 2011 1:34:02 PM (13 years ago)
Author:
dpranke@chromium.org
Message:

2011-01-28 Dirk Pranke <dpranke@chromium.org>

Reviewed by Tony Chang.

new-run-webkit-tests: add a "mock DRT" port implementation
and a separate class that emulates what we expect the
DumpRenderTree behavior to be.

This will eventually replace port/dryrun.py and allow us to get
better test coverage of the new-run-webkit-tests code as well as
a reference for what new-run-webkit-tests expects from DRT.

This is the first attempt at this, and it is pretty bare-boned. It
really only has been tested on the 'mac' port (and a little on
the 'chromium-mac' port.

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

  • Scripts/webkitpy/common/system/filesystem_mock.py:
  • Scripts/webkitpy/layout_tests/port/dryrun.py:
  • Scripts/webkitpy/layout_tests/port/factory.py:
  • Scripts/webkitpy/layout_tests/port/mock_drt.py: Added.
  • Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py: Added.
  • Scripts/webkitpy/layout_tests/port/test.py:
Location:
trunk/Tools
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r76973 r76982  
     12011-01-28  Dirk Pranke  <dpranke@chromium.org>
     2
     3        Reviewed by Tony Chang.
     4
     5        new-run-webkit-tests: add a "mock DRT" port implementation
     6        and a separate class that emulates what we expect the
     7        DumpRenderTree behavior to be.
     8
     9        This will eventually replace port/dryrun.py and allow us to get
     10        better test coverage of the new-run-webkit-tests code as well as
     11        a reference for what new-run-webkit-tests expects from DRT.
     12
     13        This is the first attempt at this, and it is pretty bare-boned. It
     14        really only has been tested on the 'mac' port (and a little on
     15        the 'chromium-mac' port.
     16
     17        https://bugs.webkit.org/show_bug.cgi?id=53126
     18
     19        * Scripts/webkitpy/common/system/filesystem_mock.py:
     20        * Scripts/webkitpy/layout_tests/port/dryrun.py:
     21        * Scripts/webkitpy/layout_tests/port/factory.py:
     22        * Scripts/webkitpy/layout_tests/port/mock_drt.py: Added.
     23        * Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py: Added.
     24        * Scripts/webkitpy/layout_tests/port/test.py:
     25
    1262011-01-28  Pratik Solanki  <psolanki@apple.com>
    227
  • trunk/Tools/Scripts/webkitpy/common/system/filesystem_mock.py

    r76642 r76982  
    217217
    218218    def read_text_file(self, path):
    219         return self.read_binary_file(path)
     219        return self.read_binary_file(path).decode('utf-8')
    220220
    221221    def read_binary_file(self, path):
     
    246246
    247247    def write_text_file(self, path, contents):
    248         return self.write_binary_file(path, contents)
     248        return self.write_binary_file(path, contents.encode('utf-8'))
    249249
    250250    def write_binary_file(self, path, contents):
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/dryrun.py

    r72708 r76982  
    7272        return getattr(self.__delegate, name)
    7373
     74    def acquire_http_lock(self):
     75        pass
     76
     77    def release_http_lock(self):
     78        pass
     79
    7480    def check_build(self, needs_http):
    7581        return True
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/factory.py

    r76722 r76982  
    7777        import dryrun
    7878        maker = dryrun.DryRunPort
     79    elif port_to_use.startswith('mock-'):
     80        import mock_drt
     81        maker = mock_drt.MockDRTPort
    7982    elif port_to_use.startswith('mac'):
    8083        import mac
  • trunk/Tools/Scripts/webkitpy/layout_tests/port/test.py

    r76642 r76982  
    5353        self.error = ''
    5454        self.timeout = False
    55         self.actual_text = self.base + '-txt\n'
    56         self.actual_checksum = self.base + '-checksum\n'
    57         self.actual_image = self.base + '-png\n'
     55
     56        # The values of each field are treated as raw byte strings. They
     57        # will be converted to unicode strings where appropriate using
     58        # MockFileSystem.read_text_file().
     59        self.actual_text = self.base + '-txt'
     60        self.actual_checksum = self.base + '-checksum'
     61
     62        # We add the '\x8a' for the image file to prevent the value from
     63        # being treated as UTF-8 (the character is invalid)
     64        self.actual_image = self.base + '\x8a' + '-png'
     65
    5866        self.expected_text = self.actual_text
    5967        self.expected_checksum = self.actual_checksum
     
    8694    tests = TestList()
    8795    tests.add('failures/expected/checksum.html',
    88                 actual_checksum='checksum_fail-checksum')
     96              actual_checksum='checksum_fail-checksum')
    8997    tests.add('failures/expected/crash.html', crash=True)
    9098    tests.add('failures/expected/exception.html', exception=True)
    9199    tests.add('failures/expected/timeout.html', timeout=True)
    92100    tests.add('failures/expected/hang.html', hang=True)
    93     tests.add('failures/expected/missing_text.html',
    94                 expected_text=None)
     101    tests.add('failures/expected/missing_text.html', expected_text=None)
    95102    tests.add('failures/expected/image.html',
    96                 actual_image='image_fail-png',
    97                 expected_image='image-png')
     103              actual_image='image_fail-png',
     104              expected_image='image-png')
    98105    tests.add('failures/expected/image_checksum.html',
    99                 actual_checksum='image_checksum_fail-checksum',
    100                 actual_image='image_checksum_fail-png')
    101     tests.add('failures/expected/keyboard.html',
    102                 keyboard=True)
    103     tests.add('failures/expected/missing_check.html',
    104                 expected_checksum=None)
    105     tests.add('failures/expected/missing_image.html',
    106                 expected_image=None)
    107     tests.add('failures/expected/missing_text.html',
    108                 expected_text=None)
     106              actual_checksum='image_checksum_fail-checksum',
     107              actual_image='image_checksum_fail-png')
     108    tests.add('failures/expected/keyboard.html', keyboard=True)
     109    tests.add('failures/expected/missing_check.html', expected_checksum=None)
     110    tests.add('failures/expected/missing_image.html', expected_image=None)
     111    tests.add('failures/expected/missing_text.html', expected_text=None)
    109112    tests.add('failures/expected/newlines_leading.html',
    110                 expected_text="\nfoo\n",
    111                 actual_text="foo\n")
     113              expected_text="\nfoo\n", actual_text="foo\n")
    112114    tests.add('failures/expected/newlines_trailing.html',
    113                 expected_text="foo\n\n",
    114                 actual_text="foo\n")
     115              expected_text="foo\n\n", actual_text="foo\n")
    115116    tests.add('failures/expected/newlines_with_excess_CR.html',
    116                 expected_text="foo\r\r\r\n",
    117                 actual_text="foo\n")
    118     tests.add('failures/expected/text.html',
    119                 actual_text='text_fail-png')
     117              expected_text="foo\r\r\r\n", actual_text="foo\n")
     118    tests.add('failures/expected/text.html', actual_text='text_fail-png')
    120119    tests.add('failures/unexpected/crash.html', crash=True)
    121120    tests.add('failures/unexpected/text-image-checksum.html',
    122                 actual_text='text-image-checksum_fail-txt',
    123                 actual_checksum='text-image-checksum_fail-checksum')
     121              actual_text='text-image-checksum_fail-txt',
     122              actual_checksum='text-image-checksum_fail-checksum')
    124123    tests.add('failures/unexpected/timeout.html', timeout=True)
    125124    tests.add('http/tests/passes/text.html')
     
    128127    tests.add('passes/image.html')
    129128    tests.add('passes/platform_image.html')
     129
    130130    # Text output files contain "\r\n" on Windows.  This may be
    131131    # helpfully filtered to "\r\r\n" by our Python/Cygwin tooling.
    132132    tests.add('passes/text.html',
    133                 expected_text='\nfoo\n\n',
    134                 actual_text='\nfoo\r\n\r\r\n')
     133              expected_text='\nfoo\n\n', actual_text='\nfoo\r\n\r\r\n')
    135134    tests.add('websocket/tests/passes/text.html')
    136135    return tests
     
    211210                           **kwargs)
    212211
     212    def _path_to_driver(self):
     213        # This routine shouldn't normally be called, but it is called by
     214        # the mock_drt Driver. We return something, but make sure it's useless.
     215        return 'junk'
     216
    213217    def baseline_path(self):
    214218        return self._filesystem.join(self.layout_tests_dir(), 'platform',
     
    225229        diffed = actual_contents != expected_contents
    226230        if diffed and diff_filename:
    227             self._filesystem.write_text_file(diff_filename,
     231            self._filesystem.write_binary_file(diff_filename,
    228232                "< %s\n---\n> %s\n" % (expected_contents, actual_contents))
    229233        return diffed
     
    291295
    292296    def cmd_line(self):
    293         return ['None']
     297        return [self._port._path_to_driver()]
    294298
    295299    def poll(self):
Note: See TracChangeset for help on using the changeset viewer.