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

Unified Diff: testing/tools/run_corpus_tests.py

Issue 1010973002: Merge to XFA: Pull our new test case repository via deps. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/tools/run_corpus_tests.py
diff --git a/testing/tools/run_pixel_tests.py b/testing/tools/run_corpus_tests.py
similarity index 73%
copy from testing/tools/run_pixel_tests.py
copy to testing/tools/run_corpus_tests.py
index 3cd9a0a0603fa5b3e87fd1a687db93858b9f0ff1..674334f33ef4b7f097428fd6386bf5099c63c575 100755
--- a/testing/tools/run_pixel_tests.py
+++ b/testing/tools/run_corpus_tests.py
@@ -15,17 +15,16 @@ import sys
# x_path - "path/to/a/b/c/x.ext"
# c_dir - "path/to/a/b/c"
-def generate_and_test(input_filename, source_dir, working_dir,
- fixup_path, pdfium_test_path, pdfium_diff_path):
+def test_one_file(input_filename, source_dir, working_dir,
+ pdfium_test_path, pdfium_diff_path):
input_root, _ = os.path.splitext(input_filename)
- input_path = os.path.join(source_dir, input_root + '.in')
- pdf_path = os.path.join(working_dir, input_root + '.pdf')
+ input_path = os.path.join(source_dir, input_filename)
+ pdf_path = os.path.join(working_dir, input_filename)
actual_path_template = os.path.join(working_dir, input_root + '.pdf.%d.png')
expected_path_template = os.path.join(source_dir,
input_root + '_expected.pdf.%d.png')
try:
- subprocess.check_call(
- [fixup_path, '--output-dir=' + working_dir, input_path])
+ subprocess.check_call(['cp', input_path, pdf_path])
subprocess.check_call([pdfium_test_path, '--png', pdf_path])
i = 0;
while True:
@@ -56,12 +55,6 @@ def main():
print 'Confused, can not find pdfium root directory, aborting.'
return 1
- # Other scripts are found in the same directory as this one.
- fixup_path = os.path.join(my_dir, 'fixup_pdf_template.py')
-
- # test files are in .../pdfium/testing/resources/pixel.
- source_dir = os.path.join(testing_dir, 'resources', 'pixel')
-
# Find path to build directory. This depends on whether this is a
# standalone build vs. a build as part of a chromium checkout. For
# standalone, we expect a path like .../pdfium/out/Debug, but for
@@ -85,18 +78,20 @@ def main():
# TODO(tsepez): Mac may require special handling here.
# Place generated files under the build directory, not source directory.
- gen_dir = os.path.join(build_dir, 'gen', 'pdfium')
- working_dir = os.path.join(gen_dir, 'testing', 'pixel')
+ working_dir = os.path.join(build_dir, 'gen', 'pdfium', 'testing', 'corpus')
if not os.path.exists(working_dir):
os.makedirs(working_dir)
- input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]in$')
- for input_filename in os.listdir(source_dir):
- if input_file_re.match(input_filename):
- input_path = os.path.join(source_dir, input_filename)
- if os.path.isfile(input_path):
- generate_and_test(input_filename, source_dir, working_dir,
- fixup_path, pdfium_test_path, pdfium_diff_path)
+ # test files are under .../pdfium/testing/corpus.
+ walk_from_dir = os.path.join(testing_dir, 'corpus');
+ input_file_re = re.compile('^[a-zA-Z0-9_.]+[.]pdf$')
+ for source_dir, _, filename_list in os.walk(walk_from_dir):
+ for input_filename in filename_list:
+ if input_file_re.match(input_filename):
+ input_path = os.path.join(source_dir, input_filename)
+ if os.path.isfile(input_path):
+ test_one_file(input_filename, source_dir, working_dir,
+ pdfium_test_path, pdfium_diff_path)
return 0
« no previous file with comments | « DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698