Include all dupe types (event when value is zero) in scan stats.
[chromium-blink-merge.git] / mandoline / tools / android_run_mandoline.py
blobd5540a4854fd9cf7ad414d0c27bb1634a7e2e76b
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
17 USAGE = ("android_run_mandoline.py [<shell-and-app-args>] [<mojo-app>]")
19 def main():
20 logging.basicConfig()
22 parser = argparse.ArgumentParser(usage=USAGE)
24 debug_group = parser.add_mutually_exclusive_group()
25 debug_group.add_argument('--debug', help='Debug build (default)',
26 default=True, action='store_true')
27 debug_group.add_argument('--release', help='Release build', default=False,
28 dest='debug', action='store_false')
29 parser.add_argument('--target-cpu', help='CPU architecture to run for.',
30 choices=['x64', 'x86', 'arm'], default='arm')
31 parser.add_argument('--device', help='Serial number of the target device.')
32 parser.add_argument('--gdb', help='Run gdb',
33 default=False, action='store_true')
34 runner_args, args = parser.parse_known_args()
36 config = Config(target_os=Config.OS_ANDROID,
37 target_cpu=runner_args.target_cpu,
38 is_debug=runner_args.debug,
39 apk_name="Mandoline.apk")
40 shell = AndroidShell(config)
41 args.extend(shell.PrepareShellRun(None, runner_args.device, runner_args.gdb))
43 shell.CleanLogs()
44 p = shell.ShowLogs()
45 shell.StartShell(args, sys.stdout, p.terminate, runner_args.gdb)
46 return 0
49 if __name__ == "__main__":
50 sys.exit(main())