summaryrefslogtreecommitdiff
path: root/testing/tools/run_corpus_tests.py
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-09-09 12:49:19 -0700
committerLei Zhang <thestig@chromium.org>2015-09-09 12:49:19 -0700
commit8ead9036aab18d45498e310866210dfff20da188 (patch)
tree33dffc156254d0ee76f9506a84c59e11d3dbe7eb /testing/tools/run_corpus_tests.py
parent9241e5a43990859f6f9a94aaa2c488d0451039e3 (diff)
downloadpdfium-8ead9036aab18d45498e310866210dfff20da188.tar.xz
Remove existing generated images before running a test.
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1314443007 .
Diffstat (limited to 'testing/tools/run_corpus_tests.py')
-rwxr-xr-xtesting/tools/run_corpus_tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/testing/tools/run_corpus_tests.py b/testing/tools/run_corpus_tests.py
index 28616fb531..0dadd52d19 100755
--- a/testing/tools/run_corpus_tests.py
+++ b/testing/tools/run_corpus_tests.py
@@ -24,6 +24,14 @@ def test_one_file(input_filename, source_dir, working_dir,
pdfium_test_path, image_differ):
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)
+ for image in actual_images:
+ if os.path.exists(image):
+ os.remove(image)
+
try:
shutil.copyfile(input_path, pdf_path)
sys.stdout.flush()
@@ -35,6 +43,7 @@ def test_one_file(input_filename, source_dir, working_dir,
return False
return True
+
def main():
parser = optparse.OptionParser()
parser.add_option('--build-dir', default=os.path.join('out', 'Debug'),