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 else: 50 api.flavor.install(skps=True, images=True, lotties=False, svgs=True, 51 resources=True) 52 if 'Test' in api.properties['buildername']: 53 api.flavor.step('dm', ['dm', '--some-flag']) 54 api.flavor.copy_directory_contents_to_host( 55 api.flavor.device_dirs.dm_dir, api.flavor.host_dirs.dm_dir) 56 elif 'Perf' in api.properties['buildername']: 57 if 'SkottieTracing' in api.properties['buildername']: 58 api.flavor.step('dm', ['dm', '--some-flag'], skip_binary_push=True) 59 else: 60 api.flavor.step('nanobench', ['nanobench', '--some-flag']) 61 api.flavor.copy_directory_contents_to_host( 62 api.flavor.device_dirs.perf_data_dir, 63 api.flavor.host_dirs.perf_data_dir) 64 finally: 65 api.flavor.cleanup_steps() 66 api.run.check_failure() 67 68 69TEST_BUILDERS = [ 70 'Perf-Android-Clang-AndroidOne-GPU-Mali400MP2-arm-Release-All-Android_SkottieTracing', 71 'Perf-Android-Clang-GalaxyS7_G930FD-GPU-MaliT880-arm64-Debug-All-Android', 72 'Perf-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Debug-All-Android', 73 'Perf-Android-Clang-Pixel-GPU-Adreno530-arm64-Release-All-Android_Skpbench_Mskp', 74 'Perf-ChromeOS-Clang-SamsungChromebookPlus-GPU-MaliT860-arm-Release-All', 75 'Perf-Chromecast-Clang-Chorizo-CPU-Cortex_A7-arm-Release-All', 76 'Perf-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-MSAN', 77 'Perf-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-ASAN', 78 'Perf-Win2016-Clang-GCE-CPU-AVX2-x86_64-Debug-All-UBSAN', 79 'Test-Android-Clang-AndroidOne-GPU-Mali400MP2-arm-Release-All-Android', 80 'Test-Android-Clang-GalaxyS7_G930FD-GPU-MaliT880-arm64-Debug-All-Android', 81 'Test-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Debug-All-Android', 82 'Test-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Release-All-Android_ASAN', 83 'Test-ChromeOS-Clang-SamsungChromebookPlus-GPU-MaliT860-arm-Release-All', 84 'Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-Coverage', 85 'Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-Lottie', 86 'Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-TSAN', 87 'Test-Debian9-Clang-GCE-GPU-SwiftShader-x86_64-Debug-All-SwiftShader', 88 'Test-Debian9-Clang-NUC7i5BNK-GPU-IntelIris640-x86_64-Debug-All-OpenCL', 89 'Test-Debian9-Clang-NUC7i5BNK-GPU-IntelIris640-x86_64-Debug-All-Vulkan', 90 'Test-Mac10.13-Clang-MacBookPro11.5-CPU-AVX2-x86_64-Debug-All-ASAN', 91 ('Test-Ubuntu17-GCC-Golo-GPU-QuadroP400-x86_64-Release-All' 92 '-Valgrind_AbandonGpuContext_SK_CPU_LIMIT_SSE41'), 93 'Test-Win10-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-Vulkan_ProcDump', 94 'Test-Win10-MSVC-LenovoYogaC630-GPU-Adreno630-arm64-Debug-All-ANGLE', 95] 96 97# Default properties used for TEST_BUILDERS. 98defaultProps = lambda buildername: dict( 99 buildername=buildername, 100 repository='https://skia.googlesource.com/skia.git', 101 revision='abc123', 102 path_config='kitchen', 103 patch_set=2, 104 swarm_out_dir='[SWARM_OUT_DIR]' 105) 106 107def GenTests(api): 108 for buildername in TEST_BUILDERS: 109 test = ( 110 api.test(buildername) + 111 api.properties(**defaultProps(buildername)) 112 ) 113 if 'Win' in buildername and not 'LenovoYogaC630' in buildername: 114 test += api.platform('win', 64) 115 if 'Chromecast' in buildername: 116 test += api.step_data( 117 'read chromecast ip', 118 stdout=api.raw_io.output('192.168.1.2:5555')) 119 yield test 120 121 builder = 'Test-Debian9-GCC-GCE-CPU-AVX2-x86_64-Release-All' 122 yield ( 123 api.test('exceptions') + 124 api.properties(buildername=builder, 125 repository='https://skia.googlesource.com/skia.git', 126 revision='abc123', 127 path_config='kitchen', 128 swarm_out_dir='[SWARM_OUT_DIR]', 129 is_testing_exceptions='True') 130 ) 131 132 builder = ('Perf-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Debug-All' 133 '-Android') 134 yield ( 135 api.test('failed_infra_step') + 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 api.step_data('get swarming bot id', 142 stdout=api.raw_io.output('build123-m2--device5')) + 143 api.step_data('dump log', retcode=1) 144 ) 145 146 yield ( 147 api.test('failed_read_version') + 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('read /sdcard/revenge_of_the_skiabot/SK_IMAGE_VERSION', 154 retcode=1) 155 ) 156 157 yield ( 158 api.test('retry_adb_command') + 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('mkdir /sdcard/revenge_of_the_skiabot/resources', 165 retcode=1) 166 ) 167 168 fail_step_name = 'mkdir /sdcard/revenge_of_the_skiabot/resources' 169 yield ( 170 api.test('retry_adb_command_retries_exhausted') + 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('get swarming bot id', 177 stdout=api.raw_io.output('build123-m2--device5')) + 178 api.step_data(fail_step_name, retcode=1) + 179 api.step_data(fail_step_name + ' (attempt 2)', retcode=1) + 180 api.step_data(fail_step_name + ' (attempt 3)', retcode=1) 181 ) 182 183 builder = 'Test-iOS-Clang-iPhone7-GPU-PowerVRGT7600-arm64-Release-All' 184 fail_step_name = 'install_dm' 185 yield ( 186 api.test('retry_ios_install') + 187 api.properties(buildername=builder, 188 repository='https://skia.googlesource.com/skia.git', 189 revision='abc123', 190 path_config='kitchen', 191 swarm_out_dir='[SWARM_OUT_DIR]') + 192 api.step_data(fail_step_name, retcode=1) 193 ) 194 195 yield ( 196 api.test('retry_ios_install_retries_exhausted') + 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 api.step_data(fail_step_name + ' (attempt 2)', retcode=1) 204 ) 205 206 builder = ('Perf-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Debug-All' 207 '-Android') 208 yield ( 209 api.test('cpu_scale_failed_once') + 210 api.properties(buildername=builder, 211 revision='abc123', 212 path_config='kitchen', 213 swarm_out_dir='[SWARM_OUT_DIR]') + 214 api.step_data('Scale CPU 4 to 0.600000', retcode=1) 215 ) 216 217 yield ( 218 api.test('cpu_scale_failed') + 219 api.properties(buildername=builder, 220 revision='abc123', 221 path_config='kitchen', 222 swarm_out_dir='[SWARM_OUT_DIR]') + 223 api.step_data('get swarming bot id', 224 stdout=api.raw_io.output('skia-rpi-022')) + 225 api.step_data('Scale CPU 4 to 0.600000', retcode=1)+ 226 api.step_data('Scale CPU 4 to 0.600000 (attempt 2)', retcode=1)+ 227 api.step_data('Scale CPU 4 to 0.600000 (attempt 3)', retcode=1) 228 ) 229 230 builder = ('Perf-Android-Clang-Nexus5x-GPU-Adreno418-arm64-Release' 231 '-All-Android') 232 yield ( 233 api.test('cpu_scale_failed_golo') + 234 api.properties(buildername=builder, 235 revision='abc123', 236 path_config='kitchen', 237 swarm_out_dir='[SWARM_OUT_DIR]') + 238 api.step_data('get swarming bot id', 239 stdout=api.raw_io.output('build123-m2--device5')) + 240 api.step_data('Scale CPU 4 to 0.600000', retcode=1)+ 241 api.step_data('Scale CPU 4 to 0.600000 (attempt 2)', retcode=1)+ 242 api.step_data('Scale CPU 4 to 0.600000 (attempt 3)', retcode=1) 243 ) 244