2018-01-25 16:30:05 +00:00
|
|
|
#! /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 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))
|
|
|
|
|
2020-04-20 23:16:51 +00:00
|
|
|
adb('shell', 'rm -rf /data/local/tmp/skqp; mkdir -p /data/local/tmp/skqp/skqp_assets')
|
2018-01-25 16:30:05 +00:00
|
|
|
|
|
|
|
adb('push',
|
2020-04-20 23:16:51 +00:00
|
|
|
os.path.join(*'platform_tools/android/apps/skqp/src/main/assets/skqp'.split('/')),
|
2018-01-25 16:30:05 +00:00
|
|
|
'/data/local/tmp/skqp/skqp_assets')
|
2020-04-20 23:16:51 +00:00
|
|
|
adb('push', 'resources', '/data/local/tmp/skqp/skqp_assets')
|
2018-01-25 16:30:05 +00:00
|
|
|
|
|
|
|
adb('push', os.path.join(build, 'skqp'), '/data/local/tmp/skqp/skqp')
|
|
|
|
|
2022-03-07 21:13:40 +00:00
|
|
|
cmd = "cd /data/local/tmp/skqp; ./skqp skqp_assets report"
|
2018-01-25 16:30:05 +00:00
|
|
|
sys.stdout.write("adb 'shell' '%s'\n" % cmd)
|
|
|
|
ret = subprocess.call(['adb', 'shell', cmd])
|
|
|
|
|
|
|
|
tmpdir = tempfile.mkdtemp(prefix='skqp')
|
|
|
|
|
2020-04-20 23:16:51 +00:00
|
|
|
adb('pull', "/data/local/tmp/skqp/report", tmpdir)
|
2018-01-25 16:30:05 +00:00
|
|
|
|
|
|
|
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))
|
2020-04-20 23:16:51 +00:00
|
|
|
os.system("bin/sysopen " + os.path.join(report, 'report.html'))
|