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