blob: 3def5f705cf3cba404f86950c5fafc9fa3a49245 [file] [log] [blame] [view]
andybons3322f762015-08-24 21:37:091# Introduction
2
3When you call `$SRC/build/android/run_tests.py` or `$SRC/build/android/run_instrumentation_tests.py` it assumes an android device is attached to the local host.
4
5If you want to work remotely from your laptop with an android device attached to it, while keeping an ssh connection to a remote desktop machine where you have your build environment setup, you will have to use one of the two alternatives listed below.
6
7
8# Option 1: SSHFS - Mounting the out/Debug directory
9
10### On your remote host machine
11(_you can open a regular ssh to your host_)
12```
13# build it
14desktop$ cd $SRC;
15desktop$ . build/android/envsetup.sh
16desktop$ build/gyp_chromium -DOS=android
17desktop$ ninja -C out/Debug
18```
19(see also AndroidBuildInstructions).
20
21
22### On your laptop
23(_you have to have an android device attached to it_)
24```
25# Install sshfs
26laptop$ sudo apt-get install sshfs
27
28# Mount the chrome source from your remote host machine into your local laptop.
29laptop$ mkdir ~/chrome_sshfs
30laptop$ sshfs your.host.machine:/usr/local/code/chrome/src ./chrome_sshfs
31
32# Setup enviroment.
33laptop$ cd chrome_sshfs
34laptop$ . build/android/envsetup.sh
35laptop$ adb devices
36laptop$ adb root
37
38# Install APK (which was previously built in the host machine).
39laptop$ python build/android/adb_install_apk.py --apk ContentShell.apk --apk_package org.chromium.content_shell
40
41# Run tests.
42laptop$ python build/android/run_instrumentation_tests.py -I --test-apk ContentShellTest -vvv
43```
44
45**This is assuming you have the exact same linux version on your host machine and in your laptop.**
46
47But if you have different versions, lets say, ubuntu lucid on your laptop, and the newer ubuntu precise on your host machine, some binaries compiled on the host will not work on your laptop.
48In this case you will have to recompile these binaries in your laptop:
49```
50# May need to install dependencies on your laptop.
51laptop$ sudo ./build/install-build-deps-android.sh
52
53# Rebuild the needed binaries on your laptop.
54laptop$ build/gyp_chromium -DOS=android
55laptop$ ninja -C out/Debug md5sum host_forwarder
56```
57
58
59# Option 2: SSH Tunneling
60
61## Option 2a: Use a script
62
63Copy src/tools/android/adb\_remote\_setup.sh to your laptop, then run it. adb\_remote\_setup.sh updates itself, so you only need to copy it once.
64
65```
66laptop$ curl "http://src.chromium.org/svn/trunk/src/tools/android/adb_remote_setup.sh" > adb_remote_setup.sh
67laptop$ chmod +x adb_remote_setup.sh
68laptop$ ./adb_remote_setup.sh <desktop_hostname> <path_to_adb_on_desktop>
69```
70
71## Option 2b: Manual tunneling
72
73You have to make sure that ports 5037, 10000, ad 10201 are not being used on either your laptop or your desktop.
74Try the command: `netstat -nap | grep 10000` to see
75
76Kill the pids that are using those ports.
77
78### On your host machine
79```
80desktop$ killall adb
81desktop$ killall host_forwarder
82```
83
84### On your laptop
85```
86laptop$ ssh -C -R 5037:localhost:5037 -R 10000:localhost:10000 -R 10201:localhost:10201 <desktop_host_name>
87```
88
89### On your host machine
90```
91desktop$ python build/android/run_instrumentation_tests.py -I --test-apk ContentShellTest -vvv
92```