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