OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 | |
3 usage = ''' | |
4 Write 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 | |
6 Or run self-tests: | |
7 $ python dm_flags.py test | |
8 ''' | |
9 | |
borenet
2015/02/24 14:39:45
Nit: 2 lines between top-level defs
mtklein
2015/02/24 15:02:30
Done.
| |
10 import inspect | |
11 import json | |
12 import os | |
13 import sys | |
14 | |
15 def lineno(): | |
16 caller = inspect.stack()[1] # Up one level to our caller. | |
17 return inspect.getframeinfo(caller[0]).lineno | |
18 | |
19 cov_start = lineno()+1 # We care about coverage starting just past this def. | |
20 def get_dm_args(bot): | |
21 args = [] | |
22 | |
23 configs = ['565', '8888', 'gpu', 'nvprmsaa'] | |
24 # Xoom and NP are running out of RAM when we run all these modes. skia:3255 | |
25 if ('Xoom' not in bot and | |
26 'NexusPlayer' not in bot): | |
27 configs.extend(mode + '-8888' for mode in | |
28 ['serialize', 'tiles_rt', 'pipe']) | |
29 configs.append('tiles_rt-gpu') | |
30 if 'ANGLE' in bot: | |
31 configs.append('angle') | |
32 args.append('--config') | |
33 args.extend(configs) | |
34 | |
35 blacklist = [] | |
36 # This image is too large to be a texture for many GPUs. | |
37 blacklist.extend('gpu _ PANO_20121023_214540.jpg'.split(' ')) | |
38 blacklist.extend('msaa _ PANO_20121023_214540.jpg'.split(' ')) | |
39 | |
40 # Drawing SKPs or images into GPU canvases is a New Thing. | |
41 # It seems like we're running out of RAM on some Android bots, so start off | |
42 # with a very wide blacklist disabling all these tests on all Android bots. | |
43 if 'Android' in bot: # skia:3255 | |
44 blacklist.extend('gpu skp _ gpu image _ gpu subset _'.split(' ')) | |
45 blacklist.extend('msaa skp _ msaa image _ gpu subset _'.split(' ')) | |
46 | |
47 if blacklist: | |
48 args.append('--blacklist') | |
49 args.extend(blacklist) | |
50 | |
51 match = [] | |
52 if 'Alex' in bot: # skia:2793 | |
53 # This machine looks to be running out of heap. | |
54 # Running with fewer threads may help. | |
55 args.extend(['--threads', '1']) | |
56 if 'Valgrind' in bot: # skia:3021 | |
57 match.append('~Threaded') | |
58 if 'Xoom' in bot: # skia:1699 | |
59 match.append('~WritePixels') | |
60 | |
61 # skia:3249: these images flakily don't decode on Android. | |
62 if 'Android' in bot: | |
63 match.append('~tabl_mozilla_0') | |
64 match.append('~desk_yahoonews_0') | |
65 | |
66 if match: | |
67 args.append('--match') | |
68 args.extend(match) | |
69 | |
70 # Though their GPUs are interesting, these don't test anything on | |
71 # the CPU that other ARMv7+NEON bots don't test faster (N5). | |
72 if ('Nexus10' in bot or | |
73 'Nexus7' in bot or | |
74 'GalaxyS3' in bot or | |
75 'GalaxyS4' in bot): | |
76 args.append('--nocpu') | |
77 return args | |
78 cov_end = lineno() # Don't care about code coverage past here. | |
79 | |
80 def self_test(): | |
81 import coverage # This way the bots don't need coverage.py to be installed. | |
82 args = {} | |
83 cases = [ | |
84 'Test-Android-Nexus7-Tegra3-Arm7-Release', | |
85 'Test-Android-Xoom-Tegra2-Arm7-Release', | |
86 'Test-ChromeOS-Alex-GMA3150-x86-Debug', | |
87 'Test-Ubuntu12-ShuttleA-GTX550Ti-x86_64-Release-Valgrind', | |
88 'Test-Win7-ShuttleA-HD2000-x86-Debug-ANGLE', | |
89 ] | |
90 | |
91 cov = coverage.coverage() | |
92 cov.start() | |
93 for case in cases: | |
94 args[case] = get_dm_args(case) | |
95 cov.stop() | |
96 | |
97 this_file = os.path.basename(__file__) | |
98 _, _, not_run, _ = cov.analysis(this_file) | |
99 filtered = [line for line in not_run if line > cov_start and line < cov_end] | |
100 if filtered: | |
101 print 'Lines not covered by test cases: ', filtered | |
102 sys.exit(1) | |
103 | |
104 golden = this_file.replace('.py', '.json') | |
105 with open(os.path.join(os.path.dirname(__file__), golden), 'w') as f: | |
106 json.dump(args, f, indent=2, sort_keys=True) | |
107 | |
108 if __name__ == '__main__': | |
109 if len(sys.argv) == 2 and sys.argv[1] == 'test': | |
110 self_test() | |
111 sys.exit(0) | |
112 | |
113 if len(sys.argv) < 3: | |
borenet
2015/02/24 14:39:45
!=
mtklein
2015/02/24 15:02:30
Done.
| |
114 print usage | |
115 sys.exit(1) | |
116 | |
117 with open(sys.argv[1], 'w') as out: | |
118 json.dump(get_dm_args(sys.argv[2]), out) | |
OLD | NEW |