| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 if sys.platform.startswith('win'): | 79 if sys.platform.startswith('win'): |
| 80 pdfium_test_path = pdfium_test_path + '.exe' | 80 pdfium_test_path = pdfium_test_path + '.exe' |
| 81 pdfium_diff_path = pdfium_diff_path + '.exe' | 81 pdfium_diff_path = pdfium_diff_path + '.exe' |
| 82 # TODO(tsepez): Mac may require special handling here. | 82 # TODO(tsepez): Mac may require special handling here. |
| 83 | 83 |
| 84 # Place generated files under the build directory, not source directory. | 84 # Place generated files under the build directory, not source directory. |
| 85 working_dir = os.path.join(build_dir, 'gen', 'pdfium', 'testing', 'corpus') | 85 working_dir = os.path.join(build_dir, 'gen', 'pdfium', 'testing', 'corpus') |
| 86 if not os.path.exists(working_dir): | 86 if not os.path.exists(working_dir): |
| 87 os.makedirs(working_dir) | 87 os.makedirs(working_dir) |
| 88 | 88 |
| 89 with open(os.path.join(testing_dir, 'SUPPRESSIONS')) as f: |
| 90 suppression_list = [x.strip() for x in f.readlines()] |
| 91 |
| 89 # test files are under .../pdfium/testing/corpus. | 92 # test files are under .../pdfium/testing/corpus. |
| 90 failures = [] | 93 failures = [] |
| 91 walk_from_dir = os.path.join(testing_dir, 'corpus'); | 94 walk_from_dir = os.path.join(testing_dir, 'corpus'); |
| 92 input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]pdf$') | 95 input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]pdf$') |
| 93 for source_dir, _, filename_list in os.walk(walk_from_dir): | 96 for source_dir, _, filename_list in os.walk(walk_from_dir): |
| 94 for input_filename in filename_list: | 97 for input_filename in filename_list: |
| 95 if input_file_re.match(input_filename): | 98 if input_file_re.match(input_filename): |
| 96 input_path = os.path.join(source_dir, input_filename) | 99 input_path = os.path.join(source_dir, input_filename) |
| 97 if os.path.isfile(input_path): | 100 if os.path.isfile(input_path): |
| 98 if not test_one_file(input_filename, source_dir, working_dir, | 101 if input_filename in suppression_list: |
| 102 print "Not running %s, found in SUPPRESSIONS file" % input_filename |
| 103 continue |
| 104 if not test_one_file(input_filename, source_dir, working_dir, |
| 99 pdfium_test_path, pdfium_diff_path): | 105 pdfium_test_path, pdfium_diff_path): |
| 100 failures.append(input_path) | 106 failures.append(input_path) |
| 101 | 107 |
| 102 if failures: | 108 if failures: |
| 103 print '\n\nSummary of Failures:' | 109 print '\n\nSummary of Failures:' |
| 104 for failure in failures: | 110 for failure in failures: |
| 105 print failure | 111 print failure |
| 106 return 1 | 112 return 1 |
| 107 | 113 |
| 108 return 0 | 114 return 0 |
| 109 | 115 |
| 110 | 116 |
| 111 if __name__ == '__main__': | 117 if __name__ == '__main__': |
| 112 sys.exit(main()) | 118 sys.exit(main()) |
| OLD | NEW |