run_in_headless_android_emulator: add support for $HOST_FILE

This commit is contained in:
Simon Sapin 2018-07-26 09:50:29 +02:00
parent 65df9cb73a
commit 4306336a5b
2 changed files with 16 additions and 1 deletions

View file

@ -54,6 +54,7 @@ def main(avd_name, apk_path, *args):
check_call(adb + ["install", "-r", apk_path])
args = list(args)
write_user_stylesheets(adb, args)
write_hosts_file(adb)
write_args(adb, args)
check_call(adb + ["shell", "am start com.mozilla.servo/com.mozilla.servo.MainActivity"],
@ -143,6 +144,15 @@ def write_user_stylesheets(adb, args):
check_call(adb + ["push", path, remote_path], stdout=sys.stderr)
def write_hosts_file(adb):
hosts_file = os.environ.get("HOST_FILE")
if hosts_file:
data_dir = "/sdcard/Android/data/com.mozilla.servo/files"
check_call(adb + ["shell", "mkdir -p %s" % data_dir])
remote_path = data_dir + "/android_hosts"
check_call(adb + ["push", hosts_file, remote_path], stdout=sys.stderr)
def forward_webdriver(adb, args):
webdriver_port = extract_arg("--webdriver", args)
if webdriver_port is not None: