• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2017 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
5PYTHON_VERSION_COMPATIBILITY = "PY2+3"
6
7DEPS = [
8  'flavor',
9  'recipe_engine/platform',
10  'recipe_engine/properties',
11  'recipe_engine/raw_io',
12  'run',
13  'vars',
14]
15
16
17def test_exceptions(api):
18  try:
19    api.flavor.copy_directory_contents_to_device('src', 'dst')
20  except ValueError:
21    pass
22  try:
23    api.flavor.copy_directory_contents_to_host('src', 'dst')
24  except ValueError:
25    pass
26  try:
27    api.flavor.copy_file_to_device('src', 'dst')
28  except ValueError:
29    pass
30
31
32def RunSteps(api):
33  api.vars.setup()
34
35  builder = api.properties['buildername']
36  app = None
37  if 'SkottieTracing' in builder:
38    app = None
39  elif 'Test' in builder:
40    app = 'dm'
41  elif 'Perf' in builder:
42    app = 'nanobench'
43  api.flavor.setup(app)
44
45  if api.properties.get('is_testing_exceptions') == 'True':
46    return test_exceptions(api)
47
48  try:
49    api.flavor.copy_file_to_device('file.txt', 'file.txt')
50    api.flavor.read_file_on_device('file.txt')
51    api.flavor.remove_file_on_device('file.txt')
52    api.flavor.create_clean_host_dir('results_dir')
53    api.flavor.create_clean_device_dir('device_results_dir')
54
55    if 'Lottie' in builder:
56      api.flavor.install(lotties=True)
57    elif 'Mskp' in builder:
58      api.flavor.install(mskps=True)
59    elif all(v in builder for v in ['Perf', 'Android', 'CPU']):
60      api.flavor.install(skps=True, images=True, svgs=True,
61                         resources=True, texttraces=True)
62    else:
63      api.flavor.install(skps=True, images=True, lotties=False,
64                         svgs=True, resources=True)
65    if 'Test' in builder:
66      api.flavor.step('dm', ['dm', '--some-flag'])
67      api.flavor.copy_directory_contents_to_host(
68          api.flavor.device_dirs.dm_dir, api.flavor.host_dirs.dm_dir)
69    elif 'Perf' in builder:
70      if 'SkottieTracing' in builder:
71        api.flavor.step('dm', ['dm', '--some-flag'])
72      else:
73        api.flavor.step('nanobench', ['nanobench', '--some-flag'])
74      api.flavor.copy_directory_contents_to_host(
75          api.flavor.device_dirs.perf_data_dir,
76          api.flavor.host_dirs.perf_data_dir)
77  finally:
78    api.flavor.cleanup_steps()
79  api.run.check_failure()
80
81
82TEST_BUILDERS = [
83  'Perf-Android-Clang-AndroidOne-GPU-Mali400MP2-arm-Release-All-Android_SkottieTracing',
84  'Perf-Android-Clang-GalaxyS7_G930FD-GPU-MaliT880-arm64-Debug-All-Android',
85  'Perf-Android-Clang-NVIDIA_Shield-CPU-TegraX1-arm64-Release-All-Android',
86  'Perf-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Debug-All-Android',
87  'Perf-Android-Clang-Pixel2XL-GPU-Adreno540-arm64-Release-All-Android_Skpbench_Mskp',
88  'Perf-Android-Clang-GalaxyS20-GPU-MaliG77-arm64-Release-All-Android_Vulkan',
89  'Perf-ChromeOS-Clang-SamsungChromebookPlus-GPU-MaliT860-arm-Release-All',
90  'Perf-Debian10-Clang-GCE-CPU-AVX2-x86_64-Debug-All-MSAN',
91  'Perf-Debian10-Clang-GCE-CPU-AVX2-x86_64-Release-All-ASAN',
92  'Perf-Win2019-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN',
93  'Test-Android-Clang-AndroidOne-GPU-Mali400MP2-arm-Release-All-Android',
94  'Test-Android-Clang-GalaxyS7_G930FD-GPU-MaliT880-arm64-Debug-All-Android',
95  'Test-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Debug-All-Android',
96  'Test-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Release-All-Android_ASAN',
97  'Test-Android-Clang-Pixel3a-GPU-Adreno615-arm64-Debug-All-Android_Vulkan',
98  'Test-ChromeOS-Clang-SamsungChromebookPlus-GPU-MaliT860-arm-Release-All',
99  'Test-Debian10-GCC-GCE-CPU-AVX2-x86-Debug-All-Docker',
100  'Test-Debian10-GCC-GCE-CPU-AVX2-x86_64-Debug-All-Docker',
101  'Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Debug-All-Coverage',
102  'Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Release-All-Lottie',
103  'Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Release-All-TSAN',
104  'Test-Debian10-Clang-GCE-GPU-SwiftShader-x86_64-Debug-All-SwiftShader',
105  'Test-Debian10-Clang-NUC7i5BNK-GPU-IntelIris640-x86_64-Debug-All-Vulkan',
106  'Test-Mac10.13-Clang-MacBookPro11.5-CPU-AVX2-x86_64-Debug-All-ASAN',
107  ('Test-Ubuntu18-Clang-Golo-GPU-QuadroP400-x86_64-Release-All'
108   '-Valgrind_AbandonGpuContext_SK_CPU_LIMIT_SSE41'),
109  'Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-Vulkan_ProcDump',
110  'Test-Debian10-Clang-NUC7i5BNK-GPU-IntelIris640-x86_64-Debug-All-ASAN_Vulkan',
111]
112
113# Default properties used for TEST_BUILDERS.
114defaultProps = lambda buildername: dict(
115  buildername=buildername,
116  repository='https://skia.googlesource.com/skia.git',
117  revision='abc123',
118  path_config='kitchen',
119  patch_set=2,
120  swarm_out_dir='[SWARM_OUT_DIR]'
121)
122
123def GenTests(api):
124  for buildername in TEST_BUILDERS:
125    test = (
126      api.test(buildername) +
127      api.properties(**defaultProps(buildername))
128    )
129    if 'Win' in buildername:
130      test += api.platform('win', 64)
131    yield test
132
133  builder = 'Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Release-All'
134  yield (
135      api.test('exceptions') +
136      api.properties(buildername=builder,
137                     repository='https://skia.googlesource.com/skia.git',
138                     revision='abc123',
139                     path_config='kitchen',
140                     swarm_out_dir='[SWARM_OUT_DIR]',
141                     is_testing_exceptions='True')
142  )
143
144  builder = ('Perf-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Debug-All'
145             '-Android')
146  yield (
147      api.test('failed_infra_step') +
148      api.properties(buildername=builder,
149                     repository='https://skia.googlesource.com/skia.git',
150                     revision='abc123',
151                     path_config='kitchen',
152                     swarm_out_dir='[SWARM_OUT_DIR]') +
153      api.step_data('get swarming bot id',
154                    stdout=api.raw_io.output('build123-m2--device5')) +
155      api.step_data('dump log', retcode=1)
156  )
157
158  yield (
159      api.test('failed_read_version') +
160      api.properties(buildername=builder,
161                     repository='https://skia.googlesource.com/skia.git',
162                     revision='abc123',
163                     path_config='kitchen',
164                     swarm_out_dir='[SWARM_OUT_DIR]') +
165      api.step_data('read /sdcard/revenge_of_the_skiabot/SK_IMAGE_VERSION',
166                    retcode=1)
167  )
168
169  yield (
170      api.test('retry_adb_command') +
171      api.properties(buildername=builder,
172                     repository='https://skia.googlesource.com/skia.git',
173                     revision='abc123',
174                     path_config='kitchen',
175                     swarm_out_dir='[SWARM_OUT_DIR]') +
176      api.step_data('mkdir /sdcard/revenge_of_the_skiabot/resources',
177                    retcode=1)
178  )
179
180  fail_step_name = 'mkdir /sdcard/revenge_of_the_skiabot/resources'
181  yield (
182      api.test('retry_adb_command_retries_exhausted') +
183      api.properties(buildername=builder,
184                     repository='https://skia.googlesource.com/skia.git',
185                     revision='abc123',
186                     path_config='kitchen',
187                     swarm_out_dir='[SWARM_OUT_DIR]') +
188      api.step_data('get swarming bot id',
189                    stdout=api.raw_io.output('build123-m2--device5')) +
190      api.step_data(fail_step_name, retcode=1) +
191      api.step_data(fail_step_name + ' (attempt 2)', retcode=1) +
192      api.step_data(fail_step_name + ' (attempt 3)', retcode=1)
193  )
194
195  builder = 'Test-iOS-Clang-iPhone7-GPU-PowerVRGT7600-arm64-Release-All'
196  fail_step_name = 'install dm'
197  yield (
198      api.test('retry_ios_install') +
199      api.properties(buildername=builder,
200                     repository='https://skia.googlesource.com/skia.git',
201                     revision='abc123',
202                     path_config='kitchen',
203                     swarm_out_dir='[SWARM_OUT_DIR]') +
204      api.step_data(fail_step_name, retcode=1)
205  )
206
207  yield (
208      api.test('retry_ios_install_retries_exhausted') +
209      api.properties(buildername=builder,
210                     repository='https://skia.googlesource.com/skia.git',
211                     revision='abc123',
212                     path_config='kitchen',
213                     swarm_out_dir='[SWARM_OUT_DIR]') +
214      api.step_data(fail_step_name, retcode=1) +
215      api.step_data(fail_step_name + ' (attempt 2)', retcode=1)
216  )
217  fail_step_name = 'dm'
218  yield (
219      api.test('ios_rerun_with_debug') +
220      api.properties(buildername=builder,
221                     repository='https://skia.googlesource.com/skia.git',
222                     revision='abc123',
223                     path_config='kitchen',
224                     swarm_out_dir='[SWARM_OUT_DIR]') +
225      api.step_data(fail_step_name, retcode=1)
226  )
227
228  builder = ('Perf-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Debug-All'
229             '-Android')
230  yield (
231    api.test('cpu_scale_failed_once') +
232    api.properties(buildername=builder,
233                   revision='abc123',
234                   path_config='kitchen',
235                   swarm_out_dir='[SWARM_OUT_DIR]') +
236    api.step_data('Scale CPU 4 to 0.600000', retcode=1)
237  )
238
239  yield (
240    api.test('cpu_scale_failed') +
241    api.properties(buildername=builder,
242                   revision='abc123',
243                   path_config='kitchen',
244                   swarm_out_dir='[SWARM_OUT_DIR]') +
245    api.step_data('get swarming bot id',
246                  stdout=api.raw_io.output('skia-rpi-022')) +
247    api.step_data('Scale CPU 4 to 0.600000', retcode=1)+
248    api.step_data('Scale CPU 4 to 0.600000 (attempt 2)', retcode=1)+
249    api.step_data('Scale CPU 4 to 0.600000 (attempt 3)', retcode=1)
250  )
251
252  builder = ('Perf-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Release'
253             '-All-Android')
254  yield (
255    api.test('cpu_scale_failed_golo') +
256    api.properties(buildername=builder,
257                   revision='abc123',
258                   path_config='kitchen',
259                   swarm_out_dir='[SWARM_OUT_DIR]') +
260    api.step_data('get swarming bot id',
261                  stdout=api.raw_io.output('build123-m2--device5')) +
262    api.step_data('Scale CPU 4 to 0.600000', retcode=1)+
263    api.step_data('Scale CPU 4 to 0.600000 (attempt 2)', retcode=1)+
264    api.step_data('Scale CPU 4 to 0.600000 (attempt 3)', retcode=1)
265  )
266