Kevin Lubick | 35b87a5 | 2018-10-08 15:07:42 -0400 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # Copyright 2018 Google LLC |
| 3 | # |
| 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
| 6 | # |
| 7 | # Assumes this is in a docker container with a skia repo mounted at /SRC and a folder containing the |
| 8 | # built APK to be in /OUT. |
| 9 | # Additionally, this assumes that the docker container was run to have an android emulator running |
| 10 | # that is accesible with adb. |
| 11 | # This script in particular doesn't care about arm vs x86, but the current incarnation has an x86 |
| 12 | # emulator and so the apk should be built for that. |
| 13 | # |
| 14 | # Example usage: |
| 15 | # |
| 16 | |
| 17 | set -ex |
| 18 | |
| 19 | # Wait for boot |
| 20 | timeout 60 adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done' |
| 21 | # Some extra sleep to make sure the emulator is awake and ready for installation |
| 22 | sleep 10 |
| 23 | |
Hal Canary | fa63421 | 2018-12-05 11:26:20 -0500 | [diff] [blame] | 24 | adb install -r /OUT/skqp-universal-debug.apk |
Kevin Lubick | 35b87a5 | 2018-10-08 15:07:42 -0400 | [diff] [blame] | 25 | adb logcat -c |
Hal Canary | 7600cb3 | 2018-11-09 10:22:20 -0500 | [diff] [blame] | 26 | |
| 27 | tmp_file="$(mktemp "${TMPDIR:-/tmp}/skqp.XXXXXXXXXX")" |
| 28 | |
| 29 | adb shell am instrument -w org.skia.skqp | tee "$tmp_file" | fold -s |
| 30 | |
Kevin Lubick | 35b87a5 | 2018-10-08 15:07:42 -0400 | [diff] [blame] | 31 | adb logcat -d TestRunner org.skia.skqp skia DEBUG "*:S" |
Hal Canary | 7600cb3 | 2018-11-09 10:22:20 -0500 | [diff] [blame] | 32 | |
Hal Canary | cc4f7eb | 2018-12-17 12:03:25 -0500 | [diff] [blame] | 33 | if ! grep -q '^OK ' "$tmp_file"; then |
| 34 | echo 'this test failed' |
| 35 | fi |
Hal Canary | 7600cb3 | 2018-11-09 10:22:20 -0500 | [diff] [blame] | 36 | |