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

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

Issue 1952923002: Combine corpus runner into test_runner.py (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 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
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 os 6 import os
7 import sys 7 import sys
8 8
9 import common 9 import common
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 expected_path = expected_path_template % i 50 expected_path = expected_path_template % i
51 # PDFium tests should be platform independent. Platform based results are 51 # PDFium tests should be platform independent. Platform based results are
52 # used to capture platform dependent implementations. 52 # used to capture platform dependent implementations.
53 platform_expected_path = ( 53 platform_expected_path = (
54 platform_expected_path_template % (self.os_name, i)) 54 platform_expected_path_template % (self.os_name, i))
55 if (not os.path.exists(expected_path) and 55 if (not os.path.exists(expected_path) and
56 not os.path.exists(platform_expected_path)): 56 not os.path.exists(platform_expected_path)):
57 if i == 0: 57 if i == 0:
58 print "WARNING: no expected results files for " + input_filename 58 print "WARNING: no expected results files for " + input_filename
59 break 59 break
60 print "Checking " + actual_path 60
61 short_path = actual_path
62 pos = short_path.find("pdfium/testing/")
63 if (pos != -1):
64 short_path = short_path[pos + len("pdfium/testing/"):]
65 print "Checking " + short_path
66
61 sys.stdout.flush() 67 sys.stdout.flush()
62 if os.path.exists(expected_path): 68 if os.path.exists(expected_path):
63 error = common.RunCommand( 69 error = common.RunCommand(
64 [self.pdfium_diff_path, expected_path, actual_path]) 70 [self.pdfium_diff_path, expected_path, actual_path])
65 else: 71 else:
66 error = 1; 72 error = 1;
67 if error: 73 if error:
68 # When failed, we check against platform based results. 74 # When failed, we check against platform based results.
69 if os.path.exists(platform_expected_path): 75 if os.path.exists(platform_expected_path):
70 error = common.RunCommand( 76 error = common.RunCommand(
71 [self.pdfium_diff_path, platform_expected_path, actual_path]) 77 [self.pdfium_diff_path, platform_expected_path, actual_path])
72 if error: 78 if error:
73 print "FAILURE: " + input_filename + "; " + str(error) 79 print "FAILURE: " + input_filename + "; " + str(error)
74 return True 80 return True
75 i += 1 81 i += 1
76 return False 82 return False
77 83
78 def _GetTemplatePaths(self, input_filename, source_dir, working_dir): 84 def _GetTemplatePaths(self, input_filename, source_dir, working_dir):
79 input_root, _ = os.path.splitext(input_filename) 85 input_root, _ = os.path.splitext(input_filename)
80 actual_path = os.path.join(working_dir, input_root + self.ACTUAL_TEMPLATE) 86 actual_path = os.path.join(working_dir, input_root + self.ACTUAL_TEMPLATE)
81 expected_path = os.path.join( 87 expected_path = os.path.join(
82 source_dir, input_root + self.EXPECTED_TEMPLATE) 88 source_dir, input_root + self.EXPECTED_TEMPLATE)
83 platform_expected_path = os.path.join( 89 platform_expected_path = os.path.join(
84 source_dir, input_root + self.PLATFORM_EXPECTED_TEMPLATE) 90 source_dir, input_root + self.PLATFORM_EXPECTED_TEMPLATE)
85 return (actual_path, expected_path, platform_expected_path) 91 return (actual_path, expected_path, platform_expected_path)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698