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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 return [error('Install google_appengine sdk in %s' % sdk_path)] | 55 return [error('Install google_appengine sdk in %s' % sdk_path)] |
56 | 56 |
57 # Second, checkout rietveld if not available. | 57 # Second, checkout rietveld if not available. |
58 if not input_api.os_path.isdir(rietveld): | 58 if not input_api.os_path.isdir(rietveld): |
59 print('Checking out rietveld') | 59 print('Checking out rietveld') |
60 if not call(['svn', 'co', '-q', | 60 if not call(['svn', 'co', '-q', |
61 'http://rietveld.googlecode.com/svn/trunk@563', | 61 'http://rietveld.googlecode.com/svn/trunk@563', |
62 rietveld]): | 62 rietveld]): |
63 return [error('Failed to checkout rietveld')] | 63 return [error('Failed to checkout rietveld')] |
64 print('Checking out django') | 64 print('Checking out django') |
65 if not call(['svn', 'co', '-q', | 65 if not call( |
66 'http://code.djangoproject.com/svn/django/trunk/django@13630', | 66 ['svn', 'co', '-q', |
67 join(rietveld, 'django')]): | 67 'http://code.djangoproject.com/' |
| 68 'svn/django/branches/releases/1.0.X/django@13637', |
| 69 join(rietveld, 'django')]): |
68 return [error('Failed to checkout django')] | 70 return [error('Failed to checkout django')] |
69 | 71 |
70 | 72 |
71 # Test to find an available port starting at 8080. | 73 # Test to find an available port starting at 8080. |
72 port = 8080 | 74 port = 8080 |
73 while test_port(port) and port < 65000: | 75 while test_port(port) and port < 65000: |
74 port += 1 | 76 port += 1 |
75 if port == 65000: | 77 if port == 65000: |
76 return [error('Having issues finding an available port')] | 78 return [error('Having issues finding an available port')] |
77 | 79 |
| 80 verbose = True |
| 81 if verbose: |
| 82 stdout = None |
| 83 stderr = None |
| 84 print('\n\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') |
| 85 else: |
| 86 stdout = input_api.subprocess.PIPE |
| 87 stderr = input_api.subprocess.PIPE |
78 output = [] | 88 output = [] |
79 test_server = input_api.subprocess.Popen( | 89 test_server = input_api.subprocess.Popen( |
80 [dev_app, rietveld, '--port=%d' % port], | 90 [dev_app, rietveld, '--port=%d' % port, '--use_sqlite', |
81 stdout=input_api.subprocess.PIPE, | 91 '--datastore_path=' + join(rietveld, 'tmp.db'), '-c'], |
82 stderr=input_api.subprocess.PIPE) | 92 stdout=stdout, stderr=stderr) |
83 try: | 93 try: |
84 # Loop until port 127.0.0.1:port opens or the process dies. | 94 # Loop until port 127.0.0.1:port opens or the process dies. |
85 while not test_port(port): | 95 while not test_port(port): |
86 test_server.poll() | 96 test_server.poll() |
87 if test_server.returncode is not None: | 97 if test_server.returncode is not None: |
88 output.append(error('Test rietveld instance failed early')) | 98 output.append(error('Test rietveld instance failed early')) |
89 break | 99 break |
90 time.sleep(0.001) | 100 time.sleep(0.001) |
91 | 101 |
92 test_path = input_api.os_path.abspath('test') | 102 test_path = input_api.os_path.abspath('test') |
93 for test in listdir(test_path): | 103 for test in listdir(test_path): |
94 if test == 'test-lib.sh' or not test.endswith('.sh'): | 104 if test == 'test-lib.sh' or not test.endswith('.sh'): |
95 continue | 105 continue |
96 print('Running %s' % test) | 106 print('Running %s' % test) |
97 if not call([join(test_path, test)], | 107 if not call([join(test_path, test)], cwd=test_path, stdout=stdout): |
98 cwd=test_path, | |
99 stdout=input_api.subprocess.PIPE): | |
100 output.append(error('%s failed' % test)) | 108 output.append(error('%s failed' % test)) |
101 finally: | 109 finally: |
102 test_server.kill() | 110 test_server.kill() |
103 return output | 111 return output |
OLD | NEW |