| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 source_dir = finder.TestingDir(os.path.join('resources', 'javascript')) | 56 source_dir = finder.TestingDir(os.path.join('resources', 'javascript')) |
| 57 pdfium_test_path = finder.ExecutablePath('pdfium_test') | 57 pdfium_test_path = finder.ExecutablePath('pdfium_test') |
| 58 if not os.path.exists(pdfium_test_path): | 58 if not os.path.exists(pdfium_test_path): |
| 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', 'javascript')) | 62 working_dir = finder.WorkingDir(os.path.join('testing', 'javascript')) |
| 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 feature_string = subprocess.check_output([pdfium_test_path, '--show-config']) |
| 67 if "V8" not in feature_string.strip().split(","): |
| 68 print "V8 not enabled, skipping." |
| 69 return 0 |
| 70 |
| 66 input_files = [] | 71 input_files = [] |
| 67 if len(args): | 72 if len(args): |
| 68 for file_name in args: | 73 for file_name in args: |
| 69 input_files.append(file_name.replace(".pdf", ".in")) | 74 input_files.append(file_name.replace(".pdf", ".in")) |
| 70 else: | 75 else: |
| 71 input_files = os.listdir(source_dir) | 76 input_files = os.listdir(source_dir) |
| 72 | 77 |
| 73 failures = [] | 78 failures = [] |
| 74 input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]in$') | 79 input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]in$') |
| 75 for input_filename in input_files: | 80 for input_filename in input_files: |
| 76 if input_file_re.match(input_filename): | 81 if input_file_re.match(input_filename): |
| 77 input_path = os.path.join(source_dir, input_filename) | 82 input_path = os.path.join(source_dir, input_filename) |
| 78 if os.path.isfile(input_path): | 83 if os.path.isfile(input_path): |
| 79 if not generate_and_test(input_filename, source_dir, working_dir, | 84 if not generate_and_test(input_filename, source_dir, working_dir, |
| 80 fixup_path, pdfium_test_path, text_diff_path, | 85 fixup_path, pdfium_test_path, text_diff_path, |
| 81 options.wrapper): | 86 options.wrapper): |
| 82 failures.append(input_path) | 87 failures.append(input_path) |
| 83 | 88 |
| 84 if failures: | 89 if failures: |
| 85 failures.sort() | 90 failures.sort() |
| 86 print '\n\nSummary of Failures:' | 91 print '\n\nSummary of Failures:' |
| 87 for failure in failures: | 92 for failure in failures: |
| 88 print failure | 93 print failure |
| 89 return 1 | 94 return 1 |
| 90 return 0 | 95 return 0 |
| 91 | 96 |
| 92 | 97 |
| 93 if __name__ == '__main__': | 98 if __name__ == '__main__': |
| 94 sys.exit(main()) | 99 sys.exit(main()) |
| OLD | NEW |