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 = "PY3" 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-Android-Clang-Pixel6-GPU-Adreno620-arm64-Release-All-Android', 90 'Perf-ChromeOS-Clang-SamsungChromebookPlus-GPU-MaliT860-arm-Release-All', 91 'Perf-Debian10-Clang-GCE-CPU-AVX2-x86_64-Debug-All-MSAN', 92 'Perf-Debian10-Clang-GCE-CPU-AVX2-x86_64-Release-All-ASAN', 93 'Perf-Win2019-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN', 94 'Test-Android-Clang-AndroidOne-GPU-Mali400MP2-arm-Release-All-Android', 95 'Test-Android-Clang-GalaxyS7_G930FD-GPU-MaliT880-arm64-Debug-All-Android', 96 'Test-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Debug-All-Android', 97 'Test-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Release-All-Android_ASAN', 98 'Test-Android-Clang-Pixel3a-GPU-Adreno615-arm64-Debug-All-Android_Vulkan', 99 'Test-ChromeOS-Clang-SamsungChromebookPlus-GPU-MaliT860-arm-Release-All', 100 'Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Debug-All-Coverage', 101 'Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Release-All-Lottie', 102 'Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Release-All-TSAN', 103 'Test-Debian10-Clang-GCE-GPU-SwiftShader-x86_64-Debug-All-SwiftShader', 104 'Test-Debian10-Clang-NUC7i5BNK-GPU-IntelIris640-x86_64-Debug-All-Vulkan', 105 'Test-Mac10.13-Clang-MacBookPro11.5-CPU-AVX2-x86_64-Debug-All-ASAN', 106 ('Test-Ubuntu18-Clang-Golo-GPU-QuadroP400-x86_64-Release-All' 107 '-Valgrind_AbandonGpuContext_SK_CPU_LIMIT_SSE41'), 108 'Test-Debian10-Clang-NUC7i5BNK-GPU-IntelIris640-x86_64-Debug-All-ASAN_Vulkan', 109 'Test-Debian11-Clang-NUC11TZi5-GPU-IntelIrisXe-x86_64-Debug-All', 110] 111 112# Default properties used for TEST_BUILDERS. 113defaultProps = lambda buildername: dict( 114 buildername=buildername, 115 repository='https://skia.googlesource.com/skia.git', 116 revision='abc123', 117 path_config='kitchen', 118 patch_set=2, 119 swarm_out_dir='[SWARM_OUT_DIR]' 120) 121 122def GenTests(api): 123 for buildername in TEST_BUILDERS: 124 test = ( 125 api.test(buildername) + 126 api.properties(**defaultProps(buildername)) 127 ) 128 if 'Win' in buildername: 129 test += api.platform('win', 64) 130 yield test 131 132 builder = 'Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Release-All' 133 yield ( 134 api.test('exceptions') + 135 api.properties(buildername=builder, 136 repository='https://skia.googlesource.com/skia.git', 137 revision='abc123', 138 path_config='kitchen', 139 swarm_out_dir='[SWARM_OUT_DIR]', 140 is_testing_exceptions='True') 141 ) 142 143 builder = ('Perf-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Debug-All' 144 '-Android') 145 yield ( 146 api.test('failed_infra_step') + 147 api.properties(buildername=builder, 148 repository='https://skia.googlesource.com/skia.git', 149 revision='abc123', 150 path_config='kitchen', 151 swarm_out_dir='[SWARM_OUT_DIR]') + 152 api.step_data('get swarming bot id', 153 stdout=api.raw_io.output('build123-m2--device5')) + 154 api.step_data('dump log', retcode=1) 155 ) 156 157 yield ( 158 api.test('failed_read_version') + 159 api.properties(buildername=builder, 160 repository='https://skia.googlesource.com/skia.git', 161 revision='abc123', 162 path_config='kitchen', 163 swarm_out_dir='[SWARM_OUT_DIR]') + 164 api.step_data('read /sdcard/revenge_of_the_skiabot/SK_IMAGE_VERSION', 165 retcode=1) 166 ) 167 168 yield ( 169 api.test('retry_adb_command') + 170 api.properties(buildername=builder, 171 repository='https://skia.googlesource.com/skia.git', 172 revision='abc123', 173 path_config='kitchen', 174 swarm_out_dir='[SWARM_OUT_DIR]') + 175 api.step_data('mkdir /sdcard/revenge_of_the_skiabot/resources', 176 retcode=1) 177 ) 178 179 fail_step_name = 'mkdir /sdcard/revenge_of_the_skiabot/resources' 180 yield ( 181 api.test('retry_adb_command_retries_exhausted') + 182 api.properties(buildername=builder, 183 repository='https://skia.googlesource.com/skia.git', 184 revision='abc123', 185 path_config='kitchen', 186 swarm_out_dir='[SWARM_OUT_DIR]') + 187 api.step_data('get swarming bot id', 188 stdout=api.raw_io.output('build123-m2--device5')) + 189 api.step_data(fail_step_name, retcode=1) + 190 api.step_data(fail_step_name + ' (attempt 2)', retcode=1) + 191 api.step_data(fail_step_name + ' (attempt 3)', retcode=1) 192 ) 193 194 builder = 'Test-iOS-Clang-iPhone7-GPU-PowerVRGT7600-arm64-Release-All' 195 fail_step_name = 'install dm' 196 yield ( 197 api.test('retry_ios_install') + 198 api.properties(buildername=builder, 199 repository='https://skia.googlesource.com/skia.git', 200 revision='abc123', 201 path_config='kitchen', 202 swarm_out_dir='[SWARM_OUT_DIR]') + 203 api.step_data(fail_step_name, retcode=1) 204 ) 205 206 yield ( 207 api.test('retry_ios_install_retries_exhausted') + 208 api.properties(buildername=builder, 209 repository='https://skia.googlesource.com/skia.git', 210 revision='abc123', 211 path_config='kitchen', 212 swarm_out_dir='[SWARM_OUT_DIR]') + 213 api.step_data(fail_step_name, retcode=1) + 214 api.step_data(fail_step_name + ' (attempt 2)', retcode=1) 215 ) 216 fail_step_name = 'dm' 217 yield ( 218 api.test('ios_rerun_with_debug') + 219 api.properties(buildername=builder, 220 repository='https://skia.googlesource.com/skia.git', 221 revision='abc123', 222 path_config='kitchen', 223 swarm_out_dir='[SWARM_OUT_DIR]') + 224 api.step_data(fail_step_name, retcode=1) 225 ) 226 227 builder = ('Perf-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Debug-All' 228 '-Android') 229 yield ( 230 api.test('cpu_scale_failed_once') + 231 api.properties(buildername=builder, 232 revision='abc123', 233 path_config='kitchen', 234 swarm_out_dir='[SWARM_OUT_DIR]') + 235 api.step_data('Scale CPU 4 to 0.600000', retcode=1) 236 ) 237 238 yield ( 239 api.test('cpu_scale_failed') + 240 api.properties(buildername=builder, 241 revision='abc123', 242 path_config='kitchen', 243 swarm_out_dir='[SWARM_OUT_DIR]') + 244 api.step_data('get swarming bot id', 245 stdout=api.raw_io.output('skia-rpi-022')) + 246 api.step_data('Scale CPU 4 to 0.600000', retcode=1)+ 247 api.step_data('Scale CPU 4 to 0.600000 (attempt 2)', retcode=1)+ 248 api.step_data('Scale CPU 4 to 0.600000 (attempt 3)', retcode=1) 249 ) 250 251 builder = ('Perf-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Release' 252 '-All-Android') 253 yield ( 254 api.test('cpu_scale_failed_golo') + 255 api.properties(buildername=builder, 256 revision='abc123', 257 path_config='kitchen', 258 swarm_out_dir='[SWARM_OUT_DIR]') + 259 api.step_data('get swarming bot id', 260 stdout=api.raw_io.output('build123-m2--device5')) + 261 api.step_data('Scale CPU 4 to 0.600000', retcode=1)+ 262 api.step_data('Scale CPU 4 to 0.600000 (attempt 2)', retcode=1)+ 263 api.step_data('Scale CPU 4 to 0.600000 (attempt 3)', retcode=1) 264 ) 265