Chromium Code Reviews| 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. | |
|
tandrii(chromium)
2016/07/12 10:59:01
this will only print stdout though. Stderr has alr
Michael Achenbach
2016/07/12 11:11:38
Done.
| |
| 194 print e.output | |
| 195 raise | |
| 191 | 196 |
| 192 | 197 |
| 193 def main(): | 198 def main(): |
| 194 if len(sys.argv) < 4: | 199 if len(sys.argv) < 4: |
| 195 print ('usage: %s gn_outdir gyp_outdir gn_target ' | 200 print ('usage: %s gn_outdir gyp_outdir gn_target ' |
| 196 '[gyp_target1, gyp_target2, ...]' % __file__) | 201 '[gyp_target1, gyp_target2, ...]' % __file__) |
| 197 return 1 | 202 return 1 |
| 198 | 203 |
| 199 if len(sys.argv) == 4: | 204 if len(sys.argv) == 4: |
| 200 sys.argv.append(sys.argv[3]) | 205 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)) | 269 print '\n'.join(sorted(files)) |
| 265 print diff | 270 print diff |
| 266 | 271 |
| 267 print 'Total differences:', g_total_differences | 272 print 'Total differences:', g_total_differences |
| 268 # TODO(scottmg): Return failure on difference once we're closer to identical. | 273 # TODO(scottmg): Return failure on difference once we're closer to identical. |
| 269 return 0 | 274 return 0 |
| 270 | 275 |
| 271 | 276 |
| 272 if __name__ == '__main__': | 277 if __name__ == '__main__': |
| 273 sys.exit(main()) | 278 sys.exit(main()) |
| OLD | NEW |