Add an option to rebaseline.py to mark tests as ignore-failure.

R=epoger@google.com, epoger

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

git-svn-id: http://skia.googlecode.com/svn/trunk@11358 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tools/rebaseline.py b/tools/rebaseline.py
index 502bcc9..a1f92cb 100755
--- a/tools/rebaseline.py
+++ b/tools/rebaseline.py
@@ -170,11 +170,14 @@
   #                   Currently, there is no way to make this script mark
   #                   expectations as reviewed-by-human=True.
   #                   TODO(epoger): Add that capability to a review tool.
+  #  mark_ignore_failure: if True, mark failures of a given test as being
+  #                       ignored.
   def __init__(self, expectations_root, expectations_input_filename,
                expectations_output_filename, actuals_base_url,
                actuals_filename, exception_handler,
                tests=None, configs=None, add_new=False, bugs=None, notes=None,
-               mark_unreviewed=None, from_trybot=False):
+               mark_unreviewed=None, mark_ignore_failure=False,
+               from_trybot=False):
     self._expectations_root = expectations_root
     self._expectations_input_filename = expectations_input_filename
     self._expectations_output_filename = expectations_output_filename
@@ -187,6 +190,7 @@
     self._bugs = bugs
     self._notes = notes
     self._mark_unreviewed = mark_unreviewed
+    self._mark_ignore_failure = mark_ignore_failure;
     self._image_filename_re = re.compile(gm_json.IMAGE_FILENAME_PATTERN)
     self._using_svn = os.path.isdir(os.path.join(expectations_root, '.svn'))
     self._from_trybot = from_trybot
@@ -307,6 +311,10 @@
           expected_results[image_name]\
                           [gm_json.JSONKEY_EXPECTEDRESULTS_REVIEWED]\
                           = False
+        if self._mark_ignore_failure:
+          expected_results[image_name]\
+                          [gm_json.JSONKEY_EXPECTEDRESULTS_IGNOREFAILURE]\
+                          = True
         if self._bugs:
           expected_results[image_name]\
                           [gm_json.JSONKEY_EXPECTEDRESULTS_BUGS]\
@@ -398,6 +406,10 @@
                     help=('mark all expectations modified by this run as '
                           '"%s": False' %
                           gm_json.JSONKEY_EXPECTEDRESULTS_REVIEWED))
+parser.add_argument('--ignore-failure', action='store_true',
+                    help=('mark all expectations modified by this run as '
+                          '"%s": True' %
+                          gm_json.JSONKEY_ACTUALRESULTS_FAILUREIGNORED))
 parser.add_argument('--from-trybot', action='store_true',
                     help=('pull the actual-results.json file from the '
                           'corresponding trybot, rather than the main builder'))
@@ -430,6 +442,7 @@
         exception_handler=exception_handler,
         add_new=args.add_new, bugs=args.bugs, notes=args.notes,
         mark_unreviewed=args.unreviewed,
+        mark_ignore_failure=args.ignore_failure,
         from_trybot=args.from_trybot)
     try:
       rebaseliner.RebaselineSubdir(builder=builder)