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 10if ! [ -f "$1" ] || ! [ -d "$2" ] ; then 11 echo "Usage: $0 SKQP_APK_FILE_PATH RESULTS_DIRECTORY" >&2 12 exit 1 13fi 14 15SED_CMD='s/^.* org.skia.skqp: output written to "\([^"]*\)".*$/\1/p' 16APK="$1" 17DST="$2" 18 19printf '\n\nAPK = "%s"\nDST = "%s"\n\n' "$APK" "$DST" 20 21set -x 22 23timeout 60 adb wait-for-device || exit 1 24 25sleep ${SKQP_SLEEP:-0} 26 27adb uninstall org.skia.skqp > /dev/null 2>&1 28 29adb install "$APK" || exit 1 30 31adb logcat -c 32 33adb shell am instrument $SKQP_ARGS -w org.skia.skqp 2>&1 | tee "$DST"/stdout 34 35adb logcat -d TestRunner org.skia.skqp skia DEBUG '*:S' > "$DST"/logcat 36 37ODIR="$(sed -n "$SED_CMD" "$DST"/logcat | head -1)" 38 39if adb shell "test -d '$ODIR'"; then adb pull "$ODIR" "$DST"; fi 40