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
4 # found in the LICENSE file.
6 """This script is used by chrome_tests.gypi's js2webui action to maintain the
7 argument lists and to generate inlinable tests.
10 python tools/gypv8sh.py v8_shell mock.js test_api.js js2webui.js \
11 inputfile inputrelfile cxxoutfile jsoutfile
17 import simplejson
as json
25 parser
= optparse
.OptionParser()
27 "%prog v8_shell mock.js test_api.js js2webui.js "
28 "testtype inputfile inputrelfile cxxoutfile jsoutfile")
29 parser
.add_option('-v', '--verbose', action
='store_true')
30 parser
.add_option('-n', '--impotent', action
='store_true',
31 help="don't execute; just print (as if verbose)")
32 (opts
, args
) = parser
.parse_args()
35 parser
.error('all arguments are required.')
36 (v8_shell
, mock_js
, test_api
, js2webui
, test_type
,
37 inputfile
, inputrelfile
, cxxoutfile
, jsoutfile
) = args
38 arguments
= [js2webui
, inputfile
, inputrelfile
, cxxoutfile
, test_type
]
39 cmd
= [v8_shell
, '-e', "arguments=" + json
.dumps(arguments
), mock_js
,
41 if opts
.verbose
or opts
.impotent
:
45 subprocess
.check_call(cmd
, stdout
=open(cxxoutfile
, 'w'))
46 shutil
.copyfile(inputfile
, jsoutfile
)
53 if __name__
== '__main__':