Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Unified Diff: testing/tools/text_diff.py

Issue 1036073002: Replace linux-specific code in test scripts. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Use sys.executable Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « testing/tools/run_pixel_tests.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/tools/text_diff.py
diff --git a/testing/tools/text_diff.py b/testing/tools/text_diff.py
new file mode 100755
index 0000000000000000000000000000000000000000..3a5bd7bf6a12c2faa89a02d99453cd6e036bf58f
--- /dev/null
+++ b/testing/tools/text_diff.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+# Copyright 2015 The PDFium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import difflib
+import sys
+
+def main(argv):
+ if len(argv) != 3:
+ print '%s: invalid arguments' % argv[0]
+ return 2
+ filename1 = argv[1]
+ filename2 = argv[2]
+ try:
+ with open(filename1, "r") as f1:
+ str1 = f1.readlines();
+ with open(filename2, "r") as f2:
+ str2 = f2.readlines();
+ diffs = difflib.unified_diff(
+ str1, str2, fromfile=filename1, tofile=filename2)
+ except Exception as e:
+ print "something went astray: %s" % e
+ return 1
+ status_code = 0
+ for diff in diffs:
+ sys.stdout.write(diff)
+ status_code = 1
+ return status_code
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
« no previous file with comments | « testing/tools/run_pixel_tests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698