Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Side by Side Diff: tools/gypv8sh.py

Issue 1299893002: Improve error handling for js2gtest C++ generation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Switch the output generator to use javascript template strings. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« chrome/test/base/js2gtest.js ('K') | « chrome/test/base/js2gtest.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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())
OLDNEW
« chrome/test/base/js2gtest.js ('K') | « chrome/test/base/js2gtest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698