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

Side by Side Diff: tools/gypv8sh.py

Issue 8333013: Allow generator javascript test files to go anywhere in the source tree (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix escaping from windows file paths. Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 Usage: 9 Usage:
10 python tools/gypv8sh.py v8_shell mock.js test_api.js js2webui.js \ 10 python tools/gypv8sh.py v8_shell mock.js test_api.js js2webui.js \
11 inputfile outputfile 11 inputfile inputrelfile cxxoutfile jsoutfile
12 """ 12 """
13 13
14 try: 14 try:
15 import json 15 import json
16 except ImportError: 16 except ImportError:
17 import simplejson as json 17 import simplejson as json
18 import optparse 18 import optparse
19 import os 19 import os
20 import subprocess 20 import subprocess
21 import sys 21 import sys
22 import shutil
22 23
23 def main (): 24 def main ():
24 parser = optparse.OptionParser() 25 parser = optparse.OptionParser()
25 parser.set_usage( 26 parser.set_usage(
26 "%prog v8_shell mock.js test_api.js js2webui.js inputfile outputfile") 27 "%prog v8_shell mock.js test_api.js js2webui.js inputfile inputrelfile "
28 "cxxoutfile jsoutfile")
27 parser.add_option('-v', '--verbose', action='store_true') 29 parser.add_option('-v', '--verbose', action='store_true')
28 parser.add_option('-n', '--impotent', action='store_true', 30 parser.add_option('-n', '--impotent', action='store_true',
29 help="don't execute; just print (as if verbose)") 31 help="don't execute; just print (as if verbose)")
30 (opts, args) = parser.parse_args() 32 (opts, args) = parser.parse_args()
31 33
32 if len(args) != 6: 34 if len(args) != 8:
33 parser.error('all arguments are required.') 35 parser.error('all arguments are required.')
34 v8_shell, mock_js, test_api, js2webui, inputfile, outputfile = args 36 (v8_shell, mock_js, test_api, js2webui, inputfile, inputrelfile,
35 arguments = [js2webui, inputfile, os.path.basename(inputfile), outputfile] 37 cxxoutfile, jsoutfile) = args
38 arguments = [js2webui, inputfile, inputrelfile, cxxoutfile]
36 cmd = [v8_shell, '-e', "arguments=" + json.dumps(arguments), mock_js, 39 cmd = [v8_shell, '-e', "arguments=" + json.dumps(arguments), mock_js,
37 test_api, js2webui] 40 test_api, js2webui]
38 if opts.verbose or opts.impotent: 41 if opts.verbose or opts.impotent:
39 print cmd 42 print cmd
40 if not opts.impotent: 43 if not opts.impotent:
41 try: 44 try:
42 subprocess.check_call(cmd, stdout=open(outputfile,'w')) 45 subprocess.check_call(cmd, stdout=open(cxxoutfile,'w'))
James Hawkins 2011/10/21 23:35:49 Space between params.
Sheridan Rawlins 2011/10/22 00:09:11 Done.
46 shutil.copyfile(inputfile, jsoutfile)
43 except Exception, ex: 47 except Exception, ex:
44 print ex 48 print ex
45 os.remove(outputfile) 49 os.remove(cxxoutfile)
50 os.remove(jsoutfile)
46 sys.exit(1) 51 sys.exit(1)
47 52
48 if __name__ == '__main__': 53 if __name__ == '__main__':
49 sys.exit(main()) 54 sys.exit(main())
OLDNEW
« chrome/common/chrome_paths.cc ('K') | « chrome/test/data/webui/options.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698