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

Side by Side Diff: mojo/devtools/common/mojo_run

Issue 1259243003: Allow to pass additional shell arguments in `mojo_test`. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | mojo/devtools/common/mojo_test » ('j') | 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 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 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 import argparse 6 import argparse
7 import logging 7 import logging
8 import sys 8 import sys
9 9
10 from devtoolslib import paths 10 from devtoolslib import paths
11 from devtoolslib import shell_arguments 11 from devtoolslib import shell_arguments
12 12
13 USAGE = ("mojo_run " 13 _USAGE = ("mojo_run "
14 "[--args-for=<mojo-app>] " 14 "[--args-for=<mojo-app>] "
15 "[--content-handlers=<handlers>] " 15 "[--content-handlers=<handlers>] "
16 "[--enable-external-applications] " 16 "[--enable-external-applications] "
17 "[--disable-cache] " 17 "[--disable-cache] "
18 "[--enable-multiprocess] " 18 "[--enable-multiprocess] "
19 "[<mojo-app>] " 19 "[<mojo-app>] "
20 """ 20 """
21 21
22 A <mojo-app> is a Mojo URL or a Mojo URL and arguments within quotes. 22 A <mojo-app> is a Mojo URL or a Mojo URL and arguments within quotes.
23 Example: mojo_run "mojo:js_standalone test.js". 23 Example: mojo_run "mojo:js_standalone test.js".
24 <url-lib-path> is searched for shared libraries named by mojo URLs. 24 <url-lib-path> is searched for shared libraries named by mojo URLs.
25 The value of <handlers> is a comma separated list like: 25 The value of <handlers> is a comma separated list like:
26 text/html,mojo:html_viewer,application/javascript,mojo:js_content_handler 26 text/html,mojo:html_viewer,application/javascript,mojo:js_content_handler
27 """) 27 """)
28 28
29 _DESCRIPTION = """Runner for Mojo applications.
30
31 Any arguments not recognized by the script will be passed on as shell arguments.
32 """
33
29 34
30 # Port on which the mojo:debugger http server will be available on the host 35 # Port on which the mojo:debugger http server will be available on the host
31 # machine. 36 # machine.
32 _MOJO_DEBUGGER_PORT = 7777 37 _MOJO_DEBUGGER_PORT = 7777
33 38
34 _DEFAULT_WINDOW_MANAGER = "mojo:kiosk_wm" 39 _DEFAULT_WINDOW_MANAGER = "mojo:kiosk_wm"
35 40
36 41
37 def _ConfigureDebugger(shell): 42 def _ConfigureDebugger(shell):
38 """Configures mojo:debugger to run and sets up port forwarding for its http 43 """Configures mojo:debugger to run and sets up port forwarding for its http
39 server if the shell is running on a device. 44 server if the shell is running on a device.
40 45
41 Returns: 46 Returns:
42 Arguments that need to be appended to the shell argument list in order to 47 Arguments that need to be appended to the shell argument list in order to
43 run with the debugger. 48 run with the debugger.
44 """ 49 """
45 shell.ForwardHostPortToShell(_MOJO_DEBUGGER_PORT) 50 shell.ForwardHostPortToShell(_MOJO_DEBUGGER_PORT)
46 return ['mojo:debugger %d' % _MOJO_DEBUGGER_PORT] 51 return ['mojo:debugger %d' % _MOJO_DEBUGGER_PORT]
47 52
48 53
49 def main(): 54 def main():
50 logging.basicConfig() 55 logging.basicConfig()
51 56
52 parser = argparse.ArgumentParser(usage=USAGE) 57 parser = argparse.ArgumentParser(usage=_USAGE, description=_DESCRIPTION)
53 58
54 # Arguments allowing to indicate the configuration we are targeting when 59 # Arguments allowing to indicate the configuration we are targeting when
55 # running within a Chromium-like checkout. These will go away once we have 60 # running within a Chromium-like checkout. These will go away once we have
56 # devtools config files, see https://github.com/domokit/devtools/issues/28. 61 # devtools config files, see https://github.com/domokit/devtools/issues/28.
57 chromium_config_group = parser.add_argument_group('Chromium configuration', 62 chromium_config_group = parser.add_argument_group('Chromium configuration',
58 'These arguments allow to infer paths to tools and build results ' 63 'These arguments allow to infer paths to tools and build results '
59 'when running withing a Chromium-like checkout') 64 'when running withing a Chromium-like checkout')
60 debug_group = chromium_config_group.add_mutually_exclusive_group() 65 debug_group = chromium_config_group.add_mutually_exclusive_group()
61 debug_group.add_argument('--debug', help='Debug build (default)', 66 debug_group.add_argument('--debug', help='Debug build (default)',
62 default=True, action='store_true') 67 default=True, action='store_true')
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 131
127 if script_args.verbose: 132 if script_args.verbose:
128 print "Shell arguments: " + str(shell_args) 133 print "Shell arguments: " + str(shell_args)
129 134
130 shell.Run(shell_args) 135 shell.Run(shell_args)
131 return 0 136 return 0
132 137
133 138
134 if __name__ == "__main__": 139 if __name__ == "__main__":
135 sys.exit(main()) 140 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | mojo/devtools/common/mojo_test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698