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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 if sys.platform.startswith('win'): | 77 if sys.platform.startswith('win'): |
78 pdfium_test_path = pdfium_test_path + '.exe' | 78 pdfium_test_path = pdfium_test_path + '.exe' |
79 pdfium_diff_path = pdfium_diff_path + '.exe' | 79 pdfium_diff_path = pdfium_diff_path + '.exe' |
80 # TODO(tsepez): Mac may require special handling here. | 80 # TODO(tsepez): Mac may require special handling here. |
81 | 81 |
82 # Place generated files under the build directory, not source directory. | 82 # Place generated files under the build directory, not source directory. |
83 working_dir = os.path.join(build_dir, 'gen', 'pdfium', 'testing', 'corpus') | 83 working_dir = os.path.join(build_dir, 'gen', 'pdfium', 'testing', 'corpus') |
84 if not os.path.exists(working_dir): | 84 if not os.path.exists(working_dir): |
85 os.makedirs(working_dir) | 85 os.makedirs(working_dir) |
86 | 86 |
87 with open(os.path.join(testing_dir, 'SUPPRESSIONS')) as f: | |
88 suppression_list = map(lambda x: x.strip(), f.readlines()) | |
Lei Zhang
2015/03/23 19:00:30
I think list comprehensions are more common than m
Tom Sepez
2015/03/23 19:21:23
Done.
| |
89 | |
87 # test files are under .../pdfium/testing/corpus. | 90 # test files are under .../pdfium/testing/corpus. |
88 os_exit_code = 0 | 91 os_exit_code = 0 |
89 walk_from_dir = os.path.join(testing_dir, 'corpus'); | 92 walk_from_dir = os.path.join(testing_dir, 'corpus'); |
90 input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]pdf$') | 93 input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]pdf$') |
91 for source_dir, _, filename_list in os.walk(walk_from_dir): | 94 for source_dir, _, filename_list in os.walk(walk_from_dir): |
92 for input_filename in filename_list: | 95 for input_filename in filename_list: |
93 if input_file_re.match(input_filename): | 96 if input_file_re.match(input_filename): |
94 input_path = os.path.join(source_dir, input_filename) | 97 input_path = os.path.join(source_dir, input_filename) |
95 if os.path.isfile(input_path): | 98 if os.path.isfile(input_path): |
96 if not test_one_file(input_filename, source_dir, working_dir, | 99 if input_filename in suppression_list: |
100 print "Not running %s, found in SUPPRESSIONS file" % input_filename | |
101 continue | |
102 if not test_one_file(input_filename, source_dir, working_dir, | |
97 pdfium_test_path, pdfium_diff_path): | 103 pdfium_test_path, pdfium_diff_path): |
98 os_exit_code = 1 | 104 os_exit_code = 1 |
99 | 105 |
100 return os_exit_code | 106 return os_exit_code |
101 | 107 |
102 | 108 |
103 if __name__ == '__main__': | 109 if __name__ == '__main__': |
104 sys.exit(main()) | 110 sys.exit(main()) |
OLD | NEW |