|
| 1 | +#!/usr/bin/python2 |
| 2 | +# |
| 3 | +# Copyright 2019 The ANGLE Project Authors. All rights reserved. |
| 4 | +# Use of this source code is governed by a BSD-style license that can be |
| 5 | +# found in the LICENSE file. |
| 6 | +# |
| 7 | +# trigger.py: |
| 8 | +# Helper script for triggering GPU tests on swarming. |
| 9 | + |
| 10 | +import argparse |
| 11 | +import os |
| 12 | +import subprocess |
| 13 | +import sys |
| 14 | + |
| 15 | + |
| 16 | +def parse_args(): |
| 17 | + parser = argparse.ArgumentParser(os.path.basename(sys.argv[0])) |
| 18 | + parser.add_argument('gn_path', help='path to GN. (e.g. out/Release)') |
| 19 | + parser.add_argument('test', help='test name. (e.g. angle_end2end_tests)') |
| 20 | + parser.add_argument('os_dim', help='OS dimension. (e.g. Windows-10)') |
| 21 | + parser.add_argument('gpu_dim', help='GPU dimension. (e.g. intel-hd-630-win10-stable)') |
| 22 | + parser.add_argument('-s', '--shards', default=1, help='number of shards', type=int) |
| 23 | + parser.add_argument('-p', '--pool', default='Chrome-GPU', help='swarming pool') |
| 24 | + parser.add_argument('extra_args', help='extra test command line arguments', nargs='*') |
| 25 | + return parser.parse_args() |
| 26 | + |
| 27 | + |
| 28 | +def main(): |
| 29 | + args = parse_args() |
| 30 | + path = args.gn_path.replace('\\', '/') |
| 31 | + out_gn_path = '//' + path |
| 32 | + out_file_path = os.path.join(*path.split('/')) |
| 33 | + |
| 34 | + mb_script_path = os.path.join('tools', 'mb', 'mb.py') |
| 35 | + subprocess.call(['python', mb_script_path, 'isolate', out_gn_path, args.test]) |
| 36 | + |
| 37 | + isolate_script_path = os.path.join('tools', 'swarming_client', 'isolate.py') |
| 38 | + isolate_file = os.path.join(out_file_path, '%s.isolate' % args.test) |
| 39 | + isolated_file = os.path.join(out_file_path, '%s.isolated' % args.test) |
| 40 | + |
| 41 | + isolate_args = [ |
| 42 | + 'python', isolate_script_path, 'archive', |
| 43 | + '-I', 'https://isolateserver.appspot.com', |
| 44 | + '-i', isolate_file, |
| 45 | + '-s', isolated_file] |
| 46 | + stdout = subprocess.check_output(isolate_args) |
| 47 | + sha = stdout[:40] |
| 48 | + |
| 49 | + print('Got an isolated SHA of %s' % sha) |
| 50 | + swarming_script_path = os.path.join('tools', 'swarming_client', 'swarming.py') |
| 51 | + |
| 52 | + swarmings_args = [ |
| 53 | + 'python', swarming_script_path, 'trigger', |
| 54 | + '-S', 'chromium-swarm.appspot.com', |
| 55 | + '-I', 'isolateserver.appspot.com', |
| 56 | + '-d', 'os', args.os_dim, |
| 57 | + '-d', 'pool', args.pool, |
| 58 | + '-d', 'gpu', args.gpu_dim, |
| 59 | + '--shards=%d' % args.shards, |
| 60 | + '-s', sha] |
| 61 | + |
| 62 | + if args.extra_args: |
| 63 | + swarmings_args += ['--'] + args.extra_args |
| 64 | + |
| 65 | + print(' '.join(swarmings_args)) |
| 66 | + subprocess.call(swarmings_args) |
| 67 | + return 0 |
| 68 | + |
| 69 | + |
| 70 | +if __name__ == '__main__': |
| 71 | + sys.exit(main()) |
0 commit comments