1 # Copyright 2018 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 import math 7 8 9 DEPS = [ 10 'recipe_engine/path', 11 'recipe_engine/properties', 12 'recipe_engine/step', 13 ] 14 15 16 def RunSteps(api): 17 buildername = api.properties['buildername'] 18 issue = api.properties.get('patch_issue') 19 patchset = api.properties.get('patch_set') 20 if not issue or not patchset: 21 # This bot currently only supports trybot runs because: 22 # Non-trybot runs could fail if the Android tree is red. We mitigate this 23 # for trybot runs by verifying that runs without the patch succeed. We do 24 # not currently have a way to do the same for non-trybot runs. 25 raise Exception('%s can only be run as a trybot.' % buildername) 26 27 infrabots_dir = api.path['start_dir'].join('skia', 'infra', 'bots') 28 trigger_wait_ac_script = infrabots_dir.join('android_compile', 29 'trigger_wait_ac_task.py') 30 31 # Trigger a compile task on android-compile.skia.org and wait for it to 32 # complete. 33 cmd = ['python', trigger_wait_ac_script, 34 '--issue', issue, 35 '--patchset', patchset, 36 ] 37 api.step('Trigger and wait for task on android-compile.skia.org', cmd=cmd) 38 39 40 def GenTests(api): 41 yield( 42 api.test('android_compile_trybot') + 43 api.properties( 44 buildername='Build-Debian9-Clang-gce_x86_phone-eng-Android_Framework', 45 path_config='kitchen', 46 swarm_out_dir='[SWARM_OUT_DIR]', 47 repository='https://skia.googlesource.com/skia.git', 48 patch_issue=1234, 49 patch_set=1, 50 ) 51 ) 52 53 yield( 54 api.test('android_compile_nontrybot') + 55 api.properties( 56 buildername='Build-Debian9-Clang-gce_x86_phone-eng-Android_Framework', 57 path_config='kitchen', 58 swarm_out_dir='[SWARM_OUT_DIR]', 59 repository='https://skia.googlesource.com/skia.git', 60 revision='abc123', 61 ) + 62 api.expect_exception('Exception') 63 ) 64