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