• 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
7PYTHON_VERSION_COMPATIBILITY = "PY3"
8
9DEPS = [
10  'checkout',
11  'docker',
12  'env',
13  'flavor',
14  'gold_upload',
15  'infra',
16  'recipe_engine/file',
17  'recipe_engine/path',
18  'recipe_engine/properties',
19  'recipe_engine/python',
20  'recipe_engine/step',
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/pathkit/test_pathkit.sh'
28
29
30def RunSteps(api):
31  api.vars.setup()
32  api.flavor.setup("dm")
33  checkout_root = api.path['start_dir']
34  out_dir = api.vars.swarming_out_dir
35
36  # The karma script is configured to look in ./npm-(asmjs|wasm)/bin/test/ for
37  # the test files to load, so we must copy them there (see Set up for docker).
38  copy_dest = checkout_root.join('skia', 'modules', 'pathkit',
39                                 'build', 'wasm')
40  if 'asmjs' in api.vars.builder_name:
41    copy_dest = checkout_root.join('skia', 'modules', 'pathkit',
42                                   'build', 'asmjs')
43
44  base_dir = api.vars.build_dir
45  bundle_name = 'pathkit.wasm'
46  if 'asmjs' in api.vars.builder_name:
47    # release mode has a .js.mem file that needs to come with.
48    # debug mode has an optional .map file, but we can omit that for tests
49    if 'Debug' in api.vars.builder_name:
50      bundle_name = ''
51    else:
52      bundle_name = 'pathkit.js.mem'
53
54  copies = [{
55    'src': base_dir.join('pathkit.js'),
56    'dst': copy_dest.join('pathkit.js'),
57  }]
58  if bundle_name:
59    copies.append({
60      'src': base_dir.join(bundle_name),
61      'dst': copy_dest.join(bundle_name),
62    })
63  recursive_read = [checkout_root.join('skia')]
64
65  docker_args = None
66  if 'asmjs' in api.vars.builder_name:
67    docker_args = ['--env', 'ASM_JS=1']
68
69  args = [
70    '--builder',              api.vars.builder_name,
71    '--git_hash',             api.properties['revision'],
72    '--buildbucket_build_id', api.properties.get('buildbucket_build_id', ''),
73    '--browser',              'Chrome',
74    '--config',               api.vars.configuration,
75    '--source_type',          'pathkit',
76  ]
77  if 'asmjs' in api.vars.builder_name:
78    args.extend(['--compiled_language', 'asmjs']) # the default is wasm
79  if api.vars.is_trybot:
80    args.extend([
81      '--issue',         api.vars.issue,
82      '--patchset',      api.vars.patchset,
83    ])
84
85  api.docker.run(
86      name='Test PathKit with Docker',
87      docker_image=DOCKER_IMAGE,
88      src_dir=checkout_root,
89      out_dir=out_dir,
90      script=checkout_root.join(INNER_KARMA_SCRIPT),
91      args=args,
92      docker_args=docker_args,
93      copies=copies,
94      recursive_read=recursive_read,
95      attempts=3,
96  )
97
98  api.gold_upload.upload()
99
100
101def GenTests(api):
102  yield (
103      api.test('Test-Debian10-EMCC-GCE-CPU-AVX2-wasm-Debug-All-PathKit') +
104      api.properties(buildername=('Test-Debian10-EMCC-GCE-CPU-AVX2'
105                                  '-wasm-Debug-All-PathKit'),
106                     repository='https://skia.googlesource.com/skia.git',
107                     revision='abc123',
108                     gs_bucket='skia-infra-gm',
109                     path_config='kitchen',
110                     swarm_out_dir='[SWARM_OUT_DIR]')
111  )
112
113  yield (
114      api.test('Test-Debian10-EMCC-GCE-CPU-AVX2-asmjs-Debug-All-PathKit') +
115      api.properties(buildername=('Test-Debian10-EMCC-GCE-CPU-AVX2'
116                                  '-asmjs-Debug-All-PathKit'),
117                     repository='https://skia.googlesource.com/skia.git',
118                     revision='abc123',
119                     gs_bucket='skia-infra-gm',
120                     path_config='kitchen',
121                     swarm_out_dir='[SWARM_OUT_DIR]')
122  )
123
124  yield (
125      api.test('Test-Debian10-EMCC-GCE-CPU-AVX2-asmjs-Release-All-PathKit') +
126      api.properties(buildername=('Test-Debian10-EMCC-GCE-CPU-AVX2'
127                                  '-asmjs-Release-All-PathKit'),
128                     repository='https://skia.googlesource.com/skia.git',
129                     revision='abc123',
130                     gs_bucket='skia-infra-gm',
131                     path_config='kitchen',
132                     swarm_out_dir='[SWARM_OUT_DIR]')
133  )
134
135  yield (
136      api.test('pathkit_trybot') +
137      api.properties(buildername=('Test-Debian10-EMCC-GCE-CPU-AVX2'
138                                  '-wasm-Debug-All-PathKit'),
139                     repository='https://skia.googlesource.com/skia.git',
140                     revision='abc123',
141                     gs_bucket='skia-infra-gm',
142                     path_config='kitchen',
143                     swarm_out_dir='[SWARM_OUT_DIR]',
144                     patch_ref='89/456789/12',
145                     patch_repo='https://skia.googlesource.com/skia.git',
146                     patch_storage='gerrit',
147                     patch_set=7,
148                     patch_issue=1234,
149                     gerrit_project='skia',
150                     gerrit_url='https://skia-review.googlesource.com/')
151  )
152