1SkQP
2====
3
4SkQP (Skia Quality Program) is a component of the Android CTS (Compatablity
5Test Suite) that tests an Android device's GPU and OpenGLES & Vulkan drivers
6using Skia's existing unit & rendering tests.
7
8See https://skia.org/dev/testing/skqp for pre-build APKs.
9
10How to build and run the SkQP tests
11-----------------------------------
12
131.  Get the dependencies:
14
15    -   You will need Java JDK 8, `git`, and `python`.
16
17    -   Install Chromium's [depot\_tools](http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html).  Add it to your `PATH`.
18
19            git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git'
20            export PATH="${PWD}/depot_tools:${PATH}"
21
22    -   Install the [Android NDK](https://developer.android.com/ndk/downloads/).
23
24            ( cd ~; unzip ~/Downloads/android-ndk-*.zip )
25            ANDROID_NDK=$(ls -d ~/android-ndk-*)   # Or wherever you installed the Android NDK.
26
27    -   Install the [Android SDK](https://developer.android.com/studio/#command-tools).
28        Set the `ANDROID_HOME` environment variable.
29
30            mkdir ~/android-sdk
31            ( cd ~/android-sdk; unzip ~/Downloads/sdk-tools-*.zip )
32            yes | ~/android-sdk/tools/bin/sdkmanager --licenses
33            export ANDROID_HOME=~/android-sdk  # Or wherever you installed the Android SDK.
34
35        Put `adb` in your `PATH`.
36
37            export PATH="${PATH}:${ANDROID_HOME}/platform-tools"
38
392.  Get the right version of Skia:
40
41        git clone https://skia.googlesource.com/skia.git
42        cd skia
43        git checkout origin/skqp/dev  # or whatever release tag you need
44
453.  Download dependencies and the model:
46
47        python tools/skqp/download_model
48        python tools/skqp/setup_resources
49        python tools/git-sync-deps
50
514.  Configure the build:
52
53        python tools/skqp/generate_gn_args out/skqp-arm "$ANDROID_NDK" \
54               --arch arm \
55               --api_level 26
56        bin/gn gen out/skqp-arm
57
58    If you want to test another architecture, replace `arm` with `x86`, `x64`
59    or `arm64`. Run 'python tools/skqp/generate_gn_args -h' for
60    all options.
61
625.  Build, install, and run.
63
64        platform_tools/android/bin/android_build_app -C out/skqp-arm skqp
65        adb install -r out/skqp-arm/skqp.apk
66        adb logcat -c
67        adb shell am instrument -w org.skia.skqp
68
696.  Monitor the output with:
70
71        adb logcat org.skia.skqp skia "*:S"
72
73    Note the test's output path on the device.  It will look something like this:
74
75        01-23 15:22:12.688 27158 27173 I org.skia.skqp:
76        output written to "/storage/emulated/0/Android/data/org.skia.skqp/files/output"
77
787.  Retrieve and view the report with:
79
80        OUTPUT_LOCATION="/storage/emulated/0/Android/data/org.skia.skqp/files/output"
81        adb pull $OUTPUT_LOCATION /tmp/
82        tools/skqp/sysopen.py /tmp/output/skqp_report/report.html
83
84Running a single test
85---------------------
86
87To run a single test, for example `gles/aarectmodes`:
88
89    adb shell am instrument -e class 'org.skia.skqp.SkQPRunner#gles/aarectmodes' -w org.skia.skqp
90
91Unit tests can be run with the `unitTest/` prefix:
92
93    adb shell am instrument -e class 'org.skia.skqp.SkQPRunner#unitTest/GrSurface -w org.skia.skqp
94
95Run as a non-APK executable
96---------------------------
97
981.  Follow steps 1-3 as above.
99
1002.  Build the SkQP program, load files on the device, and run skqp:
101
102        ninja -C out/skqp-arm skqp
103        python tools/skqp/run_skqp_exe out/skqp-arm
104
105