Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 """Recipe for the Skia RecreateSKPs Bot.""" | 6 """Recipe for the Skia RecreateSKPs Bot.""" |
| 7 | 7 |
| 8 | 8 |
| 9 DEPS = [ | 9 DEPS = [ |
| 10 'depot_tools/gclient', | 10 'depot_tools/gclient', |
| 11 'recipe_engine/path', | 11 'recipe_engine/path', |
| 12 'recipe_engine/properties', | 12 'recipe_engine/properties', |
| 13 'recipe_engine/python', | 13 'recipe_engine/python', |
| 14 'recipe_engine/raw_io', | 14 'recipe_engine/raw_io', |
| 15 'recipe_engine/step', | 15 'recipe_engine/step', |
| 16 'file', | |
|
rmistry
2016/07/22 14:26:14
nit: sort
borenet
2016/07/22 14:49:53
Done.
| |
| 16 'skia', | 17 'skia', |
| 17 ] | 18 ] |
| 18 | 19 |
| 19 | 20 |
| 20 TEST_BUILDERS = { | 21 TEST_BUILDERS = { |
| 21 'client.skia.compile': { | 22 'client.skia.compile': { |
| 22 'skiabot-linux-swarm-000': [ | 23 'skiabot-linux-swarm-000': [ |
| 23 'Housekeeper-Nightly-RecreateSKPs_Canary', | 24 'Housekeeper-Nightly-RecreateSKPs_Canary', |
| 24 'Housekeeper-Weekly-RecreateSKPs', | 25 'Housekeeper-Weekly-RecreateSKPs', |
| 25 ], | 26 ], |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 if not os.path.exists(dest_dir): | 123 if not os.path.exists(dest_dir): |
| 123 os.makedirs(dest_dir) | 124 os.makedirs(dest_dir) |
| 124 | 125 |
| 125 req = urllib2.Request(BOTO_URL, headers={'Metadata-Flavor': 'Google'}) | 126 req = urllib2.Request(BOTO_URL, headers={'Metadata-Flavor': 'Google'}) |
| 126 contents = urllib2.urlopen(req).read() | 127 contents = urllib2.urlopen(req).read() |
| 127 | 128 |
| 128 with open(dest_path, 'w') as f: | 129 with open(dest_path, 'w') as f: |
| 129 f.write(contents) | 130 f.write(contents) |
| 130 """ % boto_file) | 131 """ % boto_file) |
| 131 | 132 |
| 133 # Clean up the output dir. | |
| 134 output_dir = api.path['slave_build'].join('skp_output') | |
| 135 if api.path.exists(output_dir): | |
| 136 api.file.rmtree('skp_output', output_dir) | |
| 137 api.file.makedirs('skp_output', output_dir) | |
| 138 | |
| 132 # Capture the SKPs. | 139 # Capture the SKPs. |
| 133 with depot_tools_auth(api, UPDATE_SKPS_KEY): | 140 path_var= api.path.pathsep.join([str(api.path['depot_tools']), '%(PATH)s']) |
| 134 cmd = ['python', api.path['build'].join('scripts', 'slave', 'skia', | 141 env = { |
| 135 'recreate_skps.py'), | 142 'CHROME_HEADLESS': '1', |
| 136 src_dir, | 143 'PATH': path_var, |
| 137 src_dir.join('out', 'Release', 'chrome')] | 144 } |
| 138 if 'Canary' in api.properties['buildername']: | 145 boto_env = { |
| 139 cmd.append('--dry-run') | 146 'AWS_CREDENTIAL_FILE': boto_file, |
| 140 path_var= api.path.pathsep.join([str(api.path['depot_tools']), '%(PATH)s']) | 147 'BOTO_CONFIG': boto_file, |
| 141 api.step('Recreate SKPs', | 148 } |
| 142 cmd=cmd, | 149 recreate_skps_env = {} |
| 143 cwd=api.skia.checkout_root.join('skia'), | 150 recreate_skps_env.update(env) |
| 144 env={ | 151 recreate_skps_env.update(boto_env) |
| 145 'AWS_CREDENTIAL_FILE': boto_file, | 152 asset_dir = api.skia.infrabots_dir.join('assets', 'skp') |
| 146 'BOTO_CONFIG': boto_file, | 153 cmd = ['python', asset_dir.join('create.py'), |
| 147 'CHROME_HEADLESS': '1', | 154 '--chrome_src_path', src_dir, |
| 148 'PATH': path_var, | 155 '--browser_executable', src_dir.join('out', 'Release', 'chrome'), |
| 149 }, | 156 '--target_dir', output_dir] |
| 150 ) | 157 api.step('Recreate SKPs', |
| 158 cmd=cmd, | |
| 159 cwd=api.skia.skia_dir, | |
| 160 env=recreate_skps_env) | |
| 161 | |
| 162 # Upload the SKPs. | |
| 163 if 'Canary' not in api.properties['buildername']: | |
| 164 cmd = ['python', | |
| 165 api.path['build'].join('scripts', 'slave', 'skia', 'upload_skps.py'), | |
| 166 '--target_dir', output_dir] | |
| 167 with depot_tools_auth(api, UPDATE_SKPS_KEY): | |
| 168 api.step('Upload SKPs', | |
| 169 cmd=cmd, | |
| 170 cwd=api.skia.skia_dir, | |
| 171 env=env) | |
| 172 | |
| 151 | 173 |
| 152 def GenTests(api): | 174 def GenTests(api): |
| 153 for mastername, slaves in TEST_BUILDERS.iteritems(): | 175 for mastername, slaves in TEST_BUILDERS.iteritems(): |
| 154 for slavename, builders_by_slave in slaves.iteritems(): | 176 for slavename, builders_by_slave in slaves.iteritems(): |
| 155 for builder in builders_by_slave: | 177 for builder in builders_by_slave: |
| 156 test = ( | 178 test = ( |
| 157 api.test(builder) + | 179 api.test(builder) + |
| 158 api.properties(buildername=builder, | 180 api.properties(buildername=builder, |
| 159 mastername=mastername, | 181 mastername=mastername, |
| 160 slavename=slavename, | 182 slavename=slavename, |
| 161 revision='abc123', | 183 revision='abc123', |
| 162 buildnumber=2, | 184 buildnumber=2, |
| 163 swarm_out_dir='[SWARM_OUT_DIR]') | 185 swarm_out_dir='[SWARM_OUT_DIR]') + |
| 186 api.path.exists(api.path['slave_build'].join('skp_output')) | |
| 164 ) | 187 ) |
| 165 yield test | 188 yield test |
| OLD | NEW |