| 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 |
| 11 import sys | 11 import sys |
| 12 import zipfile | |
| 13 | 12 |
| 14 | 13 |
| 15 PARENT_DIR = os.path.dirname(os.path.realpath(__file__)) | 14 PARENT_DIR = os.path.dirname(os.path.realpath(__file__)) |
| 16 | 15 |
| 17 REPOS_BASE_DIR = os.path.normpath(os.path.join( | 16 REPOS_BASE_DIR = os.path.normpath(os.path.join( |
| 18 PARENT_DIR, os.pardir, os.pardir, os.pardir, os.pardir)) | 17 PARENT_DIR, os.pardir, os.pardir, os.pardir, os.pardir)) |
| 19 | 18 |
| 20 SKIA_SRC_DIR = os.path.join(REPOS_BASE_DIR, 'skia') | 19 SKIA_SRC_DIR = os.path.join(REPOS_BASE_DIR, 'skia') |
| 21 | 20 |
| 22 | 21 |
| 23 def main(): | 22 def main(): |
| 24 parser = argparse.ArgumentParser() | 23 parser = argparse.ArgumentParser() |
| 25 parser.add_argument('-s', '--slave_num', required=True, type=int, | 24 parser.add_argument('-s', '--slave_num', required=True, type=int, |
| 26 help='The slave num of this CT run.') | 25 help='The slave num of this CT run.') |
| 27 parser.add_argument('-t', '--tool', required=True, | 26 parser.add_argument('-t', '--tool', required=True, |
| 28 choices=['dm', 'nanobench'], | 27 choices=['dm', 'nanobench'], |
| 29 help='The tool to run on the SKPs.') | 28 help='The tool to run on the SKPs.') |
| 30 parser.add_argument('-g', '--git_hash', required=True, | 29 parser.add_argument('-g', '--git_hash', required=True, |
| 31 help='The Skia hash the tool was built at.') | 30 help='The Skia hash the tool was built at.') |
| 32 parser.add_argument('-c', '--configuration', required=True, | 31 parser.add_argument('-c', '--configuration', required=True, |
| 33 help='The build configuration to use.') | 32 help='The build configuration to use.') |
| 34 parser.add_argument('-i', '--isolated_outdir', required=True, | 33 parser.add_argument('-i', '--isolated_outdir', required=True, |
| 35 help='Swarming will automatically upload to ' | 34 help='Swarming will automatically upload to ' |
| 36 'isolateserver all artifacts in this dir.') | 35 'isolateserver all artifacts in this dir.') |
| 37 args = parser.parse_args() | 36 args = parser.parse_args() |
| 38 | 37 |
| 39 # Unzip SKPs into a directory. | 38 tool_path = os.path.join(SKIA_SRC_DIR, 'out', args.configuration, args.tool) |
| 40 skps_zip = os.path.join(REPOS_BASE_DIR, 'skps', | |
| 41 'slave%d.zip' % args.slave_num) | |
| 42 skps_dir = os.path.join(REPOS_BASE_DIR, 'skps', 'slave%d' % args.slave_num) | 39 skps_dir = os.path.join(REPOS_BASE_DIR, 'skps', 'slave%d' % args.slave_num) |
| 43 os.makedirs(skps_dir) | |
| 44 with zipfile.ZipFile(skps_zip, 'r') as zip_ref: | |
| 45 zip_ref.extractall(skps_dir) | |
| 46 | |
| 47 tool_path = os.path.join(SKIA_SRC_DIR, 'out', args.configuration, args.tool) | |
| 48 resource_path = os.path.join(SKIA_SRC_DIR, 'resources') | 40 resource_path = os.path.join(SKIA_SRC_DIR, 'resources') |
| 49 | 41 |
| 50 cmd = [tool_path] | 42 cmd = [tool_path] |
| 51 if args.tool == 'dm': | 43 if args.tool == 'dm': |
| 52 # Add DM specific arguments. | 44 # Add DM specific arguments. |
| 53 cmd.extend([ | 45 cmd.extend([ |
| 54 '--src', 'skp', | 46 '--src', 'skp', |
| 55 '--skps', skps_dir, | 47 '--skps', skps_dir, |
| 56 '--resourcePath', resource_path, | 48 '--resourcePath', resource_path, |
| 57 '--config', '8888', | 49 '--config', '8888', |
| (...skipping 14 matching lines...) Expand all Loading... |
| 72 '--key', 'arch', 'x86_64', 'compiler', 'GCC', 'cpu_or_gpu', 'CPU', | 64 '--key', 'arch', 'x86_64', 'compiler', 'GCC', 'cpu_or_gpu', 'CPU', |
| 73 'cpu_or_gpu_value', 'AVX2', 'model', 'SWARM', 'os', 'Ubuntu', | 65 'cpu_or_gpu_value', 'AVX2', 'model', 'SWARM', 'os', 'Ubuntu', |
| 74 '--verbose', | 66 '--verbose', |
| 75 ]) | 67 ]) |
| 76 | 68 |
| 77 return subprocess.call(cmd) | 69 return subprocess.call(cmd) |
| 78 | 70 |
| 79 | 71 |
| 80 if __name__ == '__main__': | 72 if __name__ == '__main__': |
| 81 sys.exit(main()) | 73 sys.exit(main()) |
| OLD | NEW |