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 24 matching lines...) Expand all Loading... |
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 sys.stdout.flush() | 40 sys.stdout.flush() |
41 # add Dr. Memory wrapper if exist | 41 # add Dr. Memory wrapper if exist |
42 # remove .pdf suffix | 42 # remove .pdf suffix |
43 cmd_to_run = common.DrMemoryWrapper(drmem_wrapper, | 43 cmd_to_run = common.DrMemoryWrapper(drmem_wrapper, |
44 os.path.splitext(input_filename)[0]) | 44 os.path.splitext(input_filename)[0]) |
45 cmd_to_run.extend([pdfium_test_path, '--png', pdf_path]) | 45 cmd_to_run.extend([pdfium_test_path, '--send-events', '--png', pdf_path]) |
46 # run test | |
47 error = common.RunCommand(cmd_to_run) | 46 error = common.RunCommand(cmd_to_run) |
48 if error: | 47 if error: |
49 print "FAILURE: " + input_filename + "; " + str(error) | 48 print "FAILURE: " + input_filename + "; " + str(error) |
50 return False | 49 return False |
51 return not image_differ.HasDifferences(input_filename, source_dir, working_dir
) | 50 return not image_differ.HasDifferences(input_filename, source_dir, working_dir
) |
52 | 51 |
53 | 52 |
54 def test_one_file_parallel(working_dir, pdfium_test_path, image_differ, | 53 def test_one_file_parallel(working_dir, pdfium_test_path, image_differ, |
55 test_case): | 54 test_case): |
56 """Wrapper function to call test_one_file() and redirect output to stdout.""" | 55 """Wrapper function to call test_one_file() and redirect output to stdout.""" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 print '\n\nSummary of Failures:' | 157 print '\n\nSummary of Failures:' |
159 for failure in failures: | 158 for failure in failures: |
160 print failure | 159 print failure |
161 return 1 | 160 return 1 |
162 | 161 |
163 return 0 | 162 return 0 |
164 | 163 |
165 | 164 |
166 if __name__ == '__main__': | 165 if __name__ == '__main__': |
167 sys.exit(main()) | 166 sys.exit(main()) |
OLD | NEW |