Home | History | Annotate | Download | only in tools
      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 
     41   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 
     47   # The S4 crashes and the NP produces a long error stream when we run with
     48   # MSAA.  The Tegra2 and Tegra3 just don't support it.
     49   if ('GalaxyS4'    not in bot and
     50       'NexusPlayer' not in bot and
     51       'Tegra3'      not in bot and
     52       'iOS'         not in bot):
     53     if 'Android' in bot:
     54       configs.append('msaa4')
     55     else:
     56       configs.append('msaa16')
     57   # Runs out of memory on Android bots and Daisy.  Everyone else seems fine.
     58   if 'Android' not in bot and 'Daisy' not in bot:
     59     configs.append('pdf')
     60 
     61   # NP is running out of RAM when we run all these modes.  skia:3255
     62   if 'NexusPlayer' not in bot:
     63     configs.extend(mode + '-8888' for mode in
     64                    ['serialize', 'tiles_rt', 'pipe'])
     65     configs.append('tiles_rt-gpu')
     66   if 'ANGLE' in bot:
     67     configs.append('angle')
     68   args.append('--config')
     69   args.extend(configs)
     70 
     71   if 'GalaxyS' in bot:
     72     args.extend(('--threads', '0'))
     73 
     74   blacklist = []
     75   # This image is too large to be a texture for many GPUs.
     76   blacklist.extend('gpu _ _ PANO_20121023_214540.jpg'.split(' '))
     77   blacklist.extend('msaa _ _ PANO_20121023_214540.jpg'.split(' '))
     78 
     79   # Several of the newest version bmps fail on SkImageDecoder
     80   blacklist.extend('_ image decode pal8os2v2.bmp'.split(' '))
     81   blacklist.extend('_ image decode pal8v4.bmp'.split(' '))
     82   blacklist.extend('_ image decode pal8v5.bmp'.split(' '))
     83   blacklist.extend('_ image decode rgb16-565.bmp'.split(' '))
     84   blacklist.extend('_ image decode rgb16-565pal.bmp'.split(' '))
     85   blacklist.extend('_ image decode rgb32-111110.bmp'.split(' '))
     86   blacklist.extend('_ image decode rgb32bf.bmp'.split(' '))
     87   blacklist.extend('_ image decode rgba32.bmp'.split(' '))
     88   blacklist.extend('_ image decode rgba32abf.bmp'.split(' '))
     89   blacklist.extend('_ image decode rgb24largepal.bmp'.split(' '))
     90   blacklist.extend('_ image decode pal8os2v2-16.bmp'.split(' '))
     91   blacklist.extend('_ image decode pal8oversizepal.bmp'.split(' '))
     92   blacklist.extend('_ image decode pal4rletrns.bmp'.split(' '))
     93   blacklist.extend('_ image decode pal8rletrns.bmp'.split(' '))
     94   blacklist.extend('_ image decode 4bpp-pixeldata-cropped.bmp'.split(' '))
     95   blacklist.extend('_ image decode 8bpp-pixeldata-cropped.bmp'.split(' '))
     96   blacklist.extend('_ image decode 24bpp-pixeldata-cropped.bmp'.split(' '))
     97   blacklist.extend('_ image decode 32bpp-pixeldata-cropped.bmp'.split(' '))
     98   blacklist.extend('_ image subset rgb24largepal.bmp'.split(' '))
     99   blacklist.extend('_ image subset pal8os2v2-16.bmp'.split(' '))
    100   blacklist.extend('_ image subset pal8oversizepal.bmp'.split(' '))
    101   blacklist.extend('_ image subset 4bpp-pixeldata-cropped.bmp'.split(' '))
    102   blacklist.extend('_ image subset 8bpp-pixeldata-cropped.bmp'.split(' '))
    103   blacklist.extend('_ image subset 24bpp-pixeldata-cropped.bmp'.split(' '))
    104   blacklist.extend('_ image subset 32bpp-pixeldata-cropped.bmp'.split(' '))
    105 
    106   # New ico files that fail on SkImageDecoder
    107   blacklist.extend('_ image decode Hopstarter-Mac-Folders-Apple.ico'.split(' '))
    108 
    109   # Leon doesn't care about this, so why run it?
    110   if 'Win' in bot:
    111     blacklist.extend('_ image decode _'.split(' '))
    112     blacklist.extend('_ image subset _'.split(' '))
    113 
    114   # Certain gm's on win7 gpu and pdf are never finishing and keeping the test
    115   # running forever
    116   if 'Win7' in bot:
    117     blacklist.extend('msaa16 gm _ colorwheelnative'.split(' '))
    118     blacklist.extend('pdf gm _ fontmgr_iter_factory'.split(' '))
    119 
    120   # Drawing SKPs or images into GPU canvases is a New Thing.
    121   # It seems like we're running out of RAM on some Android bots, so start off
    122   # with a very wide blacklist disabling all these tests on all Android bots.
    123   if 'Android' in bot:  # skia:3255
    124     blacklist.extend('gpu skp _ _ msaa skp _ _'.split(' '))
    125     blacklist.extend('gpu image decode _ msaa image decode _'.split(' '))
    126     blacklist.extend('gpu image subset _ msaa image subset _'.split(' '))
    127 
    128   if 'Valgrind' in bot:
    129     # PDF + .webp -> jumps depending on uninitialized memory.  skia:3505
    130     blacklist.extend('pdf _ _ .webp'.split(' '))
    131     # These take 18+ hours to run.
    132     blacklist.extend('pdf gm _ fontmgr_iter'.split(' '))
    133     blacklist.extend('pdf _ _ PANO_20121023_214540.jpg'.split(' '))
    134     blacklist.extend('pdf skp _ worldjournal'.split(' '))
    135     blacklist.extend('pdf skp _ desk_baidu.skp'.split(' '))
    136     blacklist.extend('pdf skp _ desk_wikipedia.skp'.split(' '))
    137 
    138   if 'iOS' in bot:
    139     blacklist.extend('gpu skp _ _ msaa skp _ _'.split(' '))
    140     blacklist.extend('gpu image decode _ msaa image decode _'.split(' '))
    141     blacklist.extend('gpu image subset _ msaa image subset _'.split(' '))
    142     blacklist.extend('msaa16 gm _ tilemodesProcess'.split(' '))
    143 
    144   if 'GalaxyS4' in bot:
    145     # This occasionally runs forever. skia:3802
    146     blacklist.extend('tiles_rt-gpu gm _ imagefilterscropped'.split(' '))
    147 
    148   if blacklist:
    149     args.append('--blacklist')
    150     args.extend(blacklist)
    151 
    152   match = []
    153   if 'Valgrind' in bot: # skia:3021
    154     match.append('~Threaded')
    155   if 'TSAN' in bot: # skia:3562
    156     match.append('~Math')
    157 
    158   if 'GalaxyS3' in bot:  # skia:1699
    159     match.append('~WritePixels')
    160 
    161   # skia:3249: these images flakily don't decode on Android.
    162   if 'Android' in bot:
    163     match.append('~tabl_mozilla_0')
    164     match.append('~desk_yahoonews_0')
    165 
    166   if 'NexusPlayer' in bot:
    167     match.append('~ResourceCache')
    168 
    169   if 'iOS' in bot:
    170     match.append('~WritePixels')
    171 
    172   if match:
    173     args.append('--match')
    174     args.extend(match)
    175 
    176   return args
    177 cov_end = lineno()   # Don't care about code coverage past here.
    178 
    179 
    180 def self_test():
    181   import coverage  # This way the bots don't need coverage.py to be installed.
    182   args = {}
    183   cases = [
    184     'Pretend-iOS-Bot',
    185     'Test-Android-GCC-Nexus9-GPU-TegraK1-Arm64-Debug',
    186     'Test-Android-GCC-GalaxyS3-GPU-Mali400-Arm7-Debug',
    187     'Test-Android-GCC-GalaxyS4-GPU-SGX544-Arm7-Release',
    188     'Test-Android-GCC-Nexus7-GPU-Tegra3-Arm7-Release',
    189     'Test-Android-GCC-NexusPlayer-CPU-SSSE3-x86-Release',
    190     'Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind',
    191     'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-TSAN',
    192     'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Valgrind',
    193     'Test-Win7-MSVC-ShuttleA-GPU-HD2000-x86-Debug-ANGLE',
    194   ]
    195 
    196   cov = coverage.coverage()
    197   cov.start()
    198   for case in cases:
    199     args[case] = get_args(case)
    200   cov.stop()
    201 
    202   this_file = os.path.basename(__file__)
    203   _, _, not_run, _ = cov.analysis(this_file)
    204   filtered = [line for line in not_run if line > cov_start and line < cov_end]
    205   if filtered:
    206     print 'Lines not covered by test cases: ', filtered
    207     sys.exit(1)
    208 
    209   golden = this_file.replace('.py', '.json')
    210   with open(os.path.join(os.path.dirname(__file__), golden), 'w') as f:
    211     json.dump(args, f, indent=2, sort_keys=True)
    212 
    213 
    214 if __name__ == '__main__':
    215   if len(sys.argv) == 2 and sys.argv[1] == 'test':
    216     self_test()
    217     sys.exit(0)
    218 
    219   if len(sys.argv) != 3:
    220     print usage
    221     sys.exit(1)
    222 
    223   with open(sys.argv[1], 'w') as out:
    224     json.dump(get_args(sys.argv[2]), out)
    225