render_pictures: add --mismatchPath flag

When set, it will only write out images that don't match expectations.

BUG=skia:1942
R=rmistry@google.com

Author: epoger@google.com

Review URL: https://codereview.chromium.org/283123002

git-svn-id: http://skia.googlecode.com/svn/trunk@14748 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/tests/base_unittest.py b/tools/tests/base_unittest.py
index 2adaed0..f7ee570 100755
--- a/tools/tests/base_unittest.py
+++ b/tools/tests/base_unittest.py
@@ -10,7 +10,9 @@
 for various unittests within this directory.
 """
 
+import errno
 import os
+import shutil
 import sys
 import unittest
 
@@ -26,6 +28,20 @@
     """Tell unittest framework to not print docstrings for test cases."""
     return None
 
+  def create_empty_dir(self, path):
+    """Creates an empty directory at path and returns path.
+
+    Args:
+      path: path on local disk
+    """
+    shutil.rmtree(path=path, ignore_errors=True)
+    try:
+      os.makedirs(path)
+    except OSError as exc:
+      if exc.errno != errno.EEXIST:
+        raise
+    return path
+
   def run_command(self, args):
     """Runs a program from the command line and returns stdout.