| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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: | 89 with open(os.path.join(testing_dir, 'SUPPRESSIONS')) as f: |
| 90 suppression_list = [x.strip() for x in f.readlines()] | 90 suppression_list = [y for y in [ |
| 91 x.split('#')[0].strip() for x in f.readlines()] if y] |
| 91 | 92 |
| 92 # test files are under .../pdfium/testing/corpus. | 93 # test files are under .../pdfium/testing/corpus. |
| 93 failures = [] | 94 failures = [] |
| 94 walk_from_dir = os.path.join(testing_dir, 'corpus'); | 95 walk_from_dir = os.path.join(testing_dir, 'corpus'); |
| 95 input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]pdf$') | 96 input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]pdf$') |
| 96 for source_dir, _, filename_list in os.walk(walk_from_dir): | 97 for source_dir, _, filename_list in os.walk(walk_from_dir): |
| 97 for input_filename in filename_list: | 98 for input_filename in filename_list: |
| 98 if input_file_re.match(input_filename): | 99 if input_file_re.match(input_filename): |
| 99 input_path = os.path.join(source_dir, input_filename) | 100 input_path = os.path.join(source_dir, input_filename) |
| 100 if os.path.isfile(input_path): | 101 if os.path.isfile(input_path): |
| 101 if input_filename in suppression_list: | 102 if input_filename in suppression_list: |
| 102 print "Not running %s, found in SUPPRESSIONS file" % input_filename | 103 print "Not running %s, found in SUPPRESSIONS file" % input_filename |
| 103 continue | 104 continue |
| 104 if not test_one_file(input_filename, source_dir, working_dir, | 105 if not test_one_file(input_filename, source_dir, working_dir, |
| 105 pdfium_test_path, pdfium_diff_path): | 106 pdfium_test_path, pdfium_diff_path): |
| 106 failures.append(input_path) | 107 failures.append(input_path) |
| 107 | 108 |
| 108 if failures: | 109 if failures: |
| 109 print '\n\nSummary of Failures:' | 110 print '\n\nSummary of Failures:' |
| 110 for failure in failures: | 111 for failure in failures: |
| 111 print failure | 112 print failure |
| 112 return 1 | 113 return 1 |
| 113 | 114 |
| 114 return 0 | 115 return 0 |
| 115 | 116 |
| 116 | 117 |
| 117 if __name__ == '__main__': | 118 if __name__ == '__main__': |
| 118 sys.exit(main()) | 119 sys.exit(main()) |
| OLD | NEW |