From dd3eca1fc5e73e8fade9a791464e3850c1d3b08c Mon Sep 17 00:00:00 2001 From: Stephan Altmueller Date: Fri, 2 Feb 2018 15:05:42 -0500 Subject: [skqp] More args for skqp related scripts - allows to choose api versions in run_testlab.go - adds api_version and work_arounds to generate_gn_args Bug: skia: Change-Id: I87516b493f4d8eef3689d1722a5dd864131a44f8 Reviewed-on: https://skia-review.googlesource.com/102900 Reviewed-by: Derek Sollenberger Reviewed-by: Ben Wagner Commit-Queue: Stephan Altmueller --- tools/skqp/README.md | 20 +++++++++++++------ tools/skqp/generate_gn_args | 48 ++++++++++++++++++++++++++++----------------- 2 files changed, 44 insertions(+), 24 deletions(-) (limited to 'tools/skqp') diff --git a/tools/skqp/README.md b/tools/skqp/README.md index 91d818e372..da8f9efed7 100644 --- a/tools/skqp/README.md +++ b/tools/skqp/README.md @@ -40,23 +40,31 @@ How to run the SkQP tests cd skia git checkout origin/skqp/dev # or whatever release tag you need -3. Download dependencies, the model, and configure the build. (If you want to - test another architecture, replace `arm` with `x86`, `x64`, or `arm64`.) +3. Download dependencies and the model: python tools/skqp/download_model python tools/skqp/setup_resources python tools/git-sync-deps - python tools/skqp/generate_gn_args out/skqp-arm "$ANDROID_NDK" arm + +4. Configure the build: + + python tools/skqp/generate_gn_args out/skqp-arm "$ANDROID_NDK" \ + --arch arm \ + --api_level 26 bin/gn gen out/skqp-arm -4. Build, install, and run. + If you want to test another architecture, replace `arm` with `x86`, `x64` + or `arm64`. Run 'python tools/skqp/generate_gn_args -h' for + all options. + +5. Build, install, and run. platform_tools/android/bin/android_build_app -C out/skqp-arm skqp adb install -r out/skqp-arm/skqp.apk adb logcat -c adb shell am instrument -w org.skia.skqp/android.support.test.runner.AndroidJUnitRunner -5. Monitor the output with: +6. Monitor the output with: adb logcat org.skia.skqp skia "*:S" @@ -65,7 +73,7 @@ How to run the SkQP tests 01-23 15:22:12.688 27158 27173 I org.skia.skqp: output written to "/storage/emulated/0/Android/data/org.skia.skqp/files/output" -6. Retrieve and view the report with: +7. Retrieve and view the report with: OUTPUT_LOCATION="/storage/emulated/0/Android/data/org.skia.skqp/files/output" adb pull $OUTPUT_LOCATION /tmp/ diff --git a/tools/skqp/generate_gn_args b/tools/skqp/generate_gn_args index c527208c04..6a5c97490b 100755 --- a/tools/skqp/generate_gn_args +++ b/tools/skqp/generate_gn_args @@ -4,6 +4,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import argparse import os import sys @@ -11,7 +12,7 @@ fmt = ''' target_cpu = "{arch}" is_debug = false ndk = "{ndk}" -ndk_api = 26 +ndk_api = {api_level} skia_enable_fontmgr_empty = true skia_enable_pdf = false skia_skqp_global_error_tolerance = 4 @@ -22,27 +23,38 @@ skia_use_libheif = false skia_use_lua = false skia_use_piex = false skia_use_skcms = false +skia_skqp_enable_driver_correctness_workarounds = {enable_workarounds} ''' -def make_args_gn(out_dir, ndk, arch): +def parse_args(): + parser = argparse.ArgumentParser(description='Generate args.gn file.') + parser.add_argument('target_build_dir') + parser.add_argument('android_ndk_dir' ) + parser.add_argument('--arch', metavar='architecture', default='arm', + help='defaults to "arm", valid values: "arm" "arm64" "x86" "x64"') + parser.add_argument('--api_level', type=int, metavar='api_level', + default=26, help='android API level, defaults to 26') + parser.add_argument('--enable_workarounds', default=False, + action='store_true', help="enable GPU work-arounds, defaults to false") + + # parse the args and convert enable_workarounds to string. + args = parser.parse_args() + args.enable_workarounds = 'true' if args.enable_workarounds else 'false' + return args + +def make_args_gn(out_dir, ndk, arch, api_level, enable_workarounds): if not os.path.exists(out_dir): os.makedirs(out_dir) with open(os.path.join(out_dir, 'args.gn'), 'w') as o: - o.write(fmt.format(ndk=os.path.abspath(ndk), arch=arch)) - -def usage(): - sys.stderr.write( - 'Usage:\n' + - ' {} TARGET_BUILD_DIR ANDROID_NDK_DIR ARCHITECTURE\n\n'.format(sys.argv[0]) + - 'ARCHITECTURE should be "arm" "arm64" "x86" or "x64"\n\n') - exit(1) + o.write(fmt.format(ndk=os.path.abspath(ndk), + arch=arch, + api_level=api_level, + enable_workarounds=enable_workarounds)) if __name__ == '__main__': - if len(sys.argv) != 4: - usage() - build, android_ndk, arch = sys.argv[1:4] - if len(build) == 0 or len(arch) == 0 or not os.path.isdir(android_ndk): - usage() - make_args_gn(build, android_ndk, arch) - - + args = parse_args() + make_args_gn(args.target_build_dir, + args.android_ndk_dir, + args.arch, + args.api_level, + args.enable_workarounds) -- cgit v1.2.3