From 77aaf96a165272ab52916c04b5ec69e4f2fd13de Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 9 Sep 2015 13:05:42 -0700 Subject: Merge to XFA: Remove existing generated images before running a test. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1314443007 . (cherry picked from commit 8ead9036aab18d45498e310866210dfff20da188) Review URL: https://codereview.chromium.org/1331643004 . --- testing/tools/run_pixel_tests.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'testing/tools/run_pixel_tests.py') diff --git a/testing/tools/run_pixel_tests.py b/testing/tools/run_pixel_tests.py index 98e8916cc0..c65a67aa17 100755 --- a/testing/tools/run_pixel_tests.py +++ b/testing/tools/run_pixel_tests.py @@ -24,6 +24,14 @@ def generate_and_test(input_filename, source_dir, working_dir, 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') + + # 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: sys.stdout.flush() subprocess.check_call( @@ -37,6 +45,7 @@ def generate_and_test(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'), @@ -77,5 +86,6 @@ def main(): return 1 return 0 + if __name__ == '__main__': sys.exit(main()) -- cgit v1.2.3