8ce5912fe3
This is an attempt to avoid downloading the android toolchain when not required. I went through all binaries listed in https://code.google.com/p/chromium/codesearch#chromium/build/scripts/slave/recipe_modules/skia/android_flavor.py except for android_ninja. BUG=skia:5119 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1832883002 Review URL: https://codereview.chromium.org/1832883002
74 lines
2.8 KiB
Bash
Executable File
74 lines
2.8 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# android_run_skia: starts the correct skia program on the device, prints the
|
|
# output, and kills the app if interrupted.
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
SKIP_TOOLCHAIN_SETUP="true"
|
|
source $SCRIPT_DIR/android_setup.sh
|
|
source $SCRIPT_DIR/utils/setup_adb.sh
|
|
|
|
if [ ! -f "${SKIA_OUT}/$BUILDTYPE/lib/lib${APP_ARGS[0]}.so" ];
|
|
then
|
|
echo "Unable to find $BUILDTYPE ${APP_ARGS[0]} library"
|
|
exit 1
|
|
fi
|
|
|
|
verbose "pushing binaries onto the device..."
|
|
adb_push_if_needed "${SKIA_OUT}/$BUILDTYPE/skia_launcher" /data/local/tmp
|
|
if [ -f "${SKIA_OUT}/$BUILDTYPE/lib/libskia_android.so" ]; then
|
|
# Does not exist for builds with static skia.
|
|
adb_push_if_needed "${SKIA_OUT}/$BUILDTYPE/lib/libskia_android.so" /data/local/tmp
|
|
fi
|
|
adb_push_if_needed "${SKIA_OUT}/$BUILDTYPE/lib/lib${APP_ARGS[0]}.so" /data/local/tmp
|
|
if [[ -n $RESOURCE_PATH ]]; then
|
|
verbose "pushing resources onto the device..."
|
|
adb_push_if_needed "${SKIA_SRC_DIR}/resources" $RESOURCE_PATH
|
|
fi
|
|
|
|
if [ $LOGCAT ]; then
|
|
verbose "clearing the device logs..."
|
|
$ADB $DEVICE_SERIAL logcat -c;
|
|
fi
|
|
STATUS_FILENAME="/data/local/tmp/.skia_tmp_$(date +%s%N)"
|
|
CMD_FILENAME=".skia_cmd_tmp_$(date +%s%N)"
|
|
echo "LD_LIBRARY_PATH=/data/local/tmp:$LD_LIBRARY_PATH \
|
|
/data/local/tmp/skia_launcher ${APP_ARGS[*]}; \
|
|
echo \$? > ${STATUS_FILENAME}" > ${CMD_FILENAME}
|
|
chmod +x ${CMD_FILENAME}
|
|
verbose "======== To reproduce this run: ========"
|
|
verbose "android_run_skia ${APP_ARGS[*]}"
|
|
verbose "========================================"
|
|
verbose "pushing command file onto the device..."
|
|
$ADB ${DEVICE_SERIAL} push ${CMD_FILENAME} /data/local/tmp
|
|
rm ${CMD_FILENAME}
|
|
verbose "preparing to run ${APP_ARGS[0]} on the device..."
|
|
$ADB ${DEVICE_SERIAL} shell sh /data/local/tmp/${CMD_FILENAME}
|
|
|
|
if [ -z "$($ADB $DEVICE_SERIAL shell 'if [ -f $STATUS_FILENAME ]; then echo exists; fi')" ]; then
|
|
if [ $LOGCAT ]; then $ADB $DEVICE_SERIAL logcat -d; fi
|
|
echo "***********************************************************************"
|
|
echo "The application terminated unexpectedly and did not produce an exit code"
|
|
echo "***********************************************************************"
|
|
exit 1
|
|
fi
|
|
|
|
EXIT_CODE=`$ADB ${DEVICE_SERIAL} shell cat ${STATUS_FILENAME}`
|
|
$ADB ${DEVICE_SERIAL} shell rm -f ${STATUS_FILENAME} ${CMD_FILENAME}
|
|
|
|
# check to see if the 'cat' command failed and print errors accordingly
|
|
if [[ ${EXIT_CODE} == *${STATUS_FILENAME}* ]]; then
|
|
if [ $LOGCAT ]; then $ADB $DEVICE_SERIAL logcat -d; fi
|
|
echo "***********************************************************************"
|
|
echo "ADB failed to retrieve the application's exit code"
|
|
echo "***********************************************************************"
|
|
exit 1
|
|
fi
|
|
|
|
echo "EXIT_CODE is ${EXIT_CODE}"
|
|
if [ $'0\r' != "${EXIT_CODE}" ]; then
|
|
if [ $LOGCAT ]; then $ADB $DEVICE_SERIAL logcat -d; fi
|
|
exit 1
|
|
fi
|
|
exit 0
|