OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 ''' | 3 ''' |
4 Copyright 2012 Google Inc. | 4 Copyright 2012 Google Inc. |
5 | 5 |
6 Use of this source code is governed by a BSD-style license that can be | 6 Use of this source code is governed by a BSD-style license that can be |
7 found in the LICENSE file. | 7 found in the LICENSE file. |
8 ''' | 8 ''' |
9 | 9 |
10 ''' | 10 ''' |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 going, or exit the program right away.""" | 114 going, or exit the program right away.""" |
115 # Get traceback information about the most recently raised exception. | 115 # Get traceback information about the most recently raised exception. |
116 exc_info = sys.exc_info() | 116 exc_info = sys.exc_info() |
117 | 117 |
118 if self._keep_going_on_failure: | 118 if self._keep_going_on_failure: |
119 print >> sys.stderr, ('WARNING: swallowing exception %s' % | 119 print >> sys.stderr, ('WARNING: swallowing exception %s' % |
120 repr(exc_info[1])) | 120 repr(exc_info[1])) |
121 self._failures_encountered.append(exc_info) | 121 self._failures_encountered.append(exc_info) |
122 else: | 122 else: |
123 print >> sys.stderr, ( | 123 print >> sys.stderr, ( |
124 'Halting at first exception; to keep going, re-run ' + | 124 '\nHalting at first exception.\n' + |
epoger
2013/09/04 20:05:56
Here's the before-and-after error message. Any fu
epoger
2013/09/04 20:08:48
Updated the message in patchset 2.
| |
125 'with the --keep-going-on-failure option set.') | 125 'Please file a bug, containing the following stack trace, ' + |
126 'at https://code.google.com/p/skia/issues/entry .\n\n' + | |
127 'Afterwards, you can re-run with the --keep-going-on-failure ' + | |
128 'option set.\n') | |
126 raise exc_info[1], None, exc_info[2] | 129 raise exc_info[1], None, exc_info[2] |
127 | 130 |
128 def ReportAllFailures(self): | 131 def ReportAllFailures(self): |
129 if self._failures_encountered: | 132 if self._failures_encountered: |
130 print >> sys.stderr, ('Encountered %d failures (see above).' % | 133 print >> sys.stderr, ('Encountered %d failures (see above).' % |
131 len(self._failures_encountered)) | 134 len(self._failures_encountered)) |
132 sys.exit(1) | 135 sys.exit(1) |
133 | 136 |
134 | 137 |
135 # Object that rebaselines a JSON expectations file (not individual image files). | 138 # Object that rebaselines a JSON expectations file (not individual image files). |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
357 parser.add_argument('--expectations-filename-output', | 360 parser.add_argument('--expectations-filename-output', |
358 help=('filename (under EXPECTATIONS_ROOT) to write ' | 361 help=('filename (under EXPECTATIONS_ROOT) to write ' |
359 'updated expectations into; by default, overwrites ' | 362 'updated expectations into; by default, overwrites ' |
360 'the input file (EXPECTATIONS_FILENAME)'), | 363 'the input file (EXPECTATIONS_FILENAME)'), |
361 default='') | 364 default='') |
362 parser.add_argument('--expectations-root', | 365 parser.add_argument('--expectations-root', |
363 help=('root of expectations directory to update-- should ' | 366 help=('root of expectations directory to update-- should ' |
364 'contain one or more builder subdirectories. ' | 367 'contain one or more builder subdirectories. ' |
365 'Defaults to %(default)s'), | 368 'Defaults to %(default)s'), |
366 default=os.path.join('expectations', 'gm')) | 369 default=os.path.join('expectations', 'gm')) |
367 parser.add_argument('--keep-going-on-failure', action='store_true', | 370 parser.add_argument('--keep-going-on-failure', action='store_true', |
epoger
2013/09/04 20:05:56
For now, I'm going to keep the default as "halt im
| |
368 help=('instead of halting at the first error encountered, ' | 371 help=('instead of halting at the first error encountered, ' |
369 'keep going and rebaseline as many tests as ' | 372 'keep going and rebaseline as many tests as ' |
370 'possible, and then report the full set of errors ' | 373 'possible, and then report the full set of errors ' |
371 'at the end')) | 374 'at the end')) |
372 parser.add_argument('--notes', | 375 parser.add_argument('--notes', |
373 help=('free-form text notes to add to all updated ' | 376 help=('free-form text notes to add to all updated ' |
374 'expectations')) | 377 'expectations')) |
375 # TODO(epoger): Add test that exercises --tests argument. | 378 # TODO(epoger): Add test that exercises --tests argument. |
376 parser.add_argument('--tests', metavar='TEST', nargs='+', | 379 parser.add_argument('--tests', metavar='TEST', nargs='+', |
377 help=('which tests to rebaseline, e.g. ' | 380 help=('which tests to rebaseline, e.g. ' |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
417 except: | 420 except: |
418 exception_handler.RaiseExceptionOrContinue() | 421 exception_handler.RaiseExceptionOrContinue() |
419 else: | 422 else: |
420 try: | 423 try: |
421 raise _InternalException('expectations_json_file %s not found' % | 424 raise _InternalException('expectations_json_file %s not found' % |
422 expectations_json_file) | 425 expectations_json_file) |
423 except: | 426 except: |
424 exception_handler.RaiseExceptionOrContinue() | 427 exception_handler.RaiseExceptionOrContinue() |
425 | 428 |
426 exception_handler.ReportAllFailures() | 429 exception_handler.ReportAllFailures() |
OLD | NEW |