1#!/bin/bash 2# Copyright 2018 Google LLC 3# 4# Use of this source code is governed by a BSD-style license that can be 5# found in the LICENSE file. 6# 7# Assumes this is in a docker container with a skia repo mounted at /SRC and a folder containing the 8# built APK to be in /OUT. 9# Additionally, this assumes that the docker container was run to have an android emulator running 10# that is accesible with adb. 11# This script in particular doesn't care about arm vs x86, but the current incarnation has an x86 12# emulator and so the apk should be built for that. 13# 14# Example usage: 15# 16 17set -ex 18 19# Wait for boot 20timeout 60 adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done' 21# Some extra sleep to make sure the emulator is awake and ready for installation 22sleep 10 23 24adb install -r /OUT/skqp-universal-debug.apk 25adb logcat -c 26 27tmp_file="$(mktemp "${TMPDIR:-/tmp}/skqp.XXXXXXXXXX")" 28 29adb shell am instrument -w org.skia.skqp | tee "$tmp_file" | fold -s 30 31adb logcat -d TestRunner org.skia.skqp skia DEBUG "*:S" 32 33if ! grep -q '^OK ' "$tmp_file"; then 34 echo 'this test failed' 35fi 36 37