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