OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """This script is used by chrome_tests.gypi's js2webui action to maintain the | 6 """This script is used by chrome_tests.gypi's js2webui action to maintain the |
7 argument lists and to generate inlinable tests. | 7 argument lists and to generate inlinable tests. |
8 """ | 8 """ |
9 | 9 |
10 import json | 10 import json |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 cxxoutfile, test_type] | 58 cxxoutfile, test_type] |
59 cmd.extend(['-e', "arguments=" + json.dumps(arguments), mock_js, | 59 cmd.extend(['-e', "arguments=" + json.dumps(arguments), mock_js, |
60 test_api, js2webui]) | 60 test_api, js2webui]) |
61 if opts.verbose or opts.impotent: | 61 if opts.verbose or opts.impotent: |
62 print cmd | 62 print cmd |
63 if not opts.impotent: | 63 if not opts.impotent: |
64 try: | 64 try: |
65 p = subprocess.Popen( | 65 p = subprocess.Popen( |
66 cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=0) | 66 cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=0) |
67 out, err = p.communicate() | 67 out, err = p.communicate() |
| 68 if p.returncode != 0: |
| 69 sys.stderr.write(out + err); |
| 70 return 1 |
68 if not HasSameContent(cxxoutfile, out): | 71 if not HasSameContent(cxxoutfile, out): |
69 with open(cxxoutfile, 'wb') as f: | 72 with open(cxxoutfile, 'wb') as f: |
70 f.write(out) | 73 f.write(out) |
71 shutil.copyfile(inputfile, jsoutfile) | 74 shutil.copyfile(inputfile, jsoutfile) |
72 except Exception, ex: | 75 except Exception, ex: |
73 if os.path.exists(cxxoutfile): | 76 if os.path.exists(cxxoutfile): |
74 os.remove(cxxoutfile) | 77 os.remove(cxxoutfile) |
75 if os.path.exists(jsoutfile): | 78 if os.path.exists(jsoutfile): |
76 os.remove(jsoutfile) | 79 os.remove(jsoutfile) |
77 raise | 80 raise |
78 | 81 |
79 | 82 |
80 if __name__ == '__main__': | 83 if __name__ == '__main__': |
81 sys.exit(main()) | 84 sys.exit(main()) |
OLD | NEW |