1cb93a386Sopenharmony_ci# Copyright 2018 The Chromium Authors. All rights reserved. 2cb93a386Sopenharmony_ci# Use of this source code is governed by a BSD-style license that can be 3cb93a386Sopenharmony_ci# found in the LICENSE file. 4cb93a386Sopenharmony_ci 5cb93a386Sopenharmony_ci# Recipe which runs the Canvaskit tests using docker 6cb93a386Sopenharmony_ci 7cb93a386Sopenharmony_ciPYTHON_VERSION_COMPATIBILITY = "PY2+3" 8cb93a386Sopenharmony_ci 9cb93a386Sopenharmony_ciDEPS = [ 10cb93a386Sopenharmony_ci 'checkout', 11cb93a386Sopenharmony_ci 'docker', 12cb93a386Sopenharmony_ci 'env', 13cb93a386Sopenharmony_ci 'flavor', 14cb93a386Sopenharmony_ci 'infra', 15cb93a386Sopenharmony_ci 'recipe_engine/file', 16cb93a386Sopenharmony_ci 'recipe_engine/path', 17cb93a386Sopenharmony_ci 'recipe_engine/properties', 18cb93a386Sopenharmony_ci 'recipe_engine/python', 19cb93a386Sopenharmony_ci 'recipe_engine/step', 20cb93a386Sopenharmony_ci 'gold_upload', 21cb93a386Sopenharmony_ci 'run', 22cb93a386Sopenharmony_ci 'vars', 23cb93a386Sopenharmony_ci] 24cb93a386Sopenharmony_ci 25cb93a386Sopenharmony_ci 26cb93a386Sopenharmony_ciDOCKER_IMAGE = 'gcr.io/skia-public/gold-karma-chrome-tests:87.0.4280.88_v2' 27cb93a386Sopenharmony_ciINNER_KARMA_SCRIPT = 'skia/infra/canvaskit/test_canvaskit.sh' 28cb93a386Sopenharmony_ci 29cb93a386Sopenharmony_cidef RunSteps(api): 30cb93a386Sopenharmony_ci api.vars.setup() 31cb93a386Sopenharmony_ci api.flavor.setup('dm') 32cb93a386Sopenharmony_ci checkout_root = api.path['start_dir'] 33cb93a386Sopenharmony_ci out_dir = api.vars.swarming_out_dir 34cb93a386Sopenharmony_ci 35cb93a386Sopenharmony_ci # The karma script is configured to look in ./npm_build/bin/ for 36cb93a386Sopenharmony_ci # the test files to load, so we must copy them there (see Set up for docker). 37cb93a386Sopenharmony_ci copy_dest = checkout_root.join('skia', 'modules', 'canvaskit', 38cb93a386Sopenharmony_ci 'npm_build', 'bin') 39cb93a386Sopenharmony_ci api.file.ensure_directory('mkdirs copy_dest', copy_dest, mode=0o777) 40cb93a386Sopenharmony_ci base_dir = api.vars.build_dir 41cb93a386Sopenharmony_ci copies = [ 42cb93a386Sopenharmony_ci { 43cb93a386Sopenharmony_ci 'src': base_dir.join('canvaskit.js'), 44cb93a386Sopenharmony_ci 'dst': copy_dest.join('canvaskit.js'), 45cb93a386Sopenharmony_ci }, 46cb93a386Sopenharmony_ci { 47cb93a386Sopenharmony_ci 'src': base_dir.join('canvaskit.wasm'), 48cb93a386Sopenharmony_ci 'dst': copy_dest.join('canvaskit.wasm'), 49cb93a386Sopenharmony_ci }, 50cb93a386Sopenharmony_ci ] 51cb93a386Sopenharmony_ci recursive_read = [checkout_root.join('skia')] 52cb93a386Sopenharmony_ci 53cb93a386Sopenharmony_ci args = [ 54cb93a386Sopenharmony_ci '--builder', api.vars.builder_name, 55cb93a386Sopenharmony_ci '--git_hash', api.properties['revision'], 56cb93a386Sopenharmony_ci '--buildbucket_build_id', api.properties.get('buildbucket_build_id', ''), 57cb93a386Sopenharmony_ci '--browser', 'Chrome', 58cb93a386Sopenharmony_ci '--config', api.vars.configuration, 59cb93a386Sopenharmony_ci '--source_type', 'canvaskit', 60cb93a386Sopenharmony_ci ] 61cb93a386Sopenharmony_ci if api.vars.is_trybot: 62cb93a386Sopenharmony_ci args.extend([ 63cb93a386Sopenharmony_ci '--issue', api.vars.issue, 64cb93a386Sopenharmony_ci '--patchset', api.vars.patchset, 65cb93a386Sopenharmony_ci ]) 66cb93a386Sopenharmony_ci 67cb93a386Sopenharmony_ci api.docker.run( 68cb93a386Sopenharmony_ci name='Test CanvasKit with Docker', 69cb93a386Sopenharmony_ci docker_image=DOCKER_IMAGE, 70cb93a386Sopenharmony_ci src_dir=checkout_root, 71cb93a386Sopenharmony_ci out_dir=out_dir, 72cb93a386Sopenharmony_ci script=checkout_root.join(INNER_KARMA_SCRIPT), 73cb93a386Sopenharmony_ci args=args, 74cb93a386Sopenharmony_ci docker_args=None, 75cb93a386Sopenharmony_ci copies=copies, 76cb93a386Sopenharmony_ci recursive_read=recursive_read, 77cb93a386Sopenharmony_ci attempts=3, 78cb93a386Sopenharmony_ci ) 79cb93a386Sopenharmony_ci 80cb93a386Sopenharmony_ci api.gold_upload.upload() 81cb93a386Sopenharmony_ci 82cb93a386Sopenharmony_cidef GenTests(api): 83cb93a386Sopenharmony_ci yield ( 84cb93a386Sopenharmony_ci api.test('Test-Debian10-EMCC-GCE-GPU-WEBGL1-wasm-Debug-All-CanvasKit') + 85cb93a386Sopenharmony_ci api.properties(buildername=('Test-Debian10-EMCC-GCE-GPU-WEBGL1' 86cb93a386Sopenharmony_ci '-wasm-Debug-All-CanvasKit'), 87cb93a386Sopenharmony_ci repository='https://skia.googlesource.com/skia.git', 88cb93a386Sopenharmony_ci revision='abc123', 89cb93a386Sopenharmony_ci gs_bucket='skia-infra-gm', 90cb93a386Sopenharmony_ci path_config='kitchen', 91cb93a386Sopenharmony_ci swarm_out_dir='[SWARM_OUT_DIR]') 92cb93a386Sopenharmony_ci ) 93cb93a386Sopenharmony_ci 94cb93a386Sopenharmony_ci yield ( 95cb93a386Sopenharmony_ci api.test('canvaskit_trybot') + 96cb93a386Sopenharmony_ci api.properties(buildername=('Test-Debian10-EMCC-GCE-CPU-AVX2' 97cb93a386Sopenharmony_ci '-wasm-Debug-All-CanvasKit'), 98cb93a386Sopenharmony_ci repository='https://skia.googlesource.com/skia.git', 99cb93a386Sopenharmony_ci revision='abc123', 100cb93a386Sopenharmony_ci gs_bucket='skia-infra-gm', 101cb93a386Sopenharmony_ci path_config='kitchen', 102cb93a386Sopenharmony_ci swarm_out_dir='[SWARM_OUT_DIR]', 103cb93a386Sopenharmony_ci patch_ref='89/456789/12', 104cb93a386Sopenharmony_ci patch_repo='https://skia.googlesource.com/skia.git', 105cb93a386Sopenharmony_ci patch_storage='gerrit', 106cb93a386Sopenharmony_ci patch_set=7, 107cb93a386Sopenharmony_ci patch_issue=1234, 108cb93a386Sopenharmony_ci gerrit_project='skia', 109cb93a386Sopenharmony_ci gerrit_url='https://skia-review.googlesource.com/') 110cb93a386Sopenharmony_ci ) 111