create tools/tests/run_all.py to run all our Python self-tests within tools

Eventually, we want all of these self-tests to be written in Python;
this change makes it easier for us to add new Python self-tests, and discourages
the addition of bash self-tests.

BUG=skia:677,skia:1943
NOTRY=True
R=rmistry@google.com, scroggo@google.com

Author: epoger@google.com

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

git-svn-id: http://skia.googlecode.com/svn/trunk@12775 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/tests/skimage_self_test.py b/tools/tests/skimage_self_test.py
index 8191a9d..171404c 100755
--- a/tools/tests/skimage_self_test.py
+++ b/tools/tests/skimage_self_test.py
@@ -35,9 +35,8 @@
 # Quit early if two files have different content.
 def DieIfFilesMismatch(expected, actual):
     if not filecmp.cmp(expected, actual):
-        print 'Error: file mismatch! expected=%s , actual=%s' % (
-            expected, actual)
-        exit(1)
+        raise Exception("Error: file mismatch! expected=%s , actual=%s" % (
+            expected, actual))
 
 def test_invalid_file(file_dir, skimage_binary):
     """ Test the return value of skimage when an invalid file is decoded.
@@ -51,8 +50,7 @@
     args = [skimage_binary, "--readPath", invalid_file]
     result = subprocess.call(args)
     if 0 == result:
-      print "'%s' should have reported failure!" % " ".join(args)
-      exit(1)
+      raise Exception("'%s' should have reported failure!" % " ".join(args))
 
     # Directory holding all expectations files
     expectations_dir = os.path.join(file_dir, "skimage", "input", "bad-images")
@@ -64,8 +62,7 @@
             "--readExpectationsPath", incorrect_expectations]
     result = subprocess.call(args)
     if 0 == result:
-      print "'%s' should have reported failure!" % " ".join(args)
-      exit(1)
+      raise Exception("'%s' should have reported failure!" % " ".join(args))
 
     # Empty expectations:
     empty_expectations = os.path.join(expectations_dir, "empty-results.json")
@@ -78,8 +75,8 @@
       # in the output. That test could be passed if the output changed so
       # "Missing" never appears. This ensures that an error is not missed if
       # that happens.
-      print "skimage output changed! This may cause other self tests to fail!"
-      exit(1)
+      raise Exception(
+          "skimage output changed! This may cause other self tests to fail!")
 
     # Ignore failure:
     ignore_expectations = os.path.join(expectations_dir, "ignore-results.json")
@@ -92,8 +89,8 @@
       # appear in the output. That test could be passed if the output changed
       # so "failures" never appears. This ensures that an error is not missed
       # if that happens.
-      print "skimage output changed! This may cause other self tests to fail!"
-      exit(1)
+      raise Exception(
+          "skimage output changed! This may cause other self tests to fail!")
 
 def test_incorrect_expectations(file_dir, skimage_binary):
     """ Test that comparing to incorrect expectations fails, unless
@@ -110,8 +107,7 @@
             incorrect_results]
     result = subprocess.call(args)
     if 0 == result:
-      print "'%s' should have reported failure!" % " ".join(args)
-      exit(1)
+      raise Exception("'%s' should have reported failure!" % " ".join(args))
 
     ignore_results = os.path.join(expectations_dir, "ignore-failures.json")
     subprocess.check_call([skimage_binary, "--readPath", valid_file,
@@ -153,17 +149,13 @@
     # the expectations file was created from this same image. (It will print
     # "Missing" in this case before listing the missing expectations).
     if "Missing" in output:
-      print "Expectations file was missing expectations!"
-      print output
-      exit(1)
+      raise Exception("Expectations file was missing expectations: %s" % output)
 
     # Again, skimage would succeed if there were known failures (and print
     # "failures"), but there should be no failures, since the file just
     # created did not include failures to ignore.
     if "failures" in output:
-      print "Image failed!"
-      print output
-      exit(1)
+      raise Exception("Image failed: %s" % output)
 
 
     test_incorrect_expectations(file_dir=file_dir,