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 cStringIO | 6 import cStringIO |
7 import functools | 7 import functools |
8 import multiprocessing | 8 import multiprocessing |
9 import optparse | 9 import optparse |
10 import os | 10 import os |
(...skipping 19 matching lines...) Expand all Loading... |
30 input_path = os.path.join(source_dir, input_filename) | 30 input_path = os.path.join(source_dir, input_filename) |
31 pdf_path = os.path.join(working_dir, input_filename) | 31 pdf_path = os.path.join(working_dir, input_filename) |
32 # Remove any existing generated images from previous runs. | 32 # Remove any existing generated images from previous runs. |
33 actual_images = image_differ.GetActualFiles( | 33 actual_images = image_differ.GetActualFiles( |
34 input_filename, source_dir, working_dir) | 34 input_filename, source_dir, working_dir) |
35 for image in actual_images: | 35 for image in actual_images: |
36 if os.path.exists(image): | 36 if os.path.exists(image): |
37 os.remove(image) | 37 os.remove(image) |
38 | 38 |
39 shutil.copyfile(input_path, pdf_path) | 39 shutil.copyfile(input_path, pdf_path) |
| 40 input_event_path = os.path.splitext(input_path)[0] + ".evt" |
| 41 output_event_path = os.path.splitext(pdf_path)[0] + ".evt" |
| 42 if os.path.exists(input_event_path): |
| 43 shutil.copyfile(input_event_path, output_event_path) |
| 44 |
40 sys.stdout.flush() | 45 sys.stdout.flush() |
41 # add Dr. Memory wrapper if exist | 46 # add Dr. Memory wrapper if exist |
42 # remove .pdf suffix | 47 # remove .pdf suffix |
43 cmd_to_run = common.DrMemoryWrapper(drmem_wrapper, | 48 cmd_to_run = common.DrMemoryWrapper(drmem_wrapper, |
44 os.path.splitext(input_filename)[0]) | 49 os.path.splitext(input_filename)[0]) |
45 cmd_to_run.extend([pdfium_test_path, '--send-events', '--png', pdf_path]) | 50 cmd_to_run.extend([pdfium_test_path, '--send-events', '--png', pdf_path]) |
46 error = common.RunCommand(cmd_to_run) | 51 error = common.RunCommand(cmd_to_run) |
47 if error: | 52 if error: |
48 print "FAILURE: " + input_filename + "; " + str(error) | 53 print "FAILURE: " + input_filename + "; " + str(error) |
49 return False | 54 return False |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 print '\n\nSummary of Failures:' | 162 print '\n\nSummary of Failures:' |
158 for failure in failures: | 163 for failure in failures: |
159 print failure | 164 print failure |
160 return 1 | 165 return 1 |
161 | 166 |
162 return 0 | 167 return 0 |
163 | 168 |
164 | 169 |
165 if __name__ == '__main__': | 170 if __name__ == '__main__': |
166 sys.exit(main()) | 171 sys.exit(main()) |
OLD | NEW |