| 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 29 matching lines...) Expand all Loading... |
| 40 def main(): | 40 def main(): |
| 41 parser = optparse.OptionParser() | 41 parser = optparse.OptionParser() |
| 42 parser.add_option('--build-dir', default=os.path.join('out', 'Debug'), | 42 parser.add_option('--build-dir', default=os.path.join('out', 'Debug'), |
| 43 help='relative path from the base source directory') | 43 help='relative path from the base source directory') |
| 44 options, args = parser.parse_args() | 44 options, args = parser.parse_args() |
| 45 finder = common.DirectoryFinder(options.build_dir) | 45 finder = common.DirectoryFinder(options.build_dir) |
| 46 fixup_path = finder.ScriptPath('fixup_pdf_template.py') | 46 fixup_path = finder.ScriptPath('fixup_pdf_template.py') |
| 47 text_diff_path = finder.ScriptPath('text_diff.py') | 47 text_diff_path = finder.ScriptPath('text_diff.py') |
| 48 source_dir = finder.TestingDir(os.path.join('resources', 'javascript')) | 48 source_dir = finder.TestingDir(os.path.join('resources', 'javascript')) |
| 49 pdfium_test_path = finder.ExecutablePath('pdfium_test') | 49 pdfium_test_path = finder.ExecutablePath('pdfium_test') |
| 50 if not os.path.exists(pdfium_test_path): |
| 51 print "FAILURE: Can't find test executable '%s'" % pdfium_test_path |
| 52 print "Use --build-dir to specify its location." |
| 53 return 1 |
| 50 working_dir = finder.WorkingDir(os.path.join('testing', 'javascript')) | 54 working_dir = finder.WorkingDir(os.path.join('testing', 'javascript')) |
| 51 if not os.path.exists(working_dir): | 55 if not os.path.exists(working_dir): |
| 52 os.makedirs(working_dir) | 56 os.makedirs(working_dir) |
| 53 | 57 |
| 54 failures = [] | 58 failures = [] |
| 55 input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]in$') | 59 input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]in$') |
| 56 for input_filename in os.listdir(source_dir): | 60 for input_filename in os.listdir(source_dir): |
| 57 if input_file_re.match(input_filename): | 61 if input_file_re.match(input_filename): |
| 58 input_path = os.path.join(source_dir, input_filename) | 62 input_path = os.path.join(source_dir, input_filename) |
| 59 if os.path.isfile(input_path): | 63 if os.path.isfile(input_path): |
| 60 if not generate_and_test(input_filename, source_dir, working_dir, | 64 if not generate_and_test(input_filename, source_dir, working_dir, |
| 61 fixup_path, pdfium_test_path, text_diff_path): | 65 fixup_path, pdfium_test_path, text_diff_path): |
| 62 failures.append(input_path) | 66 failures.append(input_path) |
| 63 | 67 |
| 64 if failures: | 68 if failures: |
| 65 print '\n\nSummary of Failures:' | 69 print '\n\nSummary of Failures:' |
| 66 for failure in failures: | 70 for failure in failures: |
| 67 print failure | 71 print failure |
| 68 return 1 | 72 return 1 |
| 69 return 0 | 73 return 0 |
| 70 | 74 |
| 71 | 75 |
| 72 if __name__ == '__main__': | 76 if __name__ == '__main__': |
| 73 sys.exit(main()) | 77 sys.exit(main()) |
| OLD | NEW |