OLD | NEW |
1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 # 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 |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Top-level presubmit script for depot tools. | 5 """Top-level presubmit script for depot tools. |
6 | 6 |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for |
8 details on the presubmit API built into gcl. | 8 details on the presubmit API built into gcl. |
9 """ | 9 """ |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 else: | 41 else: |
42 stdout = input_api.subprocess.PIPE | 42 stdout = input_api.subprocess.PIPE |
43 stderr = input_api.subprocess.STDOUT | 43 stderr = input_api.subprocess.STDOUT |
44 output = [] | 44 output = [] |
45 try: | 45 try: |
46 # Start a local rietveld instance to test against. | 46 # Start a local rietveld instance to test against. |
47 server.start_server() | 47 server.start_server() |
48 test_path = input_api.os_path.abspath( | 48 test_path = input_api.os_path.abspath( |
49 input_api.os_path.join(input_api.PresubmitLocalPath(), 'test')) | 49 input_api.os_path.join(input_api.PresubmitLocalPath(), 'test')) |
50 for test in listdir(test_path): | 50 for test in listdir(test_path): |
51 # push-from-logs and rename fails for now. Remove from this list once | 51 # test-lib.sh is not an actual test so it should not be run. The other |
52 # they work. | 52 # tests are tests known to fail. |
53 if (test in ('push-from-logs.sh', 'rename.sh', 'test-lib.sh') or | 53 DISABLED_TESTS = ( |
54 not test.endswith('.sh')): | 54 'owners.sh', 'push-from-logs.sh', 'rename.sh', 'test-lib.sh') |
| 55 if test in DISABLED_TESTS or not test.endswith('.sh'): |
55 continue | 56 continue |
56 | 57 |
57 print('Running %s' % test) | 58 print('Running %s' % test) |
58 proc = input_api.subprocess.Popen( | 59 proc = input_api.subprocess.Popen( |
59 [input_api.os_path.join(test_path, test)], | 60 [input_api.os_path.join(test_path, test)], |
60 cwd=test_path, | 61 cwd=test_path, |
61 stdout=stdout, | 62 stdout=stdout, |
62 stderr=stderr) | 63 stderr=stderr) |
63 proc.communicate() | 64 proc.communicate() |
64 if proc.returncode != 0: | 65 if proc.returncode != 0: |
65 output.append(output_api.PresubmitError('%s failed' % test)) | 66 output.append(output_api.PresubmitError('%s failed' % test)) |
66 except local_rietveld.Failure, e: | 67 except local_rietveld.Failure, e: |
67 output.append(output_api.PresubmitError('\n'.join(str(i) for i in e.args))) | 68 output.append(output_api.PresubmitError('\n'.join(str(i) for i in e.args))) |
68 finally: | 69 finally: |
69 server.stop_server() | 70 server.stop_server() |
70 return output | 71 return output |
OLD | NEW |