OLD | NEW |
1 #!/usr/bin/env python | 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 3 # found in the LICENSE file. |
5 | 4 |
6 """Generic presubmit checks that can be reused by other presubmit checks.""" | 5 """Generic presubmit checks that can be reused by other presubmit checks.""" |
7 | 6 |
8 ### Description checks | 7 ### Description checks |
9 | 8 |
10 def CheckChangeHasTestField(input_api, output_api): | 9 def CheckChangeHasTestField(input_api, output_api): |
11 """Requires that the changelist have a TEST= field.""" | 10 """Requires that the changelist have a TEST= field.""" |
12 if input_api.change.TEST: | 11 if input_api.change.TEST: |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 stderr=input_api.subprocess.PIPE) | 404 stderr=input_api.subprocess.PIPE) |
406 stdoutdata, stderrdata = subproc.communicate() | 405 stdoutdata, stderrdata = subproc.communicate() |
407 # Discard the output if returncode == 0 | 406 # Discard the output if returncode == 0 |
408 if subproc.returncode: | 407 if subproc.returncode: |
409 outputs.append("Test '%s' failed with code %d\n%s\n%s\n" % ( | 408 outputs.append("Test '%s' failed with code %d\n%s\n%s\n" % ( |
410 unit_test_name, subproc.returncode, stdoutdata, stderrdata)) | 409 unit_test_name, subproc.returncode, stdoutdata, stderrdata)) |
411 if outputs: | 410 if outputs: |
412 return [message_type("%d unit tests failed." % len(outputs), | 411 return [message_type("%d unit tests failed." % len(outputs), |
413 long_text='\n'.join(outputs))] | 412 long_text='\n'.join(outputs))] |
414 return [] | 413 return [] |
OLD | NEW |