SkQP: run_skqp_exe script

Change-Id: I9e3e4994e15856edd86a1f0f0ab91297c325dcca
Reviewed-on: https://skia-review.googlesource.com/99662
Reviewed-by: Hal Canary <halcanary@google.com>
This commit is contained in:
Hal Canary 2018-01-25 11:30:05 -05:00
parent fb9af7dcb6
commit fd1d20b4bb
2 changed files with 56 additions and 10 deletions

View File

@ -23,6 +23,8 @@ How to run the SkQP tests
yes | ~/android-sdk/tools/bin/sdkmanager --licenses
export ANDROID_HOME=~/android-sdk # Or wherever you installed the Android SDK.
Put `adb` in your `PATH`.
4. Get the right version of Skia:
git clone https://skia.googlesource.com/skia.git
@ -67,14 +69,5 @@ Run as a non-APK executable
2. Build the SkQP program, load files on the device, and run skqp:
ninja -C out/skqp-arm skqp
adb shell "cd /data/local/tmp; rm -rf skqp_assets report"
adb push platform_tools/android/apps/skqp/src/main/assets \
/data/local/tmp/skqp_assets
adb push out/skqp-arm/skqp /data/local/tmp/
adb shell "cd /data/local/tmp; ./skqp skqp_assets report"
2. Get and view the error report:
adb pull /data/local/tmp/report /tmp/
tools/skqp/sysopen.py /tmp/report/report.html
python tools/skqp/run_skqp_exe out/skqp-arm

53
tools/skqp/run_skqp_exe Executable file
View File

@ -0,0 +1,53 @@
#! /usr/bin/env python
# Copyright 2018 Google Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import tempfile
import sysopen
import sys
def skqp(build):
def adb(*args):
sys.stdout.write("adb '" + "' '".join(args) + "'\n")
subprocess.check_call(['adb'] + list(args))
assert os.path.isdir(build)
build = os.path.abspath(build)
os.chdir(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
adb('shell', 'rm -rf /data/local/tmp/skqp; mkdir -p /data/local/tmp/skqp')
adb('push',
os.path.join(*'platform_tools/android/apps/skqp/src/main/assets'.split('/')),
'/data/local/tmp/skqp/skqp_assets')
adb('push', os.path.join(build, 'skqp'), '/data/local/tmp/skqp/skqp')
cmd = "cd /data/local/tmp/skqp; ./skqp skqp_assets report"
sys.stdout.write("adb 'shell' '%s'\n" % cmd)
ret = subprocess.call(['adb', 'shell', cmd])
tmpdir = tempfile.mkdtemp(prefix='skqp')
adb('pull', "/data/local/tmp/report", tmpdir)
return ret, os.path.join(tmpdir, 'report')
if __name__ == '__main__':
if len(sys.argv) != 2 or not os.path.isdir(sys.argv[1]):
sys.stderr.write('Usage\n %s BUILD_DIR\n\n' % sys.argv[0])
sys.exit(1)
try:
ret, report = skqp(sys.argv[1])
except subprocess.CalledProcessError:
sys.stderr.write('Command failed.\n')
sys.exit(1)
sys.stdout.write('\nReturn code: %d\nOutput written to "%s"\n' % (ret, report))
sysopen.sysopen(os.path.join(report, 'report.html'))