2018-08-23 18:50:07 +00:00
|
|
|
#! /bin/sh
|
|
|
|
# Copyright 2018 Google LLC.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
# If you have more than one device attached, run `adb devices -l` and then set
|
|
|
|
# the ANDROID_SERIAL environment variable to the correct serial number.
|
|
|
|
|
|
|
|
APK="$1"
|
|
|
|
shift
|
|
|
|
|
|
|
|
if ! [ -f "$APK" ]; then
|
|
|
|
cat >&2 <<- EOM
|
|
|
|
|
|
|
|
Usage:
|
|
|
|
$0 SKQP_APK_FILE_PATH [OPTIONAL_TESTS_TO_RUN...]
|
|
|
|
|
|
|
|
e.g.:
|
|
|
|
$0 skqp-universal-debug.apk
|
|
|
|
or:
|
|
|
|
$0 skqp-universal-debug.apk vk_hairmodes gles_gammatext gles_aarectmodes
|
|
|
|
|
|
|
|
EOM
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
ARGS=''
|
2018-11-26 19:07:41 +00:00
|
|
|
if [ "$#" -gt 0 ]; then
|
2018-08-23 18:50:07 +00:00
|
|
|
ARGS="-e class org.skia.skqp.SkQPRunner#${1}"
|
|
|
|
shift
|
|
|
|
for arg; do
|
|
|
|
ARGS="${ARGS},org.skia.skqp.SkQPRunner#${arg}"
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
TDIR="$(mktemp -d "${TMPDIR:-/tmp}/skqp_report.XXXXXXXXXX")"
|
|
|
|
|
|
|
|
adb install -r "$APK" || exit 2
|
|
|
|
adb logcat -c
|
|
|
|
|
2018-11-26 19:07:41 +00:00
|
|
|
adb logcat TestRunner org.skia.skqp skia DEBUG "*:S" | tee "${TDIR}/logcat.txt" &
|
2018-08-23 18:50:07 +00:00
|
|
|
LOGCAT_PID=$!
|
|
|
|
|
|
|
|
ADBSHELL_PID=''
|
|
|
|
trap 'kill $LOGCAT_PID; kill $ADBSHELL_PID' INT
|
|
|
|
|
2018-11-26 19:07:41 +00:00
|
|
|
printf '\n%s\n\n' "adb shell am instrument $ARGS -w org.skia.skqp"
|
2018-08-23 18:50:07 +00:00
|
|
|
adb shell am instrument $ARGS -w org.skia.skqp \
|
|
|
|
> "${TDIR}/stdout.txt" \
|
|
|
|
2> "${TDIR}/stderr.txt" &
|
|
|
|
ADBSHELL_PID=$!
|
|
|
|
|
|
|
|
wait $ADBSHELL_PID
|
|
|
|
trap - INT
|
|
|
|
kill $LOGCAT_PID
|
|
|
|
|
|
|
|
printf '\nTEST OUTPUT IS IN: "%s"\n\n' "$TDIR"
|
|
|
|
|
2018-11-26 19:07:41 +00:00
|
|
|
SED_CMD='s/^.* org.skia.skqp: output written to "\([^"]*\)".*$/\1/p'
|
|
|
|
ODIR="$(sed -n "$SED_CMD" "${TDIR}/logcat.txt" | head -1)"
|
2018-08-23 18:50:07 +00:00
|
|
|
|
|
|
|
if ! adb shell "test -d '$ODIR'" ; then
|
|
|
|
echo 'missing output :('
|
|
|
|
exit 3
|
|
|
|
fi
|
|
|
|
|
2018-11-26 19:07:41 +00:00
|
|
|
odir_basename="$(basename "$ODIR")"
|
|
|
|
|
|
|
|
adb pull "${ODIR}" "${TDIR}/${odir_basename}"
|
2018-08-23 18:50:07 +00:00
|
|
|
|
2018-11-26 19:07:41 +00:00
|
|
|
REPORT="${TDIR}/${odir_basename}/report.html"
|
|
|
|
|
|
|
|
if [ -f "$REPORT" ]; then
|
|
|
|
grep 'f(.*;' "$REPORT"
|
|
|
|
echo "$REPORT"
|
2018-12-05 16:58:05 +00:00
|
|
|
"$(dirname "$0")"/../../bin/sysopen "$REPORT"
|
2018-11-26 19:07:41 +00:00
|
|
|
else
|
|
|
|
echo "$TDIR"
|
|
|
|
fi
|