Returning scoped_ptr instead of raw pointer in QuicInfoToValue in net/
[chromium-blink-merge.git] / mandoline / tools / android_run_mandoline.py
blobf0481a3152f3cf19aad2d189a6f575a5c4f1bd9a
1 #!/usr/bin/env python
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
4 # found in the LICENSE file.
6 import argparse
7 import logging
8 import os
9 import sys
11 sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(__file__)),
12 '../../mojo/tools'))
14 from mopy.android import AndroidShell
15 from mopy.config import Config
16 from mopy.paths import Paths
18 USAGE = ("android_run_mandoline.py [<shell-and-app-args>] [<mojo-app>]")
20 def main():
21 logging.basicConfig()
23 parser = argparse.ArgumentParser(usage=USAGE)
25 debug_group = parser.add_mutually_exclusive_group()
26 debug_group.add_argument('--debug', help='Debug build (default)',
27 default=True, action='store_true')
28 debug_group.add_argument('--release', help='Release build', default=False,
29 dest='debug', action='store_false')
30 parser.add_argument('--target-cpu', help='CPU architecture to run for.',
31 choices=['x64', 'x86', 'arm'], default='arm')
32 parser.add_argument('--target-device', help='Device to run on.')
33 parser.add_argument('--dont-install',
34 help='Disables installing the apk',
35 default=False, action='store_true')
36 parser.add_argument('--gdb', help='Run gdb',
37 default=False, action='store_true')
38 launcher_args, args = parser.parse_known_args()
40 config = Config(target_os=Config.OS_ANDROID,
41 target_cpu=launcher_args.target_cpu,
42 is_debug=launcher_args.debug,
43 apk_name="Mandoline.apk")
44 paths = Paths(config)
45 shell = AndroidShell(paths.apk_path, paths.build_dir, paths.adb_path,
46 launcher_args.target_device,
47 target_package='org.chromium.mandoline',
48 src_root=paths.src_root)
50 extra_shell_args = shell.PrepareShellRun(
51 install=not launcher_args.dont_install, gdb=launcher_args.gdb)
52 args.extend(extra_shell_args)
54 shell.CleanLogs()
55 p = shell.ShowLogs()
56 shell.StartShell(args, sys.stdout, p.terminate, launcher_args.gdb)
57 return 0
60 if __name__ == "__main__":
61 sys.exit(main())