Changeset 85905 in webkit


Ignore:
Timestamp:
May 5, 2011 5:28:21 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-05-05 Steve Lacey <sjl@chromium.org>

Reviewed by Ojan Vafai.

Fix generation of results html file by passing relative path to scm
methods.
Generate diff images for results html file.

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

  • Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py:
  • Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests_unittest.py:
Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r85898 r85905  
     12011-05-05  Steve Lacey  <sjl@chromium.org>
     2
     3        Reviewed by Ojan Vafai.
     4
     5        Fix generation of results html file by passing relative path to scm
     6        methods.
     7        Generate diff images for results html file.
     8
     9        https://bugs.webkit.org/show_bug.cgi?id=60086
     10
     11        * Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py:
     12        * Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests_unittest.py:
     13
    1142011-05-05  Andy Estes  <aestes@apple.com>
    215
  • trunk/Tools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests.py

    r84730 r85905  
    406406            self._filesystem.move(temp_name, expected_fullpath)
    407407
    408             # FIXME: SCM module doesn't handle paths that aren't relative to the checkout_root consistently.
    409             self._filesystem.chdir(self._scm.checkout_root)
    410             path_from_base = self._filesystem.relpath(expected_fullpath, self._filesystem.getcwd())
     408            path_from_base = self._filesystem.relpath(expected_fullpath)
    411409            if self._scm.exists(path_from_base):
    412410                _log.info('  Updating %s' % relpath)
     
    544542        """
    545543
     544        baseline_relpath = self._filesystem.relpath(baseline_fullpath)
     545        _log.debug('  Html: create baselines for "%s"', baseline_relpath)
     546
    546547        if (not baseline_fullpath
    547548            or not self._filesystem.exists(baseline_fullpath)):
     549            _log.debug('  Html: Does not exist: "%s"', baseline_fullpath)
    548550            return
    549551
    550         if not self._scm.exists(baseline_fullpath):
     552        if not self._scm.exists(baseline_relpath):
     553            _log.debug('  Html: Does not exist in scm: "%s"', baseline_relpath)
    551554            return
    552555
     
    561564        # Get the old baseline from the repository and save to the html directory.
    562565        try:
    563             output = self._scm.show_head(baseline_fullpath)
     566            output = self._scm.show_head(baseline_relpath)
    564567        except ScriptError, e:
    565568            _log.warning(e)
     
    578581
    579582        # Get the diff between old and new baselines and save to the html dir.
     583        diff_file = get_result_file_fullpath(self._filesystem,
     584                                             self._options.html_directory,
     585                                             baseline_filename,
     586                                             self._platform, 'diff')
     587        has_diff = False
    580588        if baseline_filename.upper().endswith('.TXT'):
    581             output = self._scm.diff_for_file(baseline_fullpath, log=_log)
     589            output = self._scm.diff_for_file(baseline_relpath, log=_log)
    582590            if output:
    583                 diff_file = get_result_file_fullpath(self._filesystem,
    584                     self._options.html_directory, baseline_filename,
    585                     self._platform, 'diff')
    586591                self._filesystem.write_text_file(diff_file, output)
    587                 _log.debug('  Html: created baseline diff file: "%s".', diff_file)
     592                has_diff = True
     593        elif baseline_filename.upper().endswith('.PNG'):
     594            old_file = get_result_file_fullpath(self._filesystem,
     595                                                self._options.html_directory,
     596                                                baseline_filename,
     597                                                self._platform, 'old')
     598            new_file = get_result_file_fullpath(self._filesystem,
     599                                                self._options.html_directory,
     600                                                baseline_filename,
     601                                                self._platform, 'new')
     602            _log.debug(' Html: diffing "%s" and "%s"', old_file, new_file)
     603            old_output = self._filesystem.read_binary_file(old_file)
     604            new_output = self._filesystem.read_binary_file(new_file)
     605            has_diff = self._port.diff_image(old_output, new_output, diff_file)
     606
     607        if has_diff:
     608            _log.debug('  Html: created baseline diff file: "%s".', diff_file)
    588609
    589610
     
    932953    zip_factory = None
    933954
     955    # FIXME: SCM module doesn't handle paths that aren't relative to the checkout_root consistently.
     956    host_port_obj._filesystem.chdir(scm_obj.checkout_root)
     957
    934958    ret_code = real_main(options, target_options, host_port_obj, target_port_obj, url_fetcher,
    935959                         zip_factory, scm_obj)
  • trunk/Tools/Scripts/webkitpy/layout_tests/rebaseline_chromium_webkit_tests_unittest.py

    r84730 r85905  
    204204        mock_scm = mocktool.MockSCM(filesystem)
    205205        filesystem.maybe_make_directory(mock_scm.checkout_root)
     206
     207        # FIXME: SCM module doesn't handle paths that aren't relative to the checkout_root consistently.
     208        filesystem.chdir("/test.checkout")
     209
    206210        rebaseliner = rebaseline_chromium_webkit_tests.Rebaseliner(host_port_obj,
    207211            target_port_obj, platform, options, url_fetcher, zip_factory, mock_scm)
     
    232236        rebaseliner, filesystem = self.make_rebaseliner(
    233237            "BUGX REBASELINE MAC : failures/expected/image.html = IMAGE")
    234         rebaseliner.run()
    235         # We expect to have written 12 files over the course of this rebaseline:
     238
     239        rebaseliner.run()
     240        # We expect to have written 13 files over the course of this rebaseline:
    236241        # *) 3 files in /__im_tmp for the extracted archive members
    237242        # *) 3 new baselines under '/test.checkout/LayoutTests'
    238243        # *) 4 files in /tmp for the new and old baselines in the result file
    239244        #    (-{old,new}.{txt,png}
    240         # *) 1 text diff in /tmp for the result file (-diff.txt). We don't
    241         #    create image diffs (FIXME?) and don't display the checksums.
     245        # *) 1 text diff in /tmp for the result file (-diff.txt).
     246        # *) 1 image diff in /tmp for the result file (-diff.png).
    242247        # *) 1 updated test_expectations file
    243         self.assertEqual(len(filesystem.written_files), 12)
     248        self.assertEqual(len(filesystem.written_files), 13)
    244249        self.assertEqual(filesystem.files['/test.checkout/LayoutTests/platform/test-mac-leopard/failures/expected/image-expected.checksum'], 'new-image-checksum')
    245250        self.assertEqual(filesystem.files['/test.checkout/LayoutTests/platform/test-mac-leopard/failures/expected/image-expected.png'], 'new-image-png')
     
    250255            "BUGX REBASELINE : failures/expected/image.html = IMAGE")
    251256        rebaseliner.run()
    252         # See comment in test_one_platform for an explanation of the 12 written tests.
     257        # See comment in test_one_platform for an explanation of the 13 written tests.
    253258        # Note that even though the rebaseline is marked for all platforms, each
    254259        # rebaseliner only ever does one.
    255         self.assertEqual(len(filesystem.written_files), 12)
     260        self.assertEqual(len(filesystem.written_files), 13)
    256261        self.assertEqual(filesystem.files['/test.checkout/LayoutTests/platform/test-mac-leopard/failures/expected/image-expected.checksum'], 'new-image-checksum')
    257262        self.assertEqual(filesystem.files['/test.checkout/LayoutTests/platform/test-mac-leopard/failures/expected/image-expected.png'], 'new-image-png')
     
    267272        # There is one less file written than |test_one_platform| because we only
    268273        # write 2 expectations (the png and the txt file).
    269         self.assertEqual(len(filesystem.written_files), 11)
     274        self.assertEqual(len(filesystem.written_files), 12)
    270275        self.assertEqual(filesystem.files['/test.checkout/LayoutTests/platform/test-mac-leopard/failures/expected/image_checksum-expected.png'], 'tEXtchecksum\x000123456789')
    271276        self.assertEqual(filesystem.files['/test.checkout/LayoutTests/platform/test-mac-leopard/failures/expected/image_checksum-expected.txt'], 'png-comment-txt')
     
    285290        # There is one more file written than |test_png_file_with_comment_remove_old_checksum|
    286291        # because we also delete the old checksum.
    287         self.assertEqual(len(filesystem.written_files), 12)
     292        self.assertEqual(len(filesystem.written_files), 13)
    288293        self.assertEqual(filesystem.files['/test.checkout/LayoutTests/platform/test-mac-leopard/failures/expected/image_checksum-expected.png'], 'tEXtchecksum\x000123456789')
    289294        self.assertEqual(filesystem.files['/test.checkout/LayoutTests/platform/test-mac-leopard/failures/expected/image_checksum-expected.txt'], 'png-comment-txt')
     
    339344        mock_scm = mocktool.MockSCM()
    340345        filesystem.maybe_make_directory(mock_scm.checkout_root)
     346
     347        # FIXME: SCM module doesn't handle paths that aren't relative to the checkout_root consistently.
     348        filesystem.chdir("/test.checkout")
     349
    341350        oc = outputcapture.OutputCapture()
    342351        oc.capture_output()
     
    345354        oc.restore_output()
    346355
    347         # We expect to have written 36 files over the course of this rebaseline:
     356        # We expect to have written 38 files over the course of this rebaseline:
    348357        # *) 6*3 files in /__im_tmp/ for the archived members of the 6 ports
    349358        # *) 2*3 files in /test.checkout for actually differing baselines
     
    351360        # *) 2*4 files in /tmp for the old/new baselines for the two actual ports
    352361        # *) 2 files in /tmp for the text diffs for the two ports
     362        # *) 2 files in /tmp for the image diffs for the two ports
    353363        # *) 1 file in /tmp for the rebaseline results html file
    354364        self.assertEqual(res, 0)
    355         self.assertEqual(len(filesystem.written_files), 36)
     365        self.assertEqual(len(filesystem.written_files), 38)
    356366
    357367
Note: See TracChangeset for help on using the changeset viewer.