1# Copyright 2016 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5 6# Recipe module for Skia Swarming compile. 7 8 9DEPS = [ 10 'build', 11 'checkout', 12 'recipe_engine/context', 13 'recipe_engine/file', 14 'recipe_engine/json', 15 'recipe_engine/path', 16 'recipe_engine/platform', 17 'recipe_engine/properties', 18 'recipe_engine/python', 19 'recipe_engine/step', 20 'run', 21 'vars', 22] 23 24 25def RunSteps(api): 26 api.vars.setup() 27 28 # Check out code. 29 bot_update = True 30 checkout_root = api.checkout.default_checkout_root 31 checkout_chromium = False 32 checkout_flutter = False 33 flutter_android = False 34 parent_rev = False 35 36 if 'NoDEPS' in api.properties['buildername']: 37 bot_update = False 38 checkout_root = api.path['start_dir'] 39 if 'CommandBuffer' in api.vars.builder_name: 40 checkout_chromium = True 41 if 'Flutter' in api.vars.builder_name: 42 checkout_root = checkout_root.join('flutter') 43 checkout_flutter = True 44 if 'Android' in api.vars.builder_name: 45 flutter_android = True 46 if 'ParentRevision' in api.vars.builder_name: 47 parent_rev = True 48 49 if bot_update: 50 api.checkout.bot_update( 51 checkout_root=checkout_root, 52 checkout_chromium=checkout_chromium, 53 checkout_flutter=checkout_flutter, 54 flutter_android=flutter_android, 55 parent_rev=parent_rev) 56 else: 57 api.checkout.git(checkout_root=checkout_root) 58 59 api.file.ensure_directory('makedirs tmp_dir', api.vars.tmp_dir) 60 61 out_dir = checkout_root.join( 62 'skia', 'out', api.vars.builder_name, api.vars.configuration) 63 if 'Flutter' in api.vars.builder_name: 64 out_dir = checkout_root.join('src', 'out', 'android_release') 65 66 try: 67 api.build(checkout_root=checkout_root, out_dir=out_dir) 68 69 # TODO(borenet): Move this out of the try/finally. 70 dst = api.vars.swarming_out_dir 71 if 'ParentRevision' in api.vars.builder_name: 72 dst = api.vars.swarming_out_dir.join('ParentRevision') 73 api.build.copy_build_products(out_dir=out_dir, dst=dst) 74 if 'SKQP' in api.vars.extra_tokens: 75 wlist = checkout_root.join( 76 'skia', 'infra','cts', 'whitelist_devices.json') 77 api.file.copy('copy whitelist', wlist, dst) 78 finally: 79 if 'Win' in api.vars.builder_cfg.get('os', ''): 80 api.python.inline( 81 name='cleanup', 82 program='''import psutil 83for p in psutil.process_iter(): 84 try: 85 if p.name in ('mspdbsrv.exe', 'vctip.exe', 'cl.exe', 'link.exe'): 86 p.kill() 87 except psutil._error.AccessDenied: 88 pass 89''', 90 infra_step=True) 91 92 api.run.check_failure() 93 94 95TEST_BUILDERS = [ 96 'Build-Debian9-Clang-universal-devrel-Android_SKQP', 97 'Build-Debian9-Clang-x86_64-Release-ParentRevision', 98 'Build-Debian9-GCC-x86_64-Release-Flutter_Android', 99 'Build-Mac-Clang-x86_64-Debug-CommandBuffer', 100 'Build-Win10-Clang-x86_64-Release-NoDEPS', 101] 102 103 104def GenTests(api): 105 for builder in TEST_BUILDERS: 106 test = ( 107 api.test(builder) + 108 api.properties(buildername=builder, 109 repository='https://skia.googlesource.com/skia.git', 110 revision='abc123', 111 path_config='kitchen', 112 swarm_out_dir='[SWARM_OUT_DIR]') + 113 api.path.exists( 114 api.path['start_dir'].join('tmp', 'uninteresting_hashes.txt') 115 ) 116 ) 117 if 'Win' in builder: 118 test += api.platform('win', 64) 119 yield test 120