skia2/tools/skqp/run_apk.sh
Derek Sollenberger 3034776433 Cleanup SkQP build scripts
Change-Id: Ie226bc605baad4788976ad4c37dc455d36b11793
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494136
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2022-01-31 15:43:48 +00:00

40 lines
929 B
Bash
Executable File

#! /bin/sh
# Copyright 2019 Google LLC.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Note:
# The ANDROID_SERIAL, SKQP_ARGS, and SKQP_SLEEP environment variables affect
# this script.
if ! [ -f "$1" ] || ! [ -d "$2" ] ; then
echo "Usage: $0 SKQP_APK_FILE_PATH RESULTS_DIRECTORY" >&2
exit 1
fi
SED_CMD='s/^.* org.skia.skqp: output written to "\([^"]*\)".*$/\1/p'
APK="$1"
DST="$2"
printf '\n\nAPK = "%s"\nDST = "%s"\n\n' "$APK" "$DST"
set -x
adb wait-for-device || exit 1
sleep ${SKQP_SLEEP:-0}
adb uninstall org.skia.skqp > /dev/null 2>&1
adb install "$APK" || exit 1
adb logcat -c
adb shell am instrument $SKQP_ARGS -w org.skia.skqp 2>&1 | tee "$DST"/stdout
adb logcat -d TestRunner org.skia.skqp skia DEBUG '*:S' > "$DST"/logcat
ODIR="$(sed -n "$SED_CMD" "$DST"/logcat | head -1)"
if adb shell "test -d '$ODIR'"; then adb pull "$ODIR" "$DST"; fi