Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: testing/tools/run_pixel_tests.py

Issue 1150823003: Get test running scripts to detect and report common error. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Tweak fix to test code and apply to all three test runners. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « testing/tools/run_javascript_tests.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 28 matching lines...) Expand all
39 39
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 source_dir = finder.TestingDir(os.path.join('resources', 'pixel')) 47 source_dir = finder.TestingDir(os.path.join('resources', 'pixel'))
48 pdfium_test_path = finder.ExecutablePath('pdfium_test') 48 pdfium_test_path = finder.ExecutablePath('pdfium_test')
49 if not os.path.exists(pdfium_test_path):
50 print "FAILURE: Can't find test executable '%s'" % pdfium_test_path
51 print "Use --build-dir to specify its location."
52 return 1
49 working_dir = finder.WorkingDir(os.path.join('testing', 'pixel')) 53 working_dir = finder.WorkingDir(os.path.join('testing', 'pixel'))
50 if not os.path.exists(working_dir): 54 if not os.path.exists(working_dir):
51 os.makedirs(working_dir) 55 os.makedirs(working_dir)
52 56
53 test_suppressor = suppressor.Suppressor(finder) 57 test_suppressor = suppressor.Suppressor(finder)
54 image_differ = pngdiffer.PNGDiffer(finder) 58 image_differ = pngdiffer.PNGDiffer(finder)
55 59
56 failures = [] 60 failures = []
57 input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]in$') 61 input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]in$')
58 for input_filename in os.listdir(source_dir): 62 for input_filename in os.listdir(source_dir):
59 if input_file_re.match(input_filename): 63 if input_file_re.match(input_filename):
60 input_path = os.path.join(source_dir, input_filename) 64 input_path = os.path.join(source_dir, input_filename)
61 if os.path.isfile(input_path): 65 if os.path.isfile(input_path):
62 if test_suppressor.IsSuppressed(input_filename): 66 if test_suppressor.IsSuppressed(input_filename):
63 continue 67 continue
64 if not generate_and_test(input_filename, source_dir, working_dir, 68 if not generate_and_test(input_filename, source_dir, working_dir,
65 fixup_path, pdfium_test_path, image_differ): 69 fixup_path, pdfium_test_path, image_differ):
66 failures.append(input_path) 70 failures.append(input_path)
67 71
68 if failures: 72 if failures:
69 print '\n\nSummary of Failures:' 73 print '\n\nSummary of Failures:'
70 for failure in failures: 74 for failure in failures:
71 print failure 75 print failure
72 return 1 76 return 1
73 return 0 77 return 0
74 78
75 if __name__ == '__main__': 79 if __name__ == '__main__':
76 sys.exit(main()) 80 sys.exit(main())
OLDNEW
« no previous file with comments | « testing/tools/run_javascript_tests.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698