Index: Tools/Scripts/webkitpy/layout_tests/port/base.py |
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/base.py b/Tools/Scripts/webkitpy/layout_tests/port/base.py |
index ab4f31acfa96af84e8ec202d247abb9a60805545..2f27e8ebb0efeba0dcf73e96902dd2e19f7aa83a 100644 |
--- a/Tools/Scripts/webkitpy/layout_tests/port/base.py |
+++ b/Tools/Scripts/webkitpy/layout_tests/port/base.py |
@@ -526,7 +526,17 @@ class Port(object): |
actual_text.splitlines(True), |
expected_filename, |
actual_filename) |
- return ''.join(diff) |
+ |
+ # The diff generated by the difflib is incorrect if one of the files |
+ # does not have a newline at the end of the file and it is present in |
+ # the diff. Relevant Python issue: http://bugs.python.org/issue2142 |
+ def diff_fixup(diff): |
+ for line in diff: |
+ yield line |
+ if not line.endswith('\n'): |
+ yield '\n\ No newline at end of file\n' |
+ |
+ return ''.join(diff_fixup(diff)) |
def driver_name(self): |
if self.get_option('driver_name'): |