blob: 9704e63101fcda76a153b21f7f29667fc5e50142 [file] [log] [blame]
msarett114912d2015-03-25 12:28:33 -07001#
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
mtklein11a2c502015-02-24 09:25:16 -08008#!/usr/bin/env python
9
10usage = '''
11Write extra flags to outfile for DM based on the bot name:
borenet1e37d172015-03-27 05:42:18 -070012 $ python dm_flags.py outfile Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Debug
mtklein11a2c502015-02-24 09:25:16 -080013Or run self-tests:
14 $ python dm_flags.py test
15'''
16
17import inspect
18import json
19import os
20import sys
21
22
23def lineno():
24 caller = inspect.stack()[1] # Up one level to our caller.
25 return inspect.getframeinfo(caller[0]).lineno
26
27
28cov_start = lineno()+1 # We care about coverage starting just past this def.
mtkleinf73e5892015-02-24 11:45:11 -080029def get_args(bot):
mtklein11a2c502015-02-24 09:25:16 -080030 args = []
31
borenetd9b6be12015-05-06 08:33:51 -070032 configs = ['565', '8888', 'gpu']
borenete3aeaec2015-05-05 13:11:27 -070033
borenetd9b6be12015-05-06 08:33:51 -070034 if 'Android' not in bot:
35 configs.extend(('upright-matrix-8888', 'upright-matrix-gpu'))
36 args.extend('--matrix 0 1 1 0'.split(' '))
mtkleinfca5c882015-04-21 10:34:47 -070037
mtklein32618cb2015-05-07 10:26:44 -070038 if '-GCE-' in bot:
39 configs.append('sp-8888')
40
mtkleinfca5c882015-04-21 10:34:47 -070041 if 'TegraK1' in bot or 'GTX550Ti' in bot or 'GTX660' in bot or 'GT610' in bot:
42 if 'Android' in bot:
43 configs.append('nvprmsaa4')
44 else:
45 configs.append('nvprmsaa16')
46
bsalomon5abf5842015-02-27 10:13:36 -080047 # The S4 crashes and the NP produces a long error stream when we run with
mtkleind5574622015-04-21 11:25:47 -070048 # MSAA. The Tegra2 and Tegra3 just don't support it.
bsalomon5abf5842015-02-27 10:13:36 -080049 if ('GalaxyS4' not in bot and
mtkleind5574622015-04-21 11:25:47 -070050 'NexusPlayer' not in bot and
stephanadeee2982015-05-05 07:55:06 -070051 'Tegra3' not in bot and
52 'iOS' not in bot):
bsalomon5abf5842015-02-27 10:13:36 -080053 if 'Android' in bot:
mtkleinfca5c882015-04-21 10:34:47 -070054 configs.append('msaa4')
bsalomon5abf5842015-02-27 10:13:36 -080055 else:
mtkleinfca5c882015-04-21 10:34:47 -070056 configs.append('msaa16')
mtklein82b33db2015-03-04 13:58:05 -080057 # Runs out of memory on Android bots and Daisy. Everyone else seems fine.
mtklein150d3502015-03-05 13:38:17 -080058 if 'Android' not in bot and 'Daisy' not in bot:
mtklein84aada82015-03-04 11:47:11 -080059 configs.append('pdf')
bsalomon5abf5842015-02-27 10:13:36 -080060
borenet97025e32015-04-28 09:54:55 -070061 # NP is running out of RAM when we run all these modes. skia:3255
62 if 'NexusPlayer' not in bot:
mtklein11a2c502015-02-24 09:25:16 -080063 configs.extend(mode + '-8888' for mode in
64 ['serialize', 'tiles_rt', 'pipe'])
bsalomon0bb8c1f2015-06-04 15:10:45 -070065
mtkleinee2a3ea2015-02-25 08:16:19 -080066 if 'ANGLE' in bot:
67 configs.append('angle')
mtklein11a2c502015-02-24 09:25:16 -080068 args.append('--config')
69 args.extend(configs)
70
mtklein1866b572015-06-12 11:31:51 -070071 # Run tests and gms everywhere,
72 # and image decoding tests everywhere except GPU bots.
73 # TODO: remove skp from default --src list?
74 if 'GPU' in bot:
75 args.extend('--src tests gm'.split(' '))
76 else:
77 args.extend('--src tests gm image'.split(' '))
78
borenet97025e32015-04-28 09:54:55 -070079 if 'GalaxyS' in bot:
80 args.extend(('--threads', '0'))
81
mtklein11a2c502015-02-24 09:25:16 -080082 blacklist = []
scroggoc1121ef2015-07-16 12:36:10 -070083
msarett114912d2015-03-25 12:28:33 -070084 # Several of the newest version bmps fail on SkImageDecoder
djsollen54416de2015-04-03 07:24:48 -070085 blacklist.extend('_ image decode pal8os2v2.bmp'.split(' '))
86 blacklist.extend('_ image decode pal8v4.bmp'.split(' '))
87 blacklist.extend('_ image decode pal8v5.bmp'.split(' '))
88 blacklist.extend('_ image decode rgb16-565.bmp'.split(' '))
89 blacklist.extend('_ image decode rgb16-565pal.bmp'.split(' '))
90 blacklist.extend('_ image decode rgb32-111110.bmp'.split(' '))
91 blacklist.extend('_ image decode rgb32bf.bmp'.split(' '))
92 blacklist.extend('_ image decode rgba32.bmp'.split(' '))
93 blacklist.extend('_ image decode rgba32abf.bmp'.split(' '))
94 blacklist.extend('_ image decode rgb24largepal.bmp'.split(' '))
95 blacklist.extend('_ image decode pal8os2v2-16.bmp'.split(' '))
96 blacklist.extend('_ image decode pal8oversizepal.bmp'.split(' '))
msarett2f273a12015-04-06 08:38:49 -070097 blacklist.extend('_ image decode pal4rletrns.bmp'.split(' '))
98 blacklist.extend('_ image decode pal8rletrns.bmp'.split(' '))
msarett3c309db2015-04-10 14:36:48 -070099 blacklist.extend('_ image decode 4bpp-pixeldata-cropped.bmp'.split(' '))
100 blacklist.extend('_ image decode 8bpp-pixeldata-cropped.bmp'.split(' '))
101 blacklist.extend('_ image decode 24bpp-pixeldata-cropped.bmp'.split(' '))
102 blacklist.extend('_ image decode 32bpp-pixeldata-cropped.bmp'.split(' '))
djsollen54416de2015-04-03 07:24:48 -0700103 blacklist.extend('_ image subset rgb24largepal.bmp'.split(' '))
104 blacklist.extend('_ image subset pal8os2v2-16.bmp'.split(' '))
105 blacklist.extend('_ image subset pal8oversizepal.bmp'.split(' '))
msarett3c309db2015-04-10 14:36:48 -0700106 blacklist.extend('_ image subset 4bpp-pixeldata-cropped.bmp'.split(' '))
107 blacklist.extend('_ image subset 8bpp-pixeldata-cropped.bmp'.split(' '))
108 blacklist.extend('_ image subset 24bpp-pixeldata-cropped.bmp'.split(' '))
109 blacklist.extend('_ image subset 32bpp-pixeldata-cropped.bmp'.split(' '))
msarett114912d2015-03-25 12:28:33 -0700110
111 # New ico files that fail on SkImageDecoder
djsollen54416de2015-04-03 07:24:48 -0700112 blacklist.extend('_ image decode Hopstarter-Mac-Folders-Apple.ico'.split(' '))
msarett114912d2015-03-25 12:28:33 -0700113
mtkleine2aab902015-03-17 12:52:16 -0700114 # Leon doesn't care about this, so why run it?
115 if 'Win' in bot:
djsollen54416de2015-04-03 07:24:48 -0700116 blacklist.extend('_ image decode _'.split(' '))
117 blacklist.extend('_ image subset _'.split(' '))
mtkleine2aab902015-03-17 12:52:16 -0700118
egdaniel89c2a542015-03-19 13:09:17 -0700119 # Certain gm's on win7 gpu and pdf are never finishing and keeping the test
120 # running forever
121 if 'Win7' in bot:
djsollen54416de2015-04-03 07:24:48 -0700122 blacklist.extend('msaa16 gm _ colorwheelnative'.split(' '))
123 blacklist.extend('pdf gm _ fontmgr_iter_factory'.split(' '))
egdaniel89c2a542015-03-19 13:09:17 -0700124
mtklein150d3502015-03-05 13:38:17 -0800125 if 'Valgrind' in bot:
mtkleinde7665a2015-03-14 07:24:29 -0700126 # PDF + .webp -> jumps depending on uninitialized memory. skia:3505
djsollen54416de2015-04-03 07:24:48 -0700127 blacklist.extend('pdf _ _ .webp'.split(' '))
mtkleince866872015-03-26 05:12:13 -0700128 # These take 18+ hours to run.
djsollen54416de2015-04-03 07:24:48 -0700129 blacklist.extend('pdf gm _ fontmgr_iter'.split(' '))
130 blacklist.extend('pdf _ _ PANO_20121023_214540.jpg'.split(' '))
Mike Kleinfbcf0bd2015-04-09 06:03:22 -0400131 blacklist.extend('pdf skp _ worldjournal'.split(' '))
djsollen54416de2015-04-03 07:24:48 -0700132 blacklist.extend('pdf skp _ desk_baidu.skp'.split(' '))
borenet22ecae82015-04-13 13:29:26 -0700133 blacklist.extend('pdf skp _ desk_wikipedia.skp'.split(' '))
mtklein150d3502015-03-05 13:38:17 -0800134
stephanadeee2982015-05-05 07:55:06 -0700135 if 'iOS' in bot:
136 blacklist.extend('gpu skp _ _ msaa skp _ _'.split(' '))
137 blacklist.extend('gpu image decode _ msaa image decode _'.split(' '))
138 blacklist.extend('gpu image subset _ msaa image subset _'.split(' '))
139 blacklist.extend('msaa16 gm _ tilemodesProcess'.split(' '))
140
emmaleer8f4ba762015-08-14 07:44:46 -0700141 # the 32-bit GCE bots run out of memory in DM when running these large images
142 if 'x86' in bot and not 'x86-64' in bot:
143 blacklist.extend('_ image _ interlaced1.png'.split(' '))
144 blacklist.extend('_ image _ interlaced2.png'.split(' '))
145 blacklist.extend('_ image _ interlaced3.png'.split(' '))
146
mtklein11a2c502015-02-24 09:25:16 -0800147 if blacklist:
148 args.append('--blacklist')
149 args.extend(blacklist)
150
151 match = []
mtklein11a2c502015-02-24 09:25:16 -0800152 if 'Valgrind' in bot: # skia:3021
153 match.append('~Threaded')
herb19fb80e2015-06-30 14:23:29 -0700154 if 'TSAN' in bot: # skia:3562
155 match.append('~Math')
mtklein905d01b2015-03-18 14:06:55 -0700156
borenet97025e32015-04-28 09:54:55 -0700157 if 'GalaxyS3' in bot: # skia:1699
mtklein11a2c502015-02-24 09:25:16 -0800158 match.append('~WritePixels')
159
160 # skia:3249: these images flakily don't decode on Android.
161 if 'Android' in bot:
162 match.append('~tabl_mozilla_0')
163 match.append('~desk_yahoonews_0')
164
mtklein4e2d3be2015-03-10 11:55:18 -0700165 if 'NexusPlayer' in bot:
166 match.append('~ResourceCache')
167
stephanadeee2982015-05-05 07:55:06 -0700168 if 'iOS' in bot:
169 match.append('~WritePixels')
170
borenet9b8d3582015-07-21 05:57:22 -0700171 if 'GalaxyS4' in bot: # skia:4079
172 match.append('~imagefiltersclipped')
borenetcf72ed62015-08-25 06:53:37 -0700173 match.append('~scaled_tilemodes_npot')
borenet9b8d3582015-07-21 05:57:22 -0700174
mtklein11a2c502015-02-24 09:25:16 -0800175 if match:
176 args.append('--match')
177 args.extend(match)
178
mtklein11a2c502015-02-24 09:25:16 -0800179 return args
180cov_end = lineno() # Don't care about code coverage past here.
181
182
183def self_test():
184 import coverage # This way the bots don't need coverage.py to be installed.
185 args = {}
186 cases = [
mtkleine4b19c42015-05-05 10:28:44 -0700187 'Pretend-iOS-Bot',
mtkleinfca5c882015-04-21 10:34:47 -0700188 'Test-Android-GCC-Nexus9-GPU-TegraK1-Arm64-Debug',
borenet1e37d172015-03-27 05:42:18 -0700189 'Test-Android-GCC-GalaxyS3-GPU-Mali400-Arm7-Debug',
mtkleine4b19c42015-05-05 10:28:44 -0700190 'Test-Android-GCC-GalaxyS4-GPU-SGX544-Arm7-Release',
borenet1e37d172015-03-27 05:42:18 -0700191 'Test-Android-GCC-Nexus7-GPU-Tegra3-Arm7-Release',
192 'Test-Android-GCC-NexusPlayer-CPU-SSSE3-x86-Release',
borenet1e37d172015-03-27 05:42:18 -0700193 'Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind',
194 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-TSAN',
195 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Valgrind',
196 'Test-Win7-MSVC-ShuttleA-GPU-HD2000-x86-Debug-ANGLE',
mtklein11a2c502015-02-24 09:25:16 -0800197 ]
198
199 cov = coverage.coverage()
200 cov.start()
201 for case in cases:
mtkleinf73e5892015-02-24 11:45:11 -0800202 args[case] = get_args(case)
mtklein11a2c502015-02-24 09:25:16 -0800203 cov.stop()
204
205 this_file = os.path.basename(__file__)
206 _, _, not_run, _ = cov.analysis(this_file)
207 filtered = [line for line in not_run if line > cov_start and line < cov_end]
208 if filtered:
209 print 'Lines not covered by test cases: ', filtered
210 sys.exit(1)
211
212 golden = this_file.replace('.py', '.json')
213 with open(os.path.join(os.path.dirname(__file__), golden), 'w') as f:
214 json.dump(args, f, indent=2, sort_keys=True)
215
216
217if __name__ == '__main__':
218 if len(sys.argv) == 2 and sys.argv[1] == 'test':
219 self_test()
220 sys.exit(0)
221
222 if len(sys.argv) != 3:
223 print usage
224 sys.exit(1)
225
226 with open(sys.argv[1], 'w') as out:
mtkleinf73e5892015-02-24 11:45:11 -0800227 json.dump(get_args(sys.argv[2]), out)