Debian Codegraph @

tools/skqp/run_apk.sh

raw
1 #! /bin/sh
2 # Copyright 2019 Google LLC.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 # Note:
7 # The ANDROID_SERIAL, SKQP_ARGS, and SKQP_SLEEP environment variables affect
8 # this script.
9
10 if ! [ -f "$1" ] || ! [ -d "$2" ] ; then
11 echo "Usage: $0 SKQP_APK_FILE_PATH RESULTS_DIRECTORY" >&2
12 exit 1
13 fi
14
15 SED_CMD='s/^.* org.skia.skqp: output written to "\([^"]*\)".*$/\1/p'
16 APK="$1"
17 DST="$2"
18
19 printf '\n\nAPK = "%s"\nDST = "%s"\n\n' "$APK" "$DST"
20
21 set -x
22
23 adb wait-for-device || exit 1
24
25 sleep ${SKQP_SLEEP:-0}
26
27 adb uninstall org.skia.skqp > /dev/null 2>&1
28
29 adb install "$APK" || exit 1
30
31 adb logcat -c
32
33 adb shell am instrument $SKQP_ARGS -w org.skia.skqp 2>&1 | tee "$DST"/stdout
34
35 adb logcat -d TestRunner org.skia.skqp skia DEBUG '*:S' > "$DST"/logcat
36
37 ODIR="$(sed -n "$SED_CMD" "$DST"/logcat | head -1)"
38
39 if adb shell "test -d '$ODIR'"; then adb pull "$ODIR" "$DST"; fi