| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import argparse | 5 import argparse |
| 6 import contextlib | 6 import contextlib |
| 7 import json | 7 import json |
| 8 import os | 8 import os |
| 9 import subprocess | 9 import subprocess |
| 10 import sys | 10 import sys |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 | 24 |
| 25 def run_script(argv, funcs): | 25 def run_script(argv, funcs): |
| 26 def parse_json(path): | 26 def parse_json(path): |
| 27 with open(path) as f: | 27 with open(path) as f: |
| 28 return json.load(f) | 28 return json.load(f) |
| 29 parser = argparse.ArgumentParser() | 29 parser = argparse.ArgumentParser() |
| 30 # TODO(phajdan.jr): Make build-config-fs required after passing it in recipe. | 30 # TODO(phajdan.jr): Make build-config-fs required after passing it in recipe. |
| 31 parser.add_argument('--build-config-fs') | 31 parser.add_argument('--build-config-fs') |
| 32 parser.add_argument('--paths', type=parse_json, default={}) | 32 parser.add_argument('--paths', type=parse_json, default={}) |
| 33 # Properties describe the environment of the build, and are the same per |
| 34 # script invocation. |
| 33 parser.add_argument('--properties', type=parse_json, default={}) | 35 parser.add_argument('--properties', type=parse_json, default={}) |
| 36 # Args contains per-invocation arguments that potentially change the |
| 37 # behavior of the script. |
| 38 parser.add_argument('--args', type=parse_json, default=[]) |
| 34 | 39 |
| 35 subparsers = parser.add_subparsers() | 40 subparsers = parser.add_subparsers() |
| 36 | 41 |
| 37 run_parser = subparsers.add_parser('run') | 42 run_parser = subparsers.add_parser('run') |
| 38 run_parser.add_argument( | 43 run_parser.add_argument( |
| 39 '--output', type=argparse.FileType('w'), required=True) | 44 '--output', type=argparse.FileType('w'), required=True) |
| 40 run_parser.add_argument('--filter-file', type=argparse.FileType('r')) | 45 run_parser.add_argument('--filter-file', type=argparse.FileType('r')) |
| 41 run_parser.set_defaults(func=funcs['run']) | 46 run_parser.set_defaults(func=funcs['run']) |
| 42 | 47 |
| 43 run_parser = subparsers.add_parser('compile_targets') | 48 run_parser = subparsers.add_parser('compile_targets') |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 key += 'passes' | 130 key += 'passes' |
| 126 # TODO(dpranke): crbug.com/357867 ... Why are we assigning result | 131 # TODO(dpranke): crbug.com/357867 ... Why are we assigning result |
| 127 # instead of actual_result here. Do we even need these things to be | 132 # instead of actual_result here. Do we even need these things to be |
| 128 # hashes, or just lists? | 133 # hashes, or just lists? |
| 129 data = result | 134 data = result |
| 130 else: | 135 else: |
| 131 key += 'failures' | 136 key += 'failures' |
| 132 results[key][test] = data | 137 results[key][test] = data |
| 133 | 138 |
| 134 return results | 139 return results |
| OLD | NEW |