• 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 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/gold-karma-chrome-tests:77.0.3865.120_v2'
23INNER_KARMA_SCRIPT = 'skia/infra/pathkit/test_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  # The karma script is configured to look in ./npm-(asmjs|wasm)/bin/test/ 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', 'pathkit',
34                                 'npm-wasm', 'bin', 'test')
35  if 'asmjs' in api.vars.builder_name:
36    copy_dest = checkout_root.join('skia', 'modules', 'pathkit',
37                                   'npm-asmjs', 'bin', 'test')
38
39  base_dir = api.vars.build_dir
40  bundle_name = 'pathkit.wasm'
41  if 'asmjs' in api.vars.builder_name:
42    # release mode has a .js.mem file that needs to come with.
43    # debug mode has an optional .map file, but we can omit that for tests
44    if 'Debug' in api.vars.builder_name:
45      bundle_name = ''
46    else:
47      bundle_name = 'pathkit.js.mem'
48
49  copies = {
50    base_dir.join('pathkit.js'): copy_dest.join('pathkit.js'),
51  }
52  if bundle_name:
53    copies[base_dir.join(bundle_name)] = copy_dest.join(bundle_name)
54  recursive_read = [checkout_root.join('skia')]
55
56  docker_args = None
57  if 'asmjs' in api.vars.builder_name:
58    docker_args = ['--env', 'ASM_JS=1']
59
60  args = [
61    '--builder',              api.vars.builder_name,
62    '--git_hash',             api.properties['revision'],
63    '--buildbucket_build_id', api.properties.get('buildbucket_build_id', ''),
64    '--bot_id',               api.vars.swarming_bot_id,
65    '--task_id',              api.vars.swarming_task_id,
66    '--browser',              'Chrome',
67    '--config',               api.vars.configuration,
68    '--source_type',          'pathkit',
69  ]
70  if 'asmjs' in api.vars.builder_name:
71    args.extend(['--compiled_language', 'asmjs']) # the default is wasm
72  if api.vars.is_trybot:
73    args.extend([
74      '--issue',         api.vars.issue,
75      '--patchset',      api.vars.patchset,
76    ])
77
78  api.docker.run(
79      name='Test PathKit with Docker',
80      docker_image=DOCKER_IMAGE,
81      src_dir=checkout_root,
82      out_dir=out_dir,
83      script=checkout_root.join(INNER_KARMA_SCRIPT),
84      args=args,
85      docker_args=docker_args,
86      copies=copies,
87      recursive_read=recursive_read,
88      attempts=3,
89  )
90
91
92def GenTests(api):
93  yield (
94      api.test('Test-Debian9-EMCC-GCE-CPU-AVX2-wasm-Debug-All-PathKit') +
95      api.properties(buildername=('Test-Debian9-EMCC-GCE-CPU-AVX2'
96                                  '-wasm-Debug-All-PathKit'),
97                     repository='https://skia.googlesource.com/skia.git',
98                     revision='abc123',
99                     path_config='kitchen',
100                     swarm_out_dir='[SWARM_OUT_DIR]')
101  )
102
103  yield (
104      api.test('Test-Debian9-EMCC-GCE-CPU-AVX2-asmjs-Debug-All-PathKit') +
105      api.properties(buildername=('Test-Debian9-EMCC-GCE-CPU-AVX2'
106                                  '-asmjs-Debug-All-PathKit'),
107                     repository='https://skia.googlesource.com/skia.git',
108                     revision='abc123',
109                     path_config='kitchen',
110                     swarm_out_dir='[SWARM_OUT_DIR]')
111  )
112
113  yield (
114      api.test('Test-Debian9-EMCC-GCE-CPU-AVX2-asmjs-Release-All-PathKit') +
115      api.properties(buildername=('Test-Debian9-EMCC-GCE-CPU-AVX2'
116                                  '-asmjs-Release-All-PathKit'),
117                     repository='https://skia.googlesource.com/skia.git',
118                     revision='abc123',
119                     path_config='kitchen',
120                     swarm_out_dir='[SWARM_OUT_DIR]')
121  )
122
123  yield (
124      api.test('pathkit_trybot') +
125      api.properties(buildername=('Test-Debian9-EMCC-GCE-CPU-AVX2'
126                                  '-wasm-Debug-All-PathKit'),
127                     repository='https://skia.googlesource.com/skia.git',
128                     revision='abc123',
129                     path_config='kitchen',
130                     swarm_out_dir='[SWARM_OUT_DIR]',
131                     patch_ref='89/456789/12',
132                     patch_repo='https://skia.googlesource.com/skia.git',
133                     patch_storage='gerrit',
134                     patch_set=7,
135                     patch_issue=1234,
136                     gerrit_project='skia',
137                     gerrit_url='https://skia-review.googlesource.com/')
138  )
139