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