OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 The PDFium Authors. All rights reserved. | 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import optparse | 6 import optparse |
7 import os | 7 import os |
8 import re | 8 import re |
9 import subprocess | 9 import subprocess |
10 import sys | 10 import sys |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 print "FAILURE: Can't find test executable '%s'" % pdfium_test_path | 59 print "FAILURE: Can't find test executable '%s'" % pdfium_test_path |
60 print "Use --build-dir to specify its location." | 60 print "Use --build-dir to specify its location." |
61 return 1 | 61 return 1 |
62 working_dir = finder.WorkingDir(os.path.join('testing', 'pixel')) | 62 working_dir = finder.WorkingDir(os.path.join('testing', 'pixel')) |
63 if not os.path.exists(working_dir): | 63 if not os.path.exists(working_dir): |
64 os.makedirs(working_dir) | 64 os.makedirs(working_dir) |
65 | 65 |
66 test_suppressor = suppressor.Suppressor(finder) | 66 test_suppressor = suppressor.Suppressor(finder) |
67 image_differ = pngdiffer.PNGDiffer(finder) | 67 image_differ = pngdiffer.PNGDiffer(finder) |
68 | 68 |
69 input_files = [] | |
Tom Sepez
2015/10/28 20:25:48
ditto
dsinclair
2015/10/28 20:56:46
Done.
| |
70 for file_name in args: | |
71 file_name = file_name.replace(".pdf", ".in") | |
72 input_files.append(file_name) | |
73 | |
74 if len(input_files) == 0: | |
75 input_files = os.listdir(source_dir) | |
76 | |
69 failures = [] | 77 failures = [] |
70 input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]in$') | 78 input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]in$') |
71 for input_filename in os.listdir(source_dir): | 79 for input_filename in input_files: |
72 if input_file_re.match(input_filename): | 80 if input_file_re.match(input_filename): |
73 input_path = os.path.join(source_dir, input_filename) | 81 input_path = os.path.join(source_dir, input_filename) |
74 if os.path.isfile(input_path): | 82 if os.path.isfile(input_path): |
75 if test_suppressor.IsSuppressed(input_filename): | 83 if test_suppressor.IsSuppressed(input_filename): |
76 continue | 84 continue |
77 if not generate_and_test(input_filename, source_dir, working_dir, | 85 if not generate_and_test(input_filename, source_dir, working_dir, |
78 fixup_path, pdfium_test_path, image_differ): | 86 fixup_path, pdfium_test_path, image_differ): |
79 failures.append(input_path) | 87 failures.append(input_path) |
80 | 88 |
81 if failures: | 89 if failures: |
82 failures.sort() | 90 failures.sort() |
83 print '\n\nSummary of Failures:' | 91 print '\n\nSummary of Failures:' |
84 for failure in failures: | 92 for failure in failures: |
85 print failure | 93 print failure |
86 return 1 | 94 return 1 |
87 return 0 | 95 return 0 |
88 | 96 |
89 | 97 |
90 if __name__ == '__main__': | 98 if __name__ == '__main__': |
91 sys.exit(main()) | 99 sys.exit(main()) |
OLD | NEW |