• 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 = "PY2+3"
8
9DEPS = [
10  'checkout',
11  'docker',
12  'env',
13  'infra',
14  'recipe_engine/file',
15  'recipe_engine/path',
16  'recipe_engine/properties',
17  'recipe_engine/python',
18  'recipe_engine/step',
19  'run',
20  'vars',
21]
22
23
24DOCKER_IMAGE = 'gcr.io/skia-public/perf-karma-chrome-tests:87.0.4280.88_v1'
25INNER_KARMA_SCRIPT = 'skia/infra/pathkit/perf_pathkit.sh'
26
27
28def RunSteps(api):
29  api.vars.setup()
30  checkout_root = api.path['start_dir']
31  out_dir = api.vars.swarming_out_dir
32
33  # Make sure this exists, otherwise Docker will make it with root permissions.
34  api.file.ensure_directory('mkdirs out_dir', out_dir, mode=0o777)
35
36  # The karma script is configured to look in ./npm-(asmjs|wasm)/bin/ 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                                 'npm-wasm', 'bin')
40  if 'asmjs' in api.vars.builder_name:
41    copy_dest = checkout_root.join('skia', 'modules', 'pathkit',
42                                   'npm-asmjs', 'bin')
43
44  base_dir = api.vars.build_dir
45  bundle_name = 'pathkit.wasm'
46  if 'asmjs' in api.vars.builder_name:
47    bundle_name = 'pathkit.js.mem'
48
49  copies = [
50    {
51      'src': base_dir.join('pathkit.js'),
52      'dst': copy_dest.join('pathkit.js'),
53    },
54    {
55      'src': base_dir.join(bundle_name),
56      'dst': copy_dest.join(bundle_name),
57    },
58  ]
59  recursive_read = [checkout_root.join('skia')]
60
61  docker_args = None
62  if 'asmjs' in api.vars.builder_name:
63    docker_args = ['--env', 'ASM_JS=1']
64
65  args = [
66    '--builder',              api.vars.builder_name,
67    '--git_hash',             api.properties['revision'],
68    '--buildbucket_build_id', api.properties.get('buildbucket_build_id', ''),
69    '--bot_id',               api.vars.swarming_bot_id,
70    '--task_id',              api.vars.swarming_task_id,
71    '--browser',              'Chrome',
72    '--config',               api.vars.configuration,
73    '--source_type',          'pathkit',
74  ]
75  if 'asmjs' in api.vars.builder_name:
76    args.extend(['--compiled_language', 'asmjs']) # the default is wasm
77  if api.vars.is_trybot:
78    args.extend([
79      '--issue',         api.vars.issue,
80      '--patchset',      api.vars.patchset,
81    ])
82
83  api.docker.run(
84      name='Performance tests of PathKit with Docker',
85      docker_image=DOCKER_IMAGE,
86      src_dir=checkout_root,
87      out_dir=out_dir,
88      script=checkout_root.join(INNER_KARMA_SCRIPT),
89      args=args,
90      docker_args=docker_args,
91      copies=copies,
92      recursive_read=recursive_read,
93      attempts=3,
94  )
95
96
97def GenTests(api):
98  yield (
99      api.test('Perf-Debian10-EMCC-GCE-CPU-AVX2-wasm-Release-All-PathKit') +
100      api.properties(buildername=('Perf-Debian10-EMCC-GCE-CPU-AVX2'
101                                  '-wasm-Release-All-PathKit'),
102                     repository='https://skia.googlesource.com/skia.git',
103                     revision='abc123',
104                     path_config='kitchen',
105                     swarm_out_dir='[SWARM_OUT_DIR]')
106  )
107
108  yield (
109      api.test('Perf-Debian10-EMCC-GCE-CPU-AVX2-asmjs-Release-All-PathKit') +
110      api.properties(buildername=('Perf-Debian10-EMCC-GCE-CPU-AVX2'
111                                  '-asmjs-Release-All-PathKit'),
112                     repository='https://skia.googlesource.com/skia.git',
113                     revision='abc123',
114                     path_config='kitchen',
115                     swarm_out_dir='[SWARM_OUT_DIR]')
116  )
117
118  yield (
119      api.test('pathkit_trybot') +
120      api.properties(buildername=('Perf-Debian10-EMCC-GCE-CPU-AVX2'
121                                  '-wasm-Release-All-PathKit'),
122                     repository='https://skia.googlesource.com/skia.git',
123                     revision='abc123',
124                     path_config='kitchen',
125                     swarm_out_dir='[SWARM_OUT_DIR]',
126                     patch_ref='89/456789/12',
127                     patch_repo='https://skia.googlesource.com/skia.git',
128                     patch_storage='gerrit',
129                     patch_set=7,
130                     patch_issue=1234,
131                     gerrit_project='skia',
132                     gerrit_url='https://skia-review.googlesource.com/')
133  )
134