Commit 2fed30a3 authored by Paul Jensen's avatar Paul Jensen Committed by Commit Bot

[Cronet] Fix and simplify cr_cronet.py APK install

It seems to have stopped working recently; this fixes it.

Also, fix a pylint presubmit failure that looks like it started
with crrev.com/465016

Cq-Include-Trybots: master.tryserver.chromium.android:android_cronet_tester
Change-Id: I277083b181fed4f5491f11e551175f37ba9b38a3
Reviewed-on: https://chromium-review.googlesource.com/598115Reviewed-by: default avatarMiriam Gershenson <mgersh@chromium.org>
Commit-Queue: Paul Jensen <pauljensen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491413}
parent 485965a9
......@@ -54,8 +54,8 @@ REPOSITORY_ROOT = os.path.abspath(os.path.join(
os.path.dirname(__file__), '..', '..', '..', '..', '..'))
sys.path.append(os.path.join(REPOSITORY_ROOT, 'tools', 'perf'))
from chrome_telemetry_build import chromium_config
sys.path.append(chromium_config.GetTelemetryDir())
from core import path_util
sys.path.append(path_util.GetTelemetryDir())
sys.path.append(os.path.join(REPOSITORY_ROOT, 'build', 'android'))
sys.path.append(os.path.join(
REPOSITORY_ROOT, 'third_party', 'catapult', 'devil'))
......
......@@ -22,11 +22,10 @@ def build(out_dir, test_target, extra_options=''):
extra_options)
def install(out_dir, release_arg):
cmd = 'BUILDTYPE={0} build/android/adb_install_apk.py {1} --apk={2}'
build_dir = out_dir.split('/', 1)[1] # the 'Foo' part of 'out/Foo'
return run(cmd.format(build_dir, release_arg, 'CronetTest.apk')) or \
run(cmd.format(build_dir, release_arg, 'ChromiumNetTestSupport.apk'))
def install(out_dir):
cmd = 'build/android/adb_install_apk.py ' + out_dir + '/apks/{0}'
return run(cmd.format('CronetTest.apk')) or \
run(cmd.format('ChromiumNetTestSupport.apk'))
def test(out_dir, extra_options):
......@@ -114,11 +113,9 @@ def main():
if options.release:
out_dir = 'out/Release' + out_dir_suffix
release_arg = ' --release'
gn_args += ' is_debug=false is_official_build=true '
else:
out_dir = 'out/Debug' + out_dir_suffix
release_arg = ''
if options.out_dir:
out_dir = options.out_dir
......@@ -131,20 +128,20 @@ def main():
return build(out_dir, test_target, extra_options)
if (not is_os):
if (options.command=='install'):
return install(out_dir, release_arg)
return install(out_dir)
if (options.command=='proguard'):
return run ('ninja -C ' + out_dir + ' cronet_sample_proguard_apk')
if (options.command=='test'):
return install(out_dir, release_arg) or test(out_dir, extra_options)
return install(out_dir) or test(out_dir, extra_options)
if (options.command=='build-test'):
return build(out_dir, test_target) or install(out_dir, release_arg) or \
return build(out_dir, test_target) or install(out_dir) or \
test(out_dir, extra_options)
if (options.command=='stack'):
return stack(out_dir)
if (options.command=='debug'):
return install(out_dir, release_arg) or debug(extra_options)
return install(out_dir) or debug(extra_options)
if (options.command=='build-debug'):
return build(out_dir, test_target) or install(out_dir, release_arg) or \
return build(out_dir, test_target) or install(out_dir) or \
debug(extra_options)
else:
if (options.command=='test'):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment