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 7 8DEPS = [ 9 'checkout', 10 'docker', 11 'env', 12 'flavor', 13 'infra', 14 'recipe_engine/file', 15 'recipe_engine/path', 16 'recipe_engine/properties', 17 'recipe_engine/python', 18 'recipe_engine/step', 19 'gold_upload', 20 'run', 21 'vars', 22] 23 24 25DOCKER_IMAGE = 'gcr.io/skia-public/gold-karma-chrome-tests:87.0.4280.88_v2' 26INNER_KARMA_SCRIPT = 'skia/infra/canvaskit/test_canvaskit.sh' 27 28def RunSteps(api): 29 api.vars.setup() 30 api.flavor.setup('dm') 31 checkout_root = api.path['start_dir'] 32 out_dir = api.vars.swarming_out_dir 33 34 # The karma script is configured to look in ./npm_build/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', 'canvaskit', 37 'npm_build', 'bin') 38 api.file.ensure_directory('mkdirs copy_dest', copy_dest, mode=0o777) 39 base_dir = api.vars.build_dir 40 copies = { 41 base_dir.join('canvaskit.js'): copy_dest.join('canvaskit.js'), 42 base_dir.join('canvaskit.wasm'): copy_dest.join('canvaskit.wasm'), 43 } 44 recursive_read = [checkout_root.join('skia')] 45 46 args = [ 47 '--builder', api.vars.builder_name, 48 '--git_hash', api.properties['revision'], 49 '--buildbucket_build_id', api.properties.get('buildbucket_build_id', ''), 50 '--browser', 'Chrome', 51 '--config', api.vars.configuration, 52 '--source_type', 'canvaskit', 53 ] 54 if api.vars.is_trybot: 55 args.extend([ 56 '--issue', api.vars.issue, 57 '--patchset', api.vars.patchset, 58 ]) 59 60 api.docker.run( 61 name='Test CanvasKit with Docker', 62 docker_image=DOCKER_IMAGE, 63 src_dir=checkout_root, 64 out_dir=out_dir, 65 script=checkout_root.join(INNER_KARMA_SCRIPT), 66 args=args, 67 docker_args=None, 68 copies=copies, 69 recursive_read=recursive_read, 70 attempts=3, 71 ) 72 73 api.gold_upload.upload() 74 75def GenTests(api): 76 yield ( 77 api.test('Test-Debian10-EMCC-GCE-GPU-WEBGL1-wasm-Debug-All-CanvasKit') + 78 api.properties(buildername=('Test-Debian10-EMCC-GCE-GPU-WEBGL1' 79 '-wasm-Debug-All-CanvasKit'), 80 repository='https://skia.googlesource.com/skia.git', 81 revision='abc123', 82 gs_bucket='skia-infra-gm', 83 path_config='kitchen', 84 swarm_out_dir='[SWARM_OUT_DIR]') 85 ) 86 87 yield ( 88 api.test('canvaskit_trybot') + 89 api.properties(buildername=('Test-Debian10-EMCC-GCE-CPU-AVX2' 90 '-wasm-Debug-All-CanvasKit'), 91 repository='https://skia.googlesource.com/skia.git', 92 revision='abc123', 93 gs_bucket='skia-infra-gm', 94 path_config='kitchen', 95 swarm_out_dir='[SWARM_OUT_DIR]', 96 patch_ref='89/456789/12', 97 patch_repo='https://skia.googlesource.com/skia.git', 98 patch_storage='gerrit', 99 patch_set=7, 100 patch_issue=1234, 101 gerrit_project='skia', 102 gerrit_url='https://skia-review.googlesource.com/') 103 ) 104