1# Copyright 2018 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5# Recipe which runs the PathKit tests using docker 6 7PYTHON_VERSION_COMPATIBILITY = "PY3" 8 9DEPS = [ 10 'checkout', 11 'docker', 12 'env', 13 'infra', 14 'recipe_engine/file', 15 'recipe_engine/path', 16 'recipe_engine/properties', 17 'recipe_engine/step', 18 'run', 19 'vars', 20] 21 22 23DOCKER_IMAGE = 'gcr.io/skia-public/perf-karma-chrome-tests:87.0.4280.88_v1' 24INNER_KARMA_SCRIPT = 'skia/infra/pathkit/perf_pathkit.sh' 25 26 27def RunSteps(api): 28 api.vars.setup() 29 checkout_root = api.path.start_dir 30 out_dir = api.vars.swarming_out_dir 31 32 # Make sure this exists, otherwise Docker will make it with root permissions. 33 api.file.ensure_directory('mkdirs out_dir', out_dir, mode=0o777) 34 35 # The karma script is configured to look in ./npm-(asmjs|wasm)/bin/ for 36 # the test files to load, so we must copy them there (see Set up for docker). 37 copy_dest = checkout_root.joinpath('skia', 'modules', 'pathkit', 38 'npm-wasm', 'bin') 39 if 'asmjs' in api.vars.builder_name: 40 copy_dest = checkout_root.joinpath('skia', 'modules', 'pathkit', 41 'npm-asmjs', 'bin') 42 43 base_dir = api.vars.build_dir 44 bundle_name = 'pathkit.wasm' 45 if 'asmjs' in api.vars.builder_name: 46 bundle_name = 'pathkit.js.mem' 47 48 copies = [ 49 { 50 'src': base_dir.joinpath('pathkit.js'), 51 'dst': copy_dest.joinpath('pathkit.js'), 52 }, 53 { 54 'src': base_dir.joinpath(bundle_name), 55 'dst': copy_dest.joinpath(bundle_name), 56 }, 57 ] 58 recursive_read = [checkout_root.joinpath('skia')] 59 60 docker_args = None 61 if 'asmjs' in api.vars.builder_name: 62 docker_args = ['--env', 'ASM_JS=1'] 63 64 args = [ 65 '--builder', api.vars.builder_name, 66 '--git_hash', api.properties['revision'], 67 '--buildbucket_build_id', api.properties.get('buildbucket_build_id', ''), 68 '--bot_id', api.vars.swarming_bot_id, 69 '--task_id', api.vars.swarming_task_id, 70 '--browser', 'Chrome', 71 '--config', api.vars.configuration, 72 '--source_type', 'pathkit', 73 ] 74 if 'asmjs' in api.vars.builder_name: 75 args.extend(['--compiled_language', 'asmjs']) # the default is wasm 76 if api.vars.is_trybot: 77 args.extend([ 78 '--issue', api.vars.issue, 79 '--patchset', api.vars.patchset, 80 ]) 81 82 api.docker.run( 83 name='Performance tests of PathKit with Docker', 84 docker_image=DOCKER_IMAGE, 85 src_dir=checkout_root, 86 out_dir=out_dir, 87 script=checkout_root.joinpath(INNER_KARMA_SCRIPT), 88 args=args, 89 docker_args=docker_args, 90 copies=copies, 91 recursive_read=recursive_read, 92 attempts=3, 93 ) 94 95 96def GenTests(api): 97 yield ( 98 api.test('Perf-Debian10-EMCC-GCE-CPU-AVX2-wasm-Release-All-PathKit') + 99 api.properties(buildername=('Perf-Debian10-EMCC-GCE-CPU-AVX2' 100 '-wasm-Release-All-PathKit'), 101 repository='https://skia.googlesource.com/skia.git', 102 revision='abc123', 103 path_config='kitchen', 104 swarm_out_dir='[SWARM_OUT_DIR]') 105 ) 106 107 yield ( 108 api.test('Perf-Debian10-EMCC-GCE-CPU-AVX2-asmjs-Release-All-PathKit') + 109 api.properties(buildername=('Perf-Debian10-EMCC-GCE-CPU-AVX2' 110 '-asmjs-Release-All-PathKit'), 111 repository='https://skia.googlesource.com/skia.git', 112 revision='abc123', 113 path_config='kitchen', 114 swarm_out_dir='[SWARM_OUT_DIR]') 115 ) 116 117 yield ( 118 api.test('pathkit_trybot') + 119 api.properties(buildername=('Perf-Debian10-EMCC-GCE-CPU-AVX2' 120 '-wasm-Release-All-PathKit'), 121 repository='https://skia.googlesource.com/skia.git', 122 revision='abc123', 123 path_config='kitchen', 124 swarm_out_dir='[SWARM_OUT_DIR]', 125 patch_ref='89/456789/12', 126 patch_repo='https://skia.googlesource.com/skia.git', 127 patch_storage='gerrit', 128 patch_set=7, 129 patch_issue=1234, 130 gerrit_project='skia', 131 gerrit_url='https://skia-review.googlesource.com/') 132 ) 133