1 # 2 # Copyright 2015 Google Inc. 3 # 4 # Use of this source code is governed by a BSD-style license that can be 5 # found in the LICENSE file. 6 # 7 8 #!/usr/bin/env python 9 10 usage = ''' 11 Write extra flags to outfile for DM based on the bot name: 12 $ python dm_flags.py outfile Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Debug 13 Or run self-tests: 14 $ python dm_flags.py test 15 ''' 16 17 import inspect 18 import json 19 import os 20 import sys 21 22 23 def lineno(): 24 caller = inspect.stack()[1] # Up one level to our caller. 25 return inspect.getframeinfo(caller[0]).lineno 26 27 28 cov_start = lineno()+1 # We care about coverage starting just past this def. 29 def get_args(bot): 30 args = [] 31 32 configs = ['565', '8888', 'gpu'] 33 34 if 'Android' not in bot: 35 configs.extend(('upright-matrix-8888', 'upright-matrix-gpu')) 36 args.extend('--matrix 0 1 1 0'.split(' ')) 37 38 if '-GCE-' in bot: 39 configs.append('sp-8888') 40 configs.extend(['twice-8888', '2ndpic-8888']) 41 configs.extend(['remote-8888', 'remote_cache-8888']) 42 43 if '-TSAN' not in bot: 44 if ('TegraK1' in bot or 45 'GTX550Ti' in bot or 46 'GTX660' in bot or 47 'GT610' in bot): 48 if 'Android' in bot: 49 configs.append('nvprmsaa4') 50 else: 51 configs.append('nvprmsaa16') 52 53 # The S4 crashes and the NP produces a long error stream when we run with 54 # MSAA. The Tegra2 and Tegra3 just don't support it. 55 if ('GalaxyS4' not in bot and 56 'NexusPlayer' not in bot and 57 'Tegra3' not in bot and 58 'iOS' not in bot): 59 if 'Android' in bot: 60 configs.append('msaa4') 61 else: 62 configs.append('msaa16') 63 # Runs out of memory on Android bots and Daisy. Everyone else seems fine. 64 if 'Android' not in bot and 'Daisy' not in bot: 65 configs.append('pdf') 66 configs.append('pdf_poppler') 67 68 # NP is running out of RAM when we run all these modes. skia:3255 69 if 'NexusPlayer' not in bot: 70 configs.extend(mode + '-8888' for mode in 71 ['serialize', 'tiles_rt', 'pic']) 72 73 if 'ANGLE' in bot: 74 configs.append('angle') 75 76 # We want to run gpudft on atleast the mali 400 77 if 'GalaxyS3' in bot: 78 configs.append('gpudft') 79 80 args.append('--config') 81 args.extend(configs) 82 83 # Run tests, gms, and image decoding tests everywhere. 84 # TODO: remove skp from default --src list? 85 args.extend('--src tests gm image'.split(' ')) 86 87 if 'GalaxyS' in bot: 88 args.extend(('--threads', '0')) 89 90 blacklist = [] 91 92 # Certain gm's on win7 gpu and pdf are never finishing and keeping the test 93 # running forever 94 if 'Win7' in bot: 95 blacklist.extend('msaa16 gm _ colorwheelnative'.split(' ')) 96 blacklist.extend('pdf gm _ fontmgr_iter_factory'.split(' ')) 97 98 if 'Valgrind' in bot: 99 # These take 18+ hours to run. 100 blacklist.extend('pdf gm _ fontmgr_iter'.split(' ')) 101 blacklist.extend('pdf _ _ PANO_20121023_214540.jpg'.split(' ')) 102 blacklist.extend('pdf skp _ worldjournal'.split(' ')) 103 blacklist.extend('pdf skp _ desk_baidu.skp'.split(' ')) 104 blacklist.extend('pdf skp _ desk_wikipedia.skp'.split(' ')) 105 106 if 'iOS' in bot: 107 blacklist.extend('gpu skp _ _ msaa skp _ _'.split(' ')) 108 blacklist.extend('msaa16 gm _ tilemodesProcess'.split(' ')) 109 110 # the 32-bit GCE bots run out of memory in DM when running these large images 111 if 'x86' in bot and not 'x86-64' in bot: 112 blacklist.extend('_ image _ interlaced1.png'.split(' ')) 113 blacklist.extend('_ image _ interlaced2.png'.split(' ')) 114 blacklist.extend('_ image _ interlaced3.png'.split(' ')) 115 116 # skia:4095 117 for test in ['not_native32_bitmap_config', 118 'bleed_image', 119 'bleed_alpha_image', 120 'bleed_alpha_image_shader', 121 'blend', 122 'c_gms', 123 'colortype', 124 'colortype_xfermodes', 125 'colorwheelnative', 126 'drawfilter', 127 'fontmgr_bounds_0.75_0', 128 'fontmgr_bounds_1_-0.25', 129 'fontmgr_bounds', 130 'fontmgr_match', 131 'fontmgr_iter', 132 'lightingshader', 133 'localmatriximagefilter', 134 'path_stroke_with_zero_length', 135 'textblobgeometrychange', 136 'verylargebitmap', # Windows only. 137 'verylarge_picture_image']: # Windows only. 138 blacklist.extend(['serialize-8888', 'gm', '_', test]) 139 # skia:4769 140 for test in ['blend', 141 'drawfilter', 142 'path_stroke_with_zero_length', 143 'textblobgeometrychange']: 144 blacklist.extend([ 'sp-8888', 'gm', '_', test]) 145 blacklist.extend([ 'pic-8888', 'gm', '_', test]) 146 blacklist.extend(['2ndpic-8888', 'gm', '_', test]) 147 for test in ['patch_primitive']: 148 blacklist.extend(['sp-8888', 'gm', '_', test]) 149 # skia:4703 150 for test in ['image-cacherator-from-picture', 151 'image-cacherator-from-raster', 152 'image-cacherator-from-ctable']: 153 blacklist.extend([ 'sp-8888', 'gm', '_', test]) 154 blacklist.extend([ 'pic-8888', 'gm', '_', test]) 155 blacklist.extend([ '2ndpic-8888', 'gm', '_', test]) 156 blacklist.extend(['serialize-8888', 'gm', '_', test]) 157 158 # Extensions for RAW images 159 r = ["arw", "cr2", "dng", "nef", "nrw", "orf", "raf", "rw2", "pef", "srw", 160 "ARW", "CR2", "DNG", "NEF", "NRW", "ORF", "RAF", "RW2", "PEF", "SRW"] 161 162 # skbug.com/4888 163 # Blacklist RAW images on GPU tests until we can resolve failures 164 if 'GPU' in bot: 165 for raw_ext in r: 166 blacklist.extend(('_ image _ .%s' % raw_ext).split(' ')) 167 168 # Blacklist RAW images on Win32 tests due to out-of-memory issue 169 if 'Win' in bot and not '64' in bot: 170 for raw_ext in r: 171 blacklist.extend(('_ image _ .%s' % raw_ext).split(' ')) 172 173 match = [] 174 if 'Valgrind' in bot: # skia:3021 175 match.append('~Threaded') 176 177 if 'GalaxyS3' in bot: # skia:1699 178 match.append('~WritePixels') 179 180 if 'AndroidOne' in bot: # skia:4711 181 match.append('~WritePixels') 182 183 if 'NexusPlayer' in bot: 184 match.append('~ResourceCache') 185 186 if 'GalaxyS4' in bot: # skia:4079 187 match.append('~imagefiltersclipped') 188 match.append('~imagefilterscropexpand') 189 match.append('~scaled_tilemodes_npot') 190 match.append('~bleed_image') # skia:4367 191 match.append('~ReadPixels') # skia:4368 192 193 if 'ANGLE' in bot and 'Debug' in bot: 194 match.append('~GLPrograms') # skia:4717 195 196 if 'MSAN' in bot: 197 match.extend(['~Once', '~Shared']) # Not sure what's up with these tests. 198 199 if blacklist: 200 args.append('--blacklist') 201 args.extend(blacklist) 202 203 if match: 204 args.append('--match') 205 args.extend(match) 206 207 # These bots run out of memory running RAW codec tests. Do not run them in 208 # parallel 209 if 'NexusPlayer' in bot or 'Nexus5' in bot or 'Nexus9' in bot: 210 args.append('--noRAW_threading') 211 212 return args 213 cov_end = lineno() # Don't care about code coverage past here. 214 215 216 def self_test(): 217 import coverage # This way the bots don't need coverage.py to be installed. 218 args = {} 219 cases = [ 220 'Pretend-iOS-Bot', 221 'Test-Android-GCC-AndroidOne-GPU-Mali400MP2-Arm7-Release', 222 'Test-Android-GCC-Nexus9-GPU-TegraK1-Arm64-Debug', 223 'Test-Android-GCC-GalaxyS3-GPU-Mali400-Arm7-Debug', 224 'Test-Android-GCC-GalaxyS4-GPU-SGX544-Arm7-Release', 225 'Test-Android-GCC-Nexus7-GPU-Tegra3-Arm7-Release', 226 'Test-Android-GCC-NexusPlayer-CPU-SSSE3-x86-Release', 227 'Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind', 228 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-MSAN', 229 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-TSAN', 230 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Valgrind', 231 'Test-Win7-MSVC-ShuttleA-GPU-HD2000-x86-Debug-ANGLE', 232 'Test-Mac10.8-Clang-MacMini4.1-CPU-SSE4-x86_64-Release', 233 ] 234 235 cov = coverage.coverage() 236 cov.start() 237 for case in cases: 238 args[case] = get_args(case) 239 cov.stop() 240 241 this_file = os.path.basename(__file__) 242 _, _, not_run, _ = cov.analysis(this_file) 243 filtered = [line for line in not_run if line > cov_start and line < cov_end] 244 if filtered: 245 print 'Lines not covered by test cases: ', filtered 246 sys.exit(1) 247 248 golden = this_file.replace('.py', '.json') 249 with open(os.path.join(os.path.dirname(__file__), golden), 'w') as f: 250 json.dump(args, f, indent=2, sort_keys=True) 251 252 253 if __name__ == '__main__': 254 if len(sys.argv) == 2 and sys.argv[1] == 'test': 255 self_test() 256 sys.exit(0) 257 258 if len(sys.argv) != 3: 259 print usage 260 sys.exit(1) 261 262 with open(sys.argv[1], 'w') as out: 263 json.dump(get_args(sys.argv[2]), out) 264