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

Side by Side 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, 8 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 unified diff | Download patch
« no previous file with comments | « testing/tools/run_pixel_tests.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2015 The PDFium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import difflib
7 import sys
8
9 def main(argv):
10 if len(argv) != 3:
11 print '%s: invalid arguments' % argv[0]
12 return 2
13 filename1 = argv[1]
14 filename2 = argv[2]
15 try:
16 with open(filename1, "r") as f1:
17 str1 = f1.readlines();
18 with open(filename2, "r") as f2:
19 str2 = f2.readlines();
20 diffs = difflib.unified_diff(
21 str1, str2, fromfile=filename1, tofile=filename2)
22 except Exception as e:
23 print "something went astray: %s" % e
24 return 1
25 status_code = 0
26 for diff in diffs:
27 sys.stdout.write(diff)
28 status_code = 1
29 return status_code
30
31 if __name__ == '__main__':
32 sys.exit(main(sys.argv))
OLDNEW
« 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