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 = [] |
| 70 if len(args): |
| 71 for file_name in args: |
| 72 input_files.append(file_name.replace(".pdf", ".in")) |
| 73 else: |
| 74 input_files = os.listdir(source_dir) |
| 75 |
69 failures = [] | 76 failures = [] |
70 input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]in$') | 77 input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]in$') |
71 for input_filename in os.listdir(source_dir): | 78 for input_filename in input_files: |
72 if input_file_re.match(input_filename): | 79 if input_file_re.match(input_filename): |
73 input_path = os.path.join(source_dir, input_filename) | 80 input_path = os.path.join(source_dir, input_filename) |
74 if os.path.isfile(input_path): | 81 if os.path.isfile(input_path): |
75 if test_suppressor.IsSuppressed(input_filename): | 82 if test_suppressor.IsSuppressed(input_filename): |
76 continue | 83 continue |
77 if not generate_and_test(input_filename, source_dir, working_dir, | 84 if not generate_and_test(input_filename, source_dir, working_dir, |
78 fixup_path, pdfium_test_path, image_differ): | 85 fixup_path, pdfium_test_path, image_differ): |
79 failures.append(input_path) | 86 failures.append(input_path) |
80 | 87 |
81 if failures: | 88 if failures: |
82 failures.sort() | 89 failures.sort() |
83 print '\n\nSummary of Failures:' | 90 print '\n\nSummary of Failures:' |
84 for failure in failures: | 91 for failure in failures: |
85 print failure | 92 print failure |
86 return 1 | 93 return 1 |
87 return 0 | 94 return 0 |
88 | 95 |
89 | 96 |
90 if __name__ == '__main__': | 97 if __name__ == '__main__': |
91 sys.exit(main()) | 98 sys.exit(main()) |
OLD | NEW |