Forward the Observatory port in sky_tool

Fixes #275

R=eseidel@chromium.org, eseidel@google.com

Review URL: https://codereview.chromium.org/1216283003.
This commit is contained in:
Adam Barth 2015-06-30 15:35:30 -07:00
parent 4dc4727536
commit aabc059e54

View File

@ -20,6 +20,7 @@ LIB_DIR = os.path.realpath(os.path.dirname(os.path.abspath(__file__)))
SKY_PACKAGE_ROOT = os.path.realpath(os.path.dirname(LIB_DIR))
SKY_SERVER_PORT = 9888
OBSERVATORY_PORT = 8181
APK_NAME = 'SkyDemo.apk'
ANDROID_PACKAGE = "org.domokit.sky.demo"
# FIXME: This assumes adb is in $PATH, we could look for ANDROID_HOME, etc?
@ -169,6 +170,12 @@ class StartSky(object):
subprocess.check_call([ADB_PATH, 'install', '-r', apk_path])
# Set up port forwarding for observatory
observatory_port_string = 'tcp:%s' % OBSERVATORY_PORT
subprocess.check_call([
ADB_PATH, 'forward', observatory_port_string, observatory_port_string
])
sky_server_port = SKY_SERVER_PORT
pids['sky_server_port'] = sky_server_port
if _port_in_use(sky_server_port):