OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """This script is meant to be run on a Swarming bot.""" | 6 """This script is meant to be run on a Swarming bot.""" |
7 | 7 |
8 import argparse | 8 import argparse |
9 import os | 9 import os |
10 import subprocess | 10 import subprocess |
(...skipping 15 matching lines...) Expand all Loading... | |
26 parser.add_argument('-t', '--tool', required=True, | 26 parser.add_argument('-t', '--tool', required=True, |
27 choices=['dm', 'nanobench', 'get_images_from_skps'], | 27 choices=['dm', 'nanobench', 'get_images_from_skps'], |
28 help='The tool to run on the SKPs.') | 28 help='The tool to run on the SKPs.') |
29 parser.add_argument('-g', '--git_hash', required=True, | 29 parser.add_argument('-g', '--git_hash', required=True, |
30 help='The Skia hash the tool was built at.') | 30 help='The Skia hash the tool was built at.') |
31 parser.add_argument('-c', '--configuration', required=True, | 31 parser.add_argument('-c', '--configuration', required=True, |
32 help='The build configuration to use.') | 32 help='The build configuration to use.') |
33 parser.add_argument('-i', '--isolated_outdir', required=True, | 33 parser.add_argument('-i', '--isolated_outdir', required=True, |
34 help='Swarming will automatically upload to ' | 34 help='Swarming will automatically upload to ' |
35 'isolateserver all artifacts in this dir.') | 35 'isolateserver all artifacts in this dir.') |
36 parser.add_argument('-b', '--builder', required=True, | |
M-A Ruel
2016/06/07 12:51:31
I guess you are fine with this change not being ba
rmistry
2016/06/07 12:53:00
Yes, landed the corresponding recipe change shortl
| |
37 help='The name of the builder.') | |
36 args = parser.parse_args() | 38 args = parser.parse_args() |
37 | 39 |
38 tool_path = os.path.join(SKIA_SRC_DIR, 'out', args.configuration, args.tool) | 40 tool_path = os.path.join(SKIA_SRC_DIR, 'out', args.configuration, args.tool) |
39 skps_dir = os.path.join(REPOS_BASE_DIR, 'skps', 'slave%d' % args.slave_num) | 41 skps_dir = os.path.join(REPOS_BASE_DIR, 'skps', 'slave%d' % args.slave_num) |
40 resource_path = os.path.join(SKIA_SRC_DIR, 'resources') | 42 resource_path = os.path.join(SKIA_SRC_DIR, 'resources') |
41 | 43 |
42 cmd = [tool_path] | 44 cmd = [tool_path] |
43 if args.tool == 'dm': | 45 if args.tool == 'dm': |
44 # Add DM specific arguments. | 46 # Add DM specific arguments. |
45 cmd.extend([ | 47 cmd.extend([ |
46 '--src', 'skp', | 48 '--src', 'skp', |
47 '--skps', skps_dir, | 49 '--skps', skps_dir, |
48 '--resourcePath', resource_path, | 50 '--resourcePath', resource_path, |
49 '--config', '8888', | 51 '--config', '8888', |
50 '--verbose', | 52 '--verbose', |
51 ]) | 53 ]) |
52 elif args.tool == 'nanobench': | 54 elif args.tool == 'nanobench': |
53 # Add Nanobench specific arguments. | 55 # Add Nanobench specific arguments. |
56 config = '8888' | |
57 cpu_or_gpu = 'CPU' | |
58 cpu_or_gpu_value = 'AVX2' | |
59 if 'GPU' in args.builder: | |
60 config = 'gpu' | |
61 cpu_or_gpu = 'GPU' | |
62 cpu_or_gpu_value = 'GT610' | |
63 | |
54 out_results_file = os.path.join( | 64 out_results_file = os.path.join( |
55 args.isolated_outdir, 'nanobench_%s_slave%d.json' % (args.git_hash, | 65 args.isolated_outdir, 'nanobench_%s_%s_slave%d.json' % ( |
56 args.slave_num)) | 66 args.git_hash, config, args.slave_num)) |
57 cmd.extend([ | 67 cmd.extend([ |
58 '--skps', skps_dir, | 68 '--skps', skps_dir, |
59 '--match', 'skp', | 69 '--match', 'skp', |
60 '--resourcePath', resource_path, | 70 '--resourcePath', resource_path, |
61 '--config', '8888', 'gpu', | 71 '--config', config, |
62 '--outResultsFile', out_results_file, | 72 '--outResultsFile', out_results_file, |
63 '--properties', 'gitHash', args.git_hash, | 73 '--properties', 'gitHash', args.git_hash, |
64 '--key', 'arch', 'x86_64', 'compiler', 'GCC', 'cpu_or_gpu', 'CPU', | 74 '--key', 'arch', 'x86_64', |
65 'cpu_or_gpu_value', 'AVX2', 'model', 'SWARM', 'os', 'Ubuntu', | 75 'compiler', 'GCC', |
76 'cpu_or_gpu', cpu_or_gpu, | |
77 'cpu_or_gpu_value', cpu_or_gpu_value, | |
78 'model', 'SWARM', | |
79 'os', 'Ubuntu', | |
66 '--verbose', | 80 '--verbose', |
67 ]) | 81 ]) |
68 elif args.tool == 'get_images_from_skps': | 82 elif args.tool == 'get_images_from_skps': |
69 # Add get_images_from_skps specific arguments. | 83 # Add get_images_from_skps specific arguments. |
70 img_out = os.path.join(args.isolated_outdir, 'img_out') | 84 img_out = os.path.join(args.isolated_outdir, 'img_out') |
71 os.makedirs(img_out) | 85 os.makedirs(img_out) |
72 failures_json_out = os.path.join(args.isolated_outdir, 'failures.json') | 86 failures_json_out = os.path.join(args.isolated_outdir, 'failures.json') |
73 cmd.extend([ | 87 cmd.extend([ |
74 '--out', img_out, | 88 '--out', img_out, |
75 '--skps', skps_dir, | 89 '--skps', skps_dir, |
76 '--failuresJsonPath', failures_json_out, | 90 '--failuresJsonPath', failures_json_out, |
77 '--writeImages', 'false', | 91 '--writeImages', 'false', |
78 '--testDecode', | 92 '--testDecode', |
79 ]) | 93 ]) |
80 | 94 |
81 return subprocess.call(cmd) | 95 return subprocess.call(cmd) |
82 | 96 |
83 | 97 |
84 if __name__ == '__main__': | 98 if __name__ == '__main__': |
85 sys.exit(main()) | 99 sys.exit(main()) |
OLD | NEW |