blob: 583d4f2b479f96508d459b7fb63a5104194245e7 [file] [log] [blame]
mtklein11a2c502015-02-24 09:25:16 -08001#!/usr/bin/env python
2
3usage = '''
4Write extra flags to outfile for DM based on the bot name:
5 $ python dm_flags.py outfile Test-Mac10.9-MacMini6.2-HD4000-x86_64-Release
6Or run self-tests:
7 $ python dm_flags.py test
8'''
9
10import inspect
11import json
12import os
13import sys
14
15
16def lineno():
17 caller = inspect.stack()[1] # Up one level to our caller.
18 return inspect.getframeinfo(caller[0]).lineno
19
20
21cov_start = lineno()+1 # We care about coverage starting just past this def.
mtkleinf73e5892015-02-24 11:45:11 -080022def get_args(bot):
mtklein11a2c502015-02-24 09:25:16 -080023 args = []
24
mtklein341c8082015-03-02 09:51:44 -080025 configs = ['565', '8888', 'gpu']
bsalomon5abf5842015-02-27 10:13:36 -080026 # The S4 crashes and the NP produces a long error stream when we run with
27 # MSAA.
28 if ('GalaxyS4' not in bot and
29 'NexusPlayer' not in bot):
30 if 'Android' in bot:
31 configs.extend(['msaa4', 'nvprmsaa4'])
32 else:
33 configs.extend(['msaa16', 'nvprmsaa16'])
mtklein82b33db2015-03-04 13:58:05 -080034 # Runs out of memory on Android bots and Daisy. Everyone else seems fine.
mtklein13e8e232015-03-05 13:06:30 -080035 # Valgrind: PDF + .webp -> jumps depending on uninitialized memory. skia:3505
36 if 'Android' not in bot and 'Daisy' not in bot and 'Valgrind' not in bot:
mtklein84aada82015-03-04 11:47:11 -080037 configs.append('pdf')
bsalomon5abf5842015-02-27 10:13:36 -080038
mtklein11a2c502015-02-24 09:25:16 -080039 # Xoom and NP are running out of RAM when we run all these modes. skia:3255
40 if ('Xoom' not in bot and
41 'NexusPlayer' not in bot):
42 configs.extend(mode + '-8888' for mode in
43 ['serialize', 'tiles_rt', 'pipe'])
44 configs.append('tiles_rt-gpu')
mtkleinee2a3ea2015-02-25 08:16:19 -080045 if 'ANGLE' in bot:
46 configs.append('angle')
mtklein11a2c502015-02-24 09:25:16 -080047 args.append('--config')
48 args.extend(configs)
49
50 blacklist = []
51 # This image is too large to be a texture for many GPUs.
52 blacklist.extend('gpu _ PANO_20121023_214540.jpg'.split(' '))
53 blacklist.extend('msaa _ PANO_20121023_214540.jpg'.split(' '))
54
55 # Drawing SKPs or images into GPU canvases is a New Thing.
56 # It seems like we're running out of RAM on some Android bots, so start off
57 # with a very wide blacklist disabling all these tests on all Android bots.
58 if 'Android' in bot: # skia:3255
59 blacklist.extend('gpu skp _ gpu image _ gpu subset _'.split(' '))
60 blacklist.extend('msaa skp _ msaa image _ gpu subset _'.split(' '))
61
62 if blacklist:
63 args.append('--blacklist')
64 args.extend(blacklist)
65
66 match = []
67 if 'Alex' in bot: # skia:2793
68 # This machine looks to be running out of heap.
69 # Running with fewer threads may help.
70 args.extend(['--threads', '1'])
71 if 'Valgrind' in bot: # skia:3021
72 match.append('~Threaded')
73 if 'Xoom' in bot: # skia:1699
74 match.append('~WritePixels')
75
76 # skia:3249: these images flakily don't decode on Android.
77 if 'Android' in bot:
78 match.append('~tabl_mozilla_0')
79 match.append('~desk_yahoonews_0')
80
81 if match:
82 args.append('--match')
83 args.extend(match)
84
85 # Though their GPUs are interesting, these don't test anything on
86 # the CPU that other ARMv7+NEON bots don't test faster (N5).
87 if ('Nexus10' in bot or
88 'Nexus7' in bot or
89 'GalaxyS3' in bot or
90 'GalaxyS4' in bot):
91 args.append('--nocpu')
92 return args
93cov_end = lineno() # Don't care about code coverage past here.
94
95
96def self_test():
97 import coverage # This way the bots don't need coverage.py to be installed.
98 args = {}
99 cases = [
100 'Test-Android-Nexus7-Tegra3-Arm7-Release',
101 'Test-Android-Xoom-Tegra2-Arm7-Release',
102 'Test-ChromeOS-Alex-GMA3150-x86-Debug',
103 'Test-Ubuntu12-ShuttleA-GTX550Ti-x86_64-Release-Valgrind',
mtkleinee2a3ea2015-02-25 08:16:19 -0800104 'Test-Win7-ShuttleA-HD2000-x86-Debug-ANGLE',
mtklein11a2c502015-02-24 09:25:16 -0800105 ]
106
107 cov = coverage.coverage()
108 cov.start()
109 for case in cases:
mtkleinf73e5892015-02-24 11:45:11 -0800110 args[case] = get_args(case)
mtklein11a2c502015-02-24 09:25:16 -0800111 cov.stop()
112
113 this_file = os.path.basename(__file__)
114 _, _, not_run, _ = cov.analysis(this_file)
115 filtered = [line for line in not_run if line > cov_start and line < cov_end]
116 if filtered:
117 print 'Lines not covered by test cases: ', filtered
118 sys.exit(1)
119
120 golden = this_file.replace('.py', '.json')
121 with open(os.path.join(os.path.dirname(__file__), golden), 'w') as f:
122 json.dump(args, f, indent=2, sort_keys=True)
123
124
125if __name__ == '__main__':
126 if len(sys.argv) == 2 and sys.argv[1] == 'test':
127 self_test()
128 sys.exit(0)
129
130 if len(sys.argv) != 3:
131 print usage
132 sys.exit(1)
133
134 with open(sys.argv[1], 'w') as out:
mtkleinf73e5892015-02-24 11:45:11 -0800135 json.dump(get_args(sys.argv[2]), out)