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 Canvaskit 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/gold-karma-chrome-tests:77.0.3865.120_v2' 23INNER_KARMA_SCRIPT = 'skia/infra/canvaskit/test_canvaskit.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 # The karma script is configured to look in ./canvaskit/bin/ for 32 # the test files to load, so we must copy them there (see Set up for docker). 33 copy_dest = checkout_root.join('skia', 'modules', 'canvaskit', 34 'canvaskit', 'bin') 35 api.file.ensure_directory('mkdirs copy_dest', copy_dest, mode=0777) 36 base_dir = api.vars.build_dir 37 copies = { 38 base_dir.join('canvaskit.js'): copy_dest.join('canvaskit.js'), 39 base_dir.join('canvaskit.wasm'): copy_dest.join('canvaskit.wasm'), 40 } 41 recursive_read = [checkout_root.join('skia')] 42 43 args = [ 44 '--builder', api.vars.builder_name, 45 '--git_hash', api.properties['revision'], 46 '--buildbucket_build_id', api.properties.get('buildbucket_build_id', ''), 47 '--bot_id', api.vars.swarming_bot_id, 48 '--task_id', api.vars.swarming_task_id, 49 '--browser', 'Chrome', 50 '--config', api.vars.configuration, 51 '--source_type', 'canvaskit', 52 ] 53 if api.vars.is_trybot: 54 args.extend([ 55 '--issue', api.vars.issue, 56 '--patchset', api.vars.patchset, 57 ]) 58 59 api.docker.run( 60 name='Test CanvasKit with Docker', 61 docker_image=DOCKER_IMAGE, 62 src_dir=checkout_root, 63 out_dir=out_dir, 64 script=checkout_root.join(INNER_KARMA_SCRIPT), 65 args=args, 66 docker_args=None, 67 copies=copies, 68 recursive_read=recursive_read, 69 attempts=3, 70 ) 71 72 73def GenTests(api): 74 yield ( 75 api.test('Test-Debian9-EMCC-GCE-GPU-WEBGL1-wasm-Debug-All-CanvasKit') + 76 api.properties(buildername=('Test-Debian9-EMCC-GCE-GPU-WEBGL1' 77 '-wasm-Debug-All-CanvasKit'), 78 repository='https://skia.googlesource.com/skia.git', 79 revision='abc123', 80 path_config='kitchen', 81 swarm_out_dir='[SWARM_OUT_DIR]') 82 ) 83 84 yield ( 85 api.test('canvaskit_trybot') + 86 api.properties(buildername=('Test-Debian9-EMCC-GCE-CPU-AVX2' 87 '-wasm-Debug-All-CanvasKit'), 88 repository='https://skia.googlesource.com/skia.git', 89 revision='abc123', 90 path_config='kitchen', 91 swarm_out_dir='[SWARM_OUT_DIR]', 92 patch_ref='89/456789/12', 93 patch_repo='https://skia.googlesource.com/skia.git', 94 patch_storage='gerrit', 95 patch_set=7, 96 patch_issue=1234, 97 gerrit_project='skia', 98 gerrit_url='https://skia-review.googlesource.com/') 99 ) 100