blob: 8cce37576efa29e4cca1d7a5df4361ff86f3753c [file] [log] [blame]
Kevin Lubick35b87a52018-10-08 15:07:42 -04001#!/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
Hal Canaryfa634212018-12-05 11:26:20 -050024adb install -r /OUT/skqp-universal-debug.apk
Kevin Lubick35b87a52018-10-08 15:07:42 -040025adb logcat -c
Hal Canary7600cb32018-11-09 10:22:20 -050026
27tmp_file="$(mktemp "${TMPDIR:-/tmp}/skqp.XXXXXXXXXX")"
28
29adb shell am instrument -w org.skia.skqp | tee "$tmp_file" | fold -s
30
Kevin Lubick35b87a52018-10-08 15:07:42 -040031adb logcat -d TestRunner org.skia.skqp skia DEBUG "*:S"
Hal Canary7600cb32018-11-09 10:22:20 -050032
Hal Canarycc4f7eb2018-12-17 12:03:25 -050033if ! grep -q '^OK ' "$tmp_file"; then
34 echo 'this test failed'
35fi
Hal Canary7600cb32018-11-09 10:22:20 -050036