OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright 2016 the V8 project authors. All rights reserved. | 3 # Copyright 2016 the V8 project authors. All rights reserved. |
4 # Copyright 2014 The Chromium Authors. All rights reserved. | 4 # Copyright 2014 The Chromium Authors. All rights reserved. |
5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
7 | 7 |
8 """Given the output of -t commands from a ninja build for a gyp and GN generated | 8 """Given the output of -t commands from a ninja build for a gyp and GN generated |
9 build, report on differences between the command lines.""" | 9 build, report on differences between the command lines.""" |
10 | 10 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 g_total_differences += len(missing_in_gyp) | 180 g_total_differences += len(missing_in_gyp) |
181 if missing_in_gn: | 181 if missing_in_gn: |
182 output += ' In GN, but not in gyp:\n %s' % '\n '.join( | 182 output += ' In GN, but not in gyp:\n %s' % '\n '.join( |
183 sorted(missing_in_gn)) + '\n\n' | 183 sorted(missing_in_gn)) + '\n\n' |
184 g_total_differences += len(missing_in_gn) | 184 g_total_differences += len(missing_in_gn) |
185 return output | 185 return output |
186 | 186 |
187 | 187 |
188 def Run(command_line): | 188 def Run(command_line): |
189 """Run |command_line| as a subprocess and return stdout. Raises on error.""" | 189 """Run |command_line| as a subprocess and return stdout. Raises on error.""" |
190 return subprocess.check_output(command_line, shell=True) | 190 try: |
| 191 return subprocess.check_output(command_line, shell=True) |
| 192 except subprocess.CalledProcessError as e: |
| 193 # Rescue the output we got until the exception happened. |
| 194 print '#### Stdout: ####################################################' |
| 195 print e.output |
| 196 print '#################################################################' |
| 197 raise |
191 | 198 |
192 | 199 |
193 def main(): | 200 def main(): |
194 if len(sys.argv) < 4: | 201 if len(sys.argv) < 4: |
195 print ('usage: %s gn_outdir gyp_outdir gn_target ' | 202 print ('usage: %s gn_outdir gyp_outdir gn_target ' |
196 '[gyp_target1, gyp_target2, ...]' % __file__) | 203 '[gyp_target1, gyp_target2, ...]' % __file__) |
197 return 1 | 204 return 1 |
198 | 205 |
199 if len(sys.argv) == 4: | 206 if len(sys.argv) == 4: |
200 sys.argv.append(sys.argv[3]) | 207 sys.argv.append(sys.argv[3]) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 print '\n'.join(sorted(files)) | 271 print '\n'.join(sorted(files)) |
265 print diff | 272 print diff |
266 | 273 |
267 print 'Total differences:', g_total_differences | 274 print 'Total differences:', g_total_differences |
268 # TODO(scottmg): Return failure on difference once we're closer to identical. | 275 # TODO(scottmg): Return failure on difference once we're closer to identical. |
269 return 0 | 276 return 0 |
270 | 277 |
271 | 278 |
272 if __name__ == '__main__': | 279 if __name__ == '__main__': |
273 sys.exit(main()) | 280 sys.exit(main()) |
OLD | NEW |