Chromium Code Reviews| Index: tools/gypv8sh.py |
| diff --git a/tools/gypv8sh.py b/tools/gypv8sh.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..a7d803feaf0e74a36793ff23f1d2bfe4935dda43 |
| --- /dev/null |
| +++ b/tools/gypv8sh.py |
| @@ -0,0 +1,69 @@ |
| +#!/usr/bin/python |
| +# Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| +# |
| +# This script is used by chrome_tests.gypi's js2webui action to maintain the |
| +# argument lists and to generate inlinable tests. |
| +# |
| +# Usage: |
| +# python tools/gypv8sh.py -p product_dir path/to/javascript2webui.js |
| +# python tools/gypv8sh.py -t # print test_harnesses |
| +# python tools/gypv8sh.py -i # print inputs |
| +# python tools/gypv8sh.py -o # print outputs |
| +import json |
| +import sys |
| +import os |
| +import subprocess |
| +import getopt |
|
nsylvain
2011/06/12 21:13:19
sort the imports
Sheridan Rawlins
2011/06/13 15:40:44
Done.
|
| + |
| +# Please adjust the following to edit or add new javascript webui tests. |
| +rules = [ |
| + [ |
| + 'WebUIBrowserTestPass', |
| + 'test/data/webui/sample_pass.js', |
| + 'browser/ui/webui/web_ui_browsertest-inl.h', |
| + ], |
| + ] |
| + |
| +opts, args = getopt.getopt( |
| + sys.argv[1:], 'vntiop:', ['test_fixture', 'in', 'out', 'product_dir=']); |
| + |
| +indices = set() |
| +product_dir = '' |
| +verbose = 0 |
| +impotent = 0 |
| +if len(opts): |
| + for o, a in opts: |
| + if o in ('-t','--test_fixture'): |
| + indices.add(0) |
| + elif o in ('-i', '--in'): |
| + indices.add(1) |
| + elif o in ('-o', '--out'): |
| + indices.add(2) |
| + elif o in ('-p', '--product_dir'): |
| + product_dir = a |
| + elif o in ('-v', '--verbose'): |
| + verbose = 1 |
| + elif o in ('-n', '--impotent'): |
| + impotent = 1 |
| + |
| +if len(indices): |
| + for rule in rules: |
| + for index in sorted(indices): |
| + print rule[index], |
| +else: |
| + if not len(product_dir): |
| + product_dir = os.path.dirname(os.path.dirname(sys.argv[0])) |
| + product_dir = os.path.join(product_dir, 'out','Debug') |
| + v8_shell = os.path.join(product_dir, 'v8_shell') |
| + jsfilename = args[0] |
| + for rule in rules: |
| + arguments = [jsfilename, rule[0], rule[1], os.path.basename(rule[1])] |
| + arguments = "arguments=" + json.dumps(arguments) |
| + cmd = [v8_shell, '-e', arguments, jsfilename] |
| + if verbose or impotent: |
| + print cmd |
| + if not impotent: |
| + subprocess.call(cmd, stdout=open(rule[2],'w+')) |
|
nsylvain
2011/06/12 21:13:19
I guess you should sys.exit(x) the return value of
Sheridan Rawlins
2011/06/13 15:40:44
Done.
|