Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Introduction | 1 # Working remotely with Android |
| 2 | 2 |
| 3 When you call `$SRC/build/android/run_tests.py` or `$SRC/build/android/run_instr umentation_tests.py` it assumes an android device is attached to the local host. | 3 [TOC] |
| 4 | |
| 5 If 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 l isted below. | |
| 6 | 4 |
| 7 | 5 |
| 8 # Option 1: SSHFS - Mounting the out/Debug directory | 6 ## Introduction |
| 7 | |
| 8 When you call /build/android/run_tests.py or | |
| 9 /build/android/run_instrumentation_tests.py it assumes an android device | |
| 10 is attached to the local host. | |
| 11 | |
| 12 TODO: these scripts do not exist. | |
|
nodir
2015/08/24 23:32:15
not sure what to do with this
Bons
2015/08/25 00:37:58
let's keep these in TODOs and follow up after the
nodir
2015/08/25 14:45:03
Acknowledged.
| |
| 13 | |
| 14 If you want to work remotely from your laptop with an android device attached to | |
| 15 it, while keeping an ssh connection to a remote desktop machine where you have | |
| 16 your build environment setup, you will have to use one of the two alternatives | |
| 17 listed below. | |
| 18 | |
| 19 ## Option 1: SSHFS - Mounting the out/Debug directory | |
| 9 | 20 |
| 10 ### On your remote host machine | 21 ### On your remote host machine |
| 11 (_you can open a regular ssh to your host_) | |
| 12 ``` | |
| 13 # build it | |
| 14 desktop$ cd $SRC; | |
| 15 desktop$ . build/android/envsetup.sh | |
| 16 desktop$ build/gyp_chromium -DOS=android | |
| 17 desktop$ ninja -C out/Debug | |
| 18 ``` | |
| 19 (see also AndroidBuildInstructions). | |
| 20 | 22 |
| 23 You can open a regular ssh to your host. | |
| 24 | |
| 25 # build it | |
| 26 desktop$ cd $SRC; | |
| 27 desktop$ . build/android/envsetup.sh | |
| 28 desktop$ build/gyp_chromium -DOS=android | |
| 29 desktop$ ninja -C out/Debug | |
| 30 | |
| 31 See also | |
| 32 [Android Build Instructions](https://www.chromium.org/developers/how-tos/android -build-instructions). | |
| 21 | 33 |
| 22 ### On your laptop | 34 ### On your laptop |
| 23 (_you have to have an android device attached to it_) | |
| 24 ``` | |
| 25 # Install sshfs | |
| 26 laptop$ sudo apt-get install sshfs | |
| 27 | 35 |
| 28 # Mount the chrome source from your remote host machine into your local laptop. | 36 You have to have an android device attached to it. |
| 29 laptop$ mkdir ~/chrome_sshfs | |
| 30 laptop$ sshfs your.host.machine:/usr/local/code/chrome/src ./chrome_sshfs | |
| 31 | 37 |
| 32 # Setup enviroment. | 38 # Install sshfs |
| 33 laptop$ cd chrome_sshfs | |
| 34 laptop$ . build/android/envsetup.sh | |
| 35 laptop$ adb devices | |
| 36 laptop$ adb root | |
| 37 | 39 |
| 38 # Install APK (which was previously built in the host machine). | 40 laptop$ sudo apt-get install sshfs |
| 39 laptop$ python build/android/adb_install_apk.py --apk ContentShell.apk --apk_pac kage org.chromium.content_shell | |
| 40 | 41 |
| 41 # Run tests. | 42 # Mount the chrome source from your remote host machine into your local lapt op. |
| 42 laptop$ python build/android/run_instrumentation_tests.py -I --test-apk ContentS hellTest -vvv | |
| 43 ``` | |
| 44 | 43 |
| 45 **This is assuming you have the exact same linux version on your host machine an d in your laptop.** | 44 laptop$ mkdir ~/chrome_sshfs |
| 45 laptop$ sshfs your.host.machine:/usr/local/code/chrome/src ./chrome_sshfs | |
| 46 | |
| 47 # Setup enviroment. | |
| 48 | |
| 49 laptop$ cd chrome_sshfs | |
| 50 laptop$ . build/android/envsetup.sh | |
| 51 laptop$ adb devices | |
| 52 laptop$ adb root | |
| 53 | |
| 54 # Install APK (which was previously built in the host machine). | |
| 55 | |
| 56 laptop$ python build/android/adb_install_apk.py --apk ContentShell.apk --apk _package org.chromium.content_shell | |
| 57 | |
| 58 # Run tests. | |
| 59 | |
| 60 laptop$ python build/android/run_instrumentation_tests.py -I --test-apk Cont entShellTest -vvv | |
| 61 | |
| 62 *** note | |
| 63 This is assuming you have the exact same linux version on your host machine and | |
| 64 in your laptop. | |
| 65 *** | |
| 46 | 66 |
| 47 But if you have different versions, lets say, ubuntu lucid on your laptop, and t he newer ubuntu precise on your host machine, some binaries compiled on the host will not work on your laptop. | 67 But if you have different versions, lets say, ubuntu lucid on your laptop, and t he newer ubuntu precise on your host machine, some binaries compiled on the host will not work on your laptop. |
| 48 In this case you will have to recompile these binaries in your laptop: | 68 In this case you will have to recompile these binaries in your laptop: |
| 49 ``` | |
| 50 # May need to install dependencies on your laptop. | |
| 51 laptop$ sudo ./build/install-build-deps-android.sh | |
| 52 | 69 |
| 53 # Rebuild the needed binaries on your laptop. | 70 # May need to install dependencies on your laptop. |
| 54 laptop$ build/gyp_chromium -DOS=android | |
| 55 laptop$ ninja -C out/Debug md5sum host_forwarder | |
| 56 ``` | |
| 57 | 71 |
| 72 laptop$ sudo ./build/install-build-deps-android.sh | |
| 58 | 73 |
| 59 # Option 2: SSH Tunneling | 74 # Rebuild the needed binaries on your laptop. |
| 60 | 75 |
| 61 ## Option 2a: Use a script | 76 laptop$ build/gyp_chromium -DOS=android |
| 77 laptop$ ninja -C out/Debug md5sum host_forwarder | |
| 62 | 78 |
| 63 Copy src/tools/android/adb\_remote\_setup.sh to your laptop, then run it. adb\_r emote\_setup.sh updates itself, so you only need to copy it once. | 79 ## Option 2: SSH Tunneling |
| 64 | 80 |
| 65 ``` | 81 ### Option 2a: Use a script |
| 66 laptop$ curl "http://src.chromium.org/svn/trunk/src/tools/android/adb_remote_set up.sh" > adb_remote_setup.sh | |
| 67 laptop$ chmod +x adb_remote_setup.sh | |
| 68 laptop$ ./adb_remote_setup.sh <desktop_hostname> <path_to_adb_on_desktop> | |
| 69 ``` | |
| 70 | 82 |
| 71 ## Option 2b: Manual tunneling | 83 Copy /tools/android/adb_remote_setup.sh to your laptop, then run it. |
| 84 adb_remote_setup.sh updates itself, so you only need to copy it once. | |
| 72 | 85 |
| 73 You have to make sure that ports 5037, 10000, ad 10201 are not being used on eit her your laptop or your desktop. | 86 laptop$ curl "http://src.chromium.org/svn/trunk/src/tools/android/adb_remote _setup.sh" > adb_remote_setup.sh |
| 74 Try the command: `netstat -nap | grep 10000` to see | 87 laptop$ chmod +x adb_remote_setup.sh |
| 88 laptop$ ./adb_remote_setup.sh <desktop_hostname> <path_to_adb_on_desktop> | |
| 89 | |
| 90 ### Option 2b: Manual tunneling | |
| 91 | |
| 92 You have to make sure that ports 5037, 10000, ad 10201 are not being used on | |
| 93 either your laptop or your desktop. Try the command: `netstat -nap | grep 10000` | |
| 94 to see | |
| 75 | 95 |
| 76 Kill the pids that are using those ports. | 96 Kill the pids that are using those ports. |
| 77 | 97 |
| 78 ### On your host machine | 98 #### On your host machine |
| 79 ``` | |
| 80 desktop$ killall adb | |
| 81 desktop$ killall host_forwarder | |
| 82 ``` | |
| 83 | 99 |
| 84 ### On your laptop | 100 desktop$ killall adb |
| 85 ``` | 101 desktop$ killall host_forwarder |
| 86 laptop$ ssh -C -R 5037:localhost:5037 -R 10000:localhost:10000 -R 10201:localhos t:10201 <desktop_host_name> | |
| 87 ``` | |
| 88 | 102 |
| 89 ### On your host machine | 103 #### On your laptop |
| 90 ``` | 104 |
| 91 desktop$ python build/android/run_instrumentation_tests.py -I --test-apk Content ShellTest -vvv | 105 laptop$ ssh -C -R 5037:localhost:5037 -R 10000:localhost:10000 -R 10201:loca lhost:10201 <desktop_host_name> |
| 92 ``` | 106 |
| 107 #### On your host machine | |
| 108 | |
| 109 desktop$ python build/android/run_instrumentation_tests.py -I --test-apk Con tentShellTest -vvv | |
| OLD | NEW |