Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/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 """ | 6 """ |
| 7 cr_cronet.py - cr - like helper tool for cronet developers | 7 cr_cronet.py - cr - like helper tool for cronet developers |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import argparse | 10 import argparse |
| 11 import os | 11 import os |
| 12 import sys | 12 import sys |
| 13 | 13 |
| 14 | 14 |
| 15 def run(command, extra_options=''): | 15 def run(command, extra_options=''): |
| 16 command = command + ' ' + extra_options | 16 command = command + ' ' + extra_options |
| 17 print command | 17 print command |
| 18 return os.system(command) | 18 return os.system(command) |
| 19 | 19 |
| 20 | 20 |
| 21 def build(out_dir, extra_options=''): | 21 def build(out_dir, extra_options=''): |
| 22 return run('ninja -C ' + out_dir + ' cronet_test_instrumentation_apk', | 22 return run('ninja -C ' + out_dir + ' cronet_test_instrumentation_apk', |
| 23 extra_options) | 23 extra_options) |
| 24 | 24 |
| 25 | 25 |
| 26 def install(release_arg): | 26 def install(release_arg): |
| 27 return run('build/android/adb_install_apk.py ' + release_arg + \ | 27 return run('build/android/adb_install_apk.py ' + release_arg + \ |
| 28 ' --apk=CronetTest.apk') | 28 ' --apk=CronetTest.apk') or \ |
|
xunjieli
2016/04/06 13:10:04
I don't really know Python. Should this be "and" i
pauljensen
2016/04/06 13:12:53
run() returns the return code, so 0 is success, so
xunjieli
2016/04/06 13:14:37
Ah, that makes sense. Thanks.
| |
| 29 run('build/android/adb_install_apk.py ' + release_arg + \ | |
| 30 ' --apk=ChromiumNetTestSupport.apk') | |
| 29 | 31 |
| 30 | 32 |
| 31 def test(release_arg, extra_options): | 33 def test(release_arg, extra_options): |
| 32 return run('build/android/test_runner.py instrumentation '+ \ | 34 return run('build/android/test_runner.py instrumentation '+ \ |
| 33 release_arg + ' --test-apk=CronetTestInstrumentation' + \ | 35 release_arg + ' --test-apk=CronetTestInstrumentation' + \ |
| 34 ' --fast-local-dev', | 36 ' --fast-local-dev', |
| 35 extra_options) | 37 extra_options) |
| 36 | 38 |
| 37 | 39 |
| 38 def debug(extra_options): | 40 def debug(extra_options): |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 return install(release_arg) or debug(extra_options) | 107 return install(release_arg) or debug(extra_options) |
| 106 if (options.command=='build-debug'): | 108 if (options.command=='build-debug'): |
| 107 return build(out_dir) or install(release_arg) or debug(extra_options) | 109 return build(out_dir) or install(release_arg) or debug(extra_options) |
| 108 | 110 |
| 109 parser.print_help() | 111 parser.print_help() |
| 110 return 1 | 112 return 1 |
| 111 | 113 |
| 112 | 114 |
| 113 if __name__ == '__main__': | 115 if __name__ == '__main__': |
| 114 sys.exit(main()) | 116 sys.exit(main()) |
| OLD | NEW |