Changeset 57446 in webkit
- Timestamp:
- Apr 11, 2010 12:41:56 AM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r57444 r57446 1 2010-04-11 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 Add PrettyPatch links to new-run-webkit-tests output 6 https://bugs.webkit.org/show_bug.cgi?id=37406 7 8 * Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py: 9 - We're leaking a file handle here, add a FIXME. 10 * Scripts/webkitpy/layout_tests/layout_package/test_failures.py: 11 - Add pretty diff links. 12 * Scripts/webkitpy/layout_tests/port/base.py: 13 - Add support for generating pretty diffs using PrettyPatch. 14 * Scripts/webkitpy/layout_tests/port/webkit.py: 15 - We're leaking another file handle here, another FIXME. 16 * Scripts/webkitpy/layout_tests/test_types/image_diff.py: 17 - Update write_output_files signature. 18 * Scripts/webkitpy/layout_tests/test_types/test_type_base.py: 19 - Remove unused arguments from write_output_files. 20 - Add support for dumping pretty diffs to write_output_files. 21 - Fix a bunch of file descriptor leaks in this file. 22 * Scripts/webkitpy/layout_tests/test_types/text_diff.py: 23 - Update write_output_files signature. 24 1 25 2010-04-10 Adam Barth <abarth@webkit.org> 2 26 -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/dump_render_tree_thread.py
r57381 r57446 90 90 filename = os.path.splitext(filename)[0] + "-stack.txt" 91 91 port.maybe_make_directory(os.path.split(filename)[0]) 92 open(filename, "wb").write(error) 92 open(filename, "wb").write(error) # FIXME: This leaks a file handle. 93 93 elif error: 94 94 _log.debug("Previous test output extra lines after dump:\n%s" % -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/layout_package/test_failures.py
r57381 r57446 111 111 def __init__(self, test_type): 112 112 TestFailure.__init__(self) 113 # TODO(ojan): This class no longer needs to know the test_type.113 # FIXME: This class no longer needs to know the test_type. 114 114 self._test_type = test_type 115 115 … … 128 128 If out_names is empty, returns the empty string. 129 129 """ 130 # FIXME: Seems like a bad idea to separate the display name data 131 # from the path data by hard-coding the display name here 132 # and passing in the path information via out_names. 130 133 links = [''] 131 134 uris = [self.relative_output_filename(filename, fn) for … … 139 142 if len(uris) > 3: 140 143 links.append("<a href='%s'>wdiff</a>" % uris[3]) 144 if len(uris) > 4: 145 links.append("<a href='%s'>pretty diff</a>" % uris[4]) 141 146 return ' '.join(links) 142 147 … … 193 198 """Text diff output failed.""" 194 199 # Filename suffixes used by ResultHtmlOutput. 200 # FIXME: Why don't we use the constants from TestTypeBase here? 195 201 OUT_FILENAMES = ["-actual.txt", "-expected.txt", "-diff.txt"] 196 202 OUT_FILENAMES_WDIFF = ["-actual.txt", "-expected.txt", "-diff.txt", 197 "-wdiff.html" ]203 "-wdiff.html", "-pretty-diff.html"] 198 204 199 205 def __init__(self, test_type, has_wdiff): -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/base.py
r57444 r57446 520 520 actual_filename, 521 521 expected_filename] 522 # FIXME: Why not just check os.exists(executable) once? 522 523 global _wdiff_available 523 524 result = '' … … 542 543 if _wdiff_available: 543 544 try: 545 # FIXME: Use Executive() here. 544 546 wdiff = subprocess.Popen(cmd, 545 547 stdout=subprocess.PIPE).communicate()[0] … … 563 565 return result 564 566 567 def pretty_patch_text(self, diff_path): 568 pretty_patch_path = self.path_from_webkit_base("BugsSite", "PrettyPatch") 569 prettify_path = os.path.join(pretty_patch_path, "prettify.rb") 570 command = ["ruby", "-I", pretty_patch_path, prettify_path, diff_path] 571 return self._executive.run_command(command) 572 565 573 def default_configuration(self): 566 574 return "Release" -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/port/webkit.py
r57442 r57446 164 164 result = False 165 165 elif output and diff_filename: 166 open(diff_filename, 'w').write(output) 166 open(diff_filename, 'w').write(output) # FIXME: This leaks a file handle. 167 167 elif sp.timed_out: 168 168 _log.error("ImageDiff timed out on %s" % expected_filename) -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/test_types/image_diff.py
r57443 r57446 151 151 if not os.path.isfile(expected_png_file): 152 152 # Report a missing expected PNG file. 153 self.write_output_files(port, filename, ' ', '.checksum',153 self.write_output_files(port, filename, '.checksum', 154 154 test_args.hash, expected_hash, 155 diff=False, wdiff=False)155 print_text_diffs=False) 156 156 self._copy_output_png(filename, test_args.png_path, '-actual.png') 157 157 failures.append(test_failures.FailureMissingImage(self)) … … 161 161 return failures 162 162 163 164 self.write_output_files(port, filename, '', '.checksum', 163 self.write_output_files(port, filename, '.checksum', 165 164 test_args.hash, expected_hash, 166 diff=False, wdiff=False)165 print_text_diffs=False) 167 166 self._copy_output_png(filename, test_args.png_path, '-actual.png') 168 167 self._copy_output_png(filename, expected_png_file, '-expected.png') -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/test_types/test_type_base.py
r57256 r57446 71 71 FILENAME_SUFFIX_DIFF = "-diff" 72 72 FILENAME_SUFFIX_WDIFF = "-wdiff.html" 73 FILENAME_SUFFIX_PRETTY_PATCH = "-pretty-diff.html" 73 74 FILENAME_SUFFIX_COMPARE = "-diff.png" 74 75 … … 112 113 output_path = os.path.join(output_dir, output_file) 113 114 _log.debug('writing new baseline to "%s"' % (output_path)) 114 open(output_path, "wb").write(data)115 self._write_into_file_at_path(output_path, data) 115 116 116 117 def output_filename(self, filename, modifier): … … 150 151 raise NotImplemented 151 152 152 def write_output_files(self, port, filename, test_type, file_type, 153 output, expected, diff=True, wdiff=False): 153 def _write_into_file_at_path(self, file_path, contents): 154 file = open(file_path, "wb") 155 file.write(contents) 156 file.close() 157 158 def write_output_files(self, port, filename, file_type, 159 output, expected, print_text_diffs=False): 154 160 """Writes the test output, the expected output and optionally the diff 155 161 between the two to files in the results directory. 156 162 157 163 The full output filename of the actual, for example, will be 158 <filename> <test_type>-actual<file_type>164 <filename>-actual<file_type> 159 165 For instance, 160 my_test- simp-actual.txt166 my_test-actual.txt 161 167 162 168 Args: 163 169 filename: The test filename 164 test_type: A string describing the test type, e.g. "simp"165 170 file_type: A string describing the test output file type, e.g. ".txt" 166 171 output: A string containing the test output 167 172 expected: A string containing the expected test output 168 diff: if True, write a file containing the diffs too. This should be 169 False for results that are not text 170 wdiff: if True, write an HTML file containing word-by-word diffs 173 print_text_diffs: True for text diffs. (FIXME: We should be able to get this from the file type?) 171 174 """ 172 175 self._make_output_directory(filename) 173 actual_filename = self.output_filename(filename, 174 test_type + self.FILENAME_SUFFIX_ACTUAL + file_type) 175 expected_filename = self.output_filename(filename, 176 test_type + self.FILENAME_SUFFIX_EXPECTED + file_type) 176 actual_filename = self.output_filename(filename, self.FILENAME_SUFFIX_ACTUAL + file_type) 177 expected_filename = self.output_filename(filename, self.FILENAME_SUFFIX_EXPECTED + file_type) 177 178 if output: 178 open(actual_filename, "wb").write(output)179 self._write_into_file_at_path(actual_filename, output) 179 180 if expected: 180 open(expected_filename, "wb").write(expected)181 self._write_into_file_at_path(expected_filename, expected) 181 182 182 183 if not output or not expected: 183 184 return 184 185 185 if diff: 186 diff = port.diff_text(expected, output, expected_filename, 187 actual_filename) 188 diff_filename = self.output_filename(filename, 189 test_type + self.FILENAME_SUFFIX_DIFF + file_type) 190 open(diff_filename, "wb").write(diff) 191 192 if wdiff: 193 # Shell out to wdiff to get colored inline diffs. 194 wdiff = port.wdiff_text(expected_filename, actual_filename) 195 filename = self.output_filename(filename, test_type + 196 self.FILENAME_SUFFIX_WDIFF) 197 out = open(filename, 'wb').write(wdiff) 186 if not print_text_diffs: 187 return 188 189 diff = port.diff_text(expected, output, expected_filename, actual_filename) 190 diff_filename = self.output_filename(filename, self.FILENAME_SUFFIX_DIFF + file_type) 191 self._write_into_file_at_path(diff_filename, diff) 192 193 # Shell out to wdiff to get colored inline diffs. 194 wdiff = port.wdiff_text(expected_filename, actual_filename) 195 wdiff_filename = self.output_filename(filename, self.FILENAME_SUFFIX_WDIFF) 196 self._write_into_file_at_path(wdiff_filename, wdiff) 197 198 # Use WebKit's PrettyPatch.rb to get an HTML diff. 199 pretty_patch = port.pretty_patch_text(diff_filename) 200 pretty_patch_filename = self.output_filename(filename, self.FILENAME_SUFFIX_PRETTY_PATCH) 201 self._write_into_file_at_path(pretty_patch_filename, pretty_patch) -
trunk/WebKitTools/Scripts/webkitpy/layout_tests/test_types/text_diff.py
r57443 r57446 99 99 if port.compare_text(output, expected): 100 100 # Text doesn't match, write output files. 101 self.write_output_files(port, filename, " ", ".txt", output,102 expected, diff=True, wdiff=True)101 self.write_output_files(port, filename, ".txt", output, 102 expected, print_text_diffs=True) 103 103 104 104 if expected == '':
Note: See TracChangeset
for help on using the changeset viewer.