diff options
author | Qin Zhao <zhaoqin@google.com> | 2015-11-23 16:50:49 -0500 |
---|---|---|
committer | Qin Zhao <zhaoqin@google.com> | 2015-11-23 16:50:49 -0500 |
commit | fba46da798abae8c8cc0e9329e14bca860c2afc6 (patch) | |
tree | 976fd4425cf7bf3099cf4657d64059adaa827b37 /testing/tools/run_corpus_tests.py | |
parent | 65db985775e032463cf9ae93ba4c6f7b01961bf0 (diff) | |
download | pdfium-fba46da798abae8c8cc0e9329e14bca860c2afc6.tar.xz |
Merge to XFA: Enable Dr. Memory to run javascript, pixel, and corpus tests
- add DrMemoryWrapper in common.py to adjust Dr. Memory wrapper
- add --wrapper option to run_*_tests.py for Dr. Mempry wrapper
- update run_*_tests.py to handle Dr. Memory wrapper
- add TestPDFiumTest in pdfium_tests.py to support run_*_tests.py
- remove ValgrindTool in valgrind_tests.py
R=thestig@chromium.org
BUG=pdfium:238
Review URL: https://codereview.chromium.org/1464453003 .
(cherry picked from commit 36476923ae5eb8e9283e605f3c85ee8811c86014)
Review URL: https://codereview.chromium.org/1465333002 .
Diffstat (limited to 'testing/tools/run_corpus_tests.py')
-rwxr-xr-x | testing/tools/run_corpus_tests.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/testing/tools/run_corpus_tests.py b/testing/tools/run_corpus_tests.py index 29f23b504a..e2b950c363 100755 --- a/testing/tools/run_corpus_tests.py +++ b/testing/tools/run_corpus_tests.py @@ -26,10 +26,10 @@ class KeyboardInterruptError(Exception): pass # c_dir - "path/to/a/b/c" def test_one_file(input_filename, source_dir, working_dir, - pdfium_test_path, image_differ, redirect_output=False): + pdfium_test_path, image_differ, drmem_wrapper, + redirect_output=False): input_path = os.path.join(source_dir, input_filename) pdf_path = os.path.join(working_dir, input_filename) - # Remove any existing generated images from previous runs. actual_images = image_differ.GetActualFiles( input_filename, source_dir, working_dir) @@ -39,8 +39,13 @@ def test_one_file(input_filename, source_dir, working_dir, shutil.copyfile(input_path, pdf_path) sys.stdout.flush() - error = common.RunCommand([pdfium_test_path, '--png', pdf_path], - redirect_output) + # add Dr. Memory wrapper if exist + # remove .pdf suffix + cmd_to_run = common.DrMemoryWrapper(drmem_wrapper, + os.path.splitext(input_filename)[0]) + cmd_to_run.extend([pdfium_test_path, '--png', pdf_path]) + # run test + error = common.RunCommand(cmd_to_run, redirect_output) if error: print "FAILURE: " + input_filename + "; " + str(error) return False @@ -58,7 +63,7 @@ def test_one_file_parallel(working_dir, pdfium_test_path, image_differ, sys.stderr = sys.stdout input_filename, source_dir = test_case result = test_one_file(input_filename, source_dir, working_dir, - pdfium_test_path, image_differ, True); + pdfium_test_path, image_differ, "", True); output = sys.stdout sys.stdout = old_stdout sys.stderr = old_stderr @@ -84,6 +89,8 @@ def main(): parser.add_option('-j', default=multiprocessing.cpu_count(), dest='num_workers', type='int', help='run NUM_WORKERS jobs in parallel') + parser.add_option('--wrapper', default='', dest="wrapper", + help='Dr. Memory wrapper for running test under Dr. Memory') options, args = parser.parse_args() finder = common.DirectoryFinder(options.build_dir) pdfium_test_path = finder.ExecutablePath('pdfium_test') @@ -143,7 +150,8 @@ def main(): for test_case in test_cases: input_filename, source_dir = test_case result = test_one_file(input_filename, source_dir, working_dir, - pdfium_test_path, image_differ) + pdfium_test_path, image_differ, + options.wrapper) handle_result(test_suppressor, input_filename, input_path, result, surprises, failures) |