summaryrefslogtreecommitdiffstats
path: root/gfx/wr/wrench/android.txt
blob: 35f5863c91dc675369d8f60e763209883943245d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
Running Wrench on Android devices.
==================================

Setting up the environment:
---------------------------

Follow the steps at https://github.com/rust-windowing/android-rs-glue#setting-up-your-environment, with exceptions:
    - No need to download the Android NDK and SDK, we will use the ones downloaded by Gecko in ~/.mozbuild/

    - Install both the i686-linux-android and armv7-linux-androideabi rust
      targets, as the APK will include native libraries with both architectures.

    - Don't install currently published version of cargo-apk as it doesn't work with the
      version of winit and glutin we are using.
      Instead, install the git master version of our fork like so:
        cargo install --git https://github.com/jamienicol/android-rs-glue cargo-apk

    - Consider adding ~/.mozbuild/android-sdk-linux/platform-tools to your path, for the adb commands below.

Compiling and running:
----------------------

    Compile wrench:
        cd wrench
        export ANDROID_HOME=$HOME/.mozbuild/android-sdk-linux # exact path may vary
        export NDK_HOME=$HOME/.mozbuild/android-ndk-r17b      # exact path may vary
        cargo apk build

    Install the APK:
        adb install -r ../target/android-artifacts/debug/apk/wrench.apk

    Set command line arguments and env vars for wrench:
        adb shell
        mkdir /sdcard/wrench
        echo "load reftests/aa/rounded-rects.yaml" >/sdcard/wrench/args
        echo "env: WRENCH_REFTEST_CONDITION_EMULATOR=1" >>/sdcard/wrench/args # If you're using the emulator
        echo "env: WRENCH_REFTEST_CONDITION_DEVICE=1" >>/sdcard/wrench/args # If you're using a device
        exit

    Push reftests (if you need these files for what you're doing):
        adb push reftests /sdcard/wrench/

    Run the application:
        adb shell am start -n org.mozilla.wrench/android.app.NativeActivity
            (or click the icon in the launcher)

Release mode:
-------------

    Building in release does work as well. Use the following steps to compile wrench:
        cd wrench
        export ANDROID_HOME=$HOME/.mozbuild/android-sdk-linux # exact path may vary
        export NDK_HOME=$HOME/.mozbuild/android-ndk           # exact path may vary
        cargo apk build --release

    Now the APK at ../target/android-artifacts/release/apk/wrench.apk
    should be signed and installable (you may need to uninstall the debug APK first if you
    have that installed).

Running reftests like a boss (on a local emulator):
---------------------------------------------------

    First, compile wrench as described above (debug mode).
    Then, from the root gecko source dir, run:
        ./mach python testing/mozharness/scripts/android_wrench.py --config testing/mozharness/configs/android/wrench.py
    This will automatically do the following:
        - Download the blessed android AVDs from taskcluster
        - Start the emulator (using your ~/.mozbuild/android-sdk-linux emulator binaries)
        - Install the debug APK (from gfx/wr/wrench/target/android-artifacts/debug/apk/wrench.apk)
        - Copy the reftests to the sdcard
        - Write an args file to the sdcard
        - Run wrench
        - Wait for wrench to finish running
        - Scrape the logcat for reftest output
    Other logs (e.g. full logcat) can be found in your ~/.wrench/logs folder. Note that
    this will also leave the android emulator running, so repeating the command will be
    even faster the next time around as it won't need to redownload the AVDs or restart
    the emulator. It will reinstall the APK and re-push the reftests folder though.

    If you want to use a release APK (runs much faster), build it as per the "Release mode"
    instructions above and set the WRENCH_APK env var to point to the APK:
    to point to it:
        export WRENCH_APK=gfx/wr/target/android-artifacts/release/apk/wrench.apk
        ./mach python testing/mozharness/scripts/android_wrench.py --config testing/mozharness/configs/android/wrench.py

Running reftests like a boss (on a local device):
-------------------------------------------------

    Same steps as running on a local emulator, except you need to do this:
        export DEVICE_SERIAL=<your device's serial>
    before running the `./mach python` command. You can get the serial of
    your device by running `adb devices` with the device plugged in. When running
    on a device, the android_emulator_wrench.py script will skip the steps to
    download the AVDs and start the emulator.