Hash :
9e4cf7ca
Author :
Date :
2020-02-12T16:58:37
Fix vpython caching in trigger.py script. Several necessary CPID packages were missing from the swarming params. Add these based on the packages in mb.py: https://chromium.googlesource.com/chromium/src/tools/mb/+/2192df66cd0ed214bcfbfd387ad0c5c8c0a21eb1/mb.py#586 Allows testing the ANGLE test launcher without modifying recipes. Bug: angleproject:3162 Change-Id: I3e84bf0d3fd92aed623a918b4d9cfd53f51f2dee Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2050427 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
#!/usr/bin/python2
#
# Copyright 2019 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# trigger.py:
# Helper script for triggering GPU tests on swarming.
import argparse
import os
import subprocess
import sys
def parse_args():
parser = argparse.ArgumentParser(os.path.basename(sys.argv[0]))
parser.add_argument('gn_path', help='path to GN. (e.g. out/Release)')
parser.add_argument('test', help='test name. (e.g. angle_end2end_tests)')
parser.add_argument('os_dim', help='OS dimension. (e.g. Windows-10)')
parser.add_argument('gpu_dim', help='GPU dimension. (e.g. intel-hd-630-win10-stable)')
parser.add_argument('-s', '--shards', default=1, help='number of shards', type=int)
parser.add_argument('-p', '--pool', default='Chrome-GPU', help='swarming pool')
return parser.parse_known_args()
# Taken from:
# https://chromium.googlesource.com/chromium/src/tools/mb/+/2192df66cd0ed214bcfbfd387ad0c5c8c0a21eb1/mb.py#586
def add_base_software(swarming_args):
# HACK(iannucci): These packages SHOULD NOT BE HERE.
# Remove method once Swarming Pool Task Templates are implemented.
# crbug.com/812428
# Add in required base software. This should be kept in sync with the
# `chromium_swarming` recipe module in build.git. All references to
# `swarming_module` below are purely due to this.
cipd_packages = [
('infra/python/cpython/${platform}', 'version:2.7.15.chromium14'),
('infra/tools/luci/logdog/butler/${platform}',
'git_revision:e1abc57be62d198b5c2f487bfb2fa2d2eb0e867c'),
('infra/tools/luci/vpython-native/${platform}',
'git_revision:e317c7d2c17d4c3460ee37524dfce4e1dee4306a'),
('infra/tools/luci/vpython/${platform}',
'git_revision:e317c7d2c17d4c3460ee37524dfce4e1dee4306a'),
]
for pkg, vers in cipd_packages:
swarming_args.append('--cipd-package=.swarming_module:%s:%s' % (pkg, vers))
# Add packages to $PATH
swarming_args.extend([
'--env-prefix=PATH',
'.swarming_module',
'--env-prefix=PATH',
'.swarming_module/bin',
])
# Add cache directives for vpython.
vpython_cache_path = '.swarming_module_cache/vpython'
swarming_args.extend([
'--named-cache=swarming_module_cache_vpython',
vpython_cache_path,
'--env-prefix=VPYTHON_VIRTUALENV_ROOT',
vpython_cache_path,
])
def main():
args, unknown = parse_args()
path = args.gn_path.replace('\\', '/')
out_gn_path = '//' + path
out_file_path = os.path.join(*path.split('/'))
mb_script_path = os.path.join('tools', 'mb', 'mb.py')
subprocess.call(['python', mb_script_path, 'isolate', out_gn_path, args.test])
isolate_script_path = os.path.join('tools', 'swarming_client', 'isolate.py')
isolate_file = os.path.join(out_file_path, '%s.isolate' % args.test)
isolated_file = os.path.join(out_file_path, '%s.isolated' % args.test)
isolate_args = [
'python', isolate_script_path, 'archive', '-I', 'https://isolateserver.appspot.com', '-i',
isolate_file, '-s', isolated_file
]
stdout = subprocess.check_output(isolate_args)
sha = stdout[:40]
print('Got an isolated SHA of %s' % sha)
swarming_script_path = os.path.join('tools', 'swarming_client', 'swarming.py')
swarming_args = [
'python', swarming_script_path, 'trigger', '-S', 'chromium-swarm.appspot.com', '-I',
'isolateserver.appspot.com', '-d', 'os', args.os_dim, '-d', 'pool', args.pool, '-d', 'gpu',
args.gpu_dim,
'--shards=%d' % args.shards, '-s', sha
]
add_base_software(swarming_args)
if unknown:
swarming_args += ["--"] + unknown
print(' '.join(swarming_args))
subprocess.call(swarming_args)
return 0
if __name__ == '__main__':
sys.exit(main())