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 |
11 import tempfile | 11 import tempfile |
12 | 12 |
13 | 13 |
14 SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) | 14 SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) |
15 SRC_DIR = os.path.abspath( | 15 SRC_DIR = os.path.abspath( |
16 os.path.join(SCRIPT_DIR, os.path.pardir, os.path.pardir)) | 16 os.path.join(SCRIPT_DIR, os.path.pardir, os.path.pardir)) |
17 | 17 |
18 | 18 |
19 # run-webkit-tests returns the number of failures as the return | 19 # run-webkit-tests returns the number of failures as the return |
20 # code, but caps the return code at 101 to avoid overflow or colliding | 20 # code, but caps the return code at 101 to avoid overflow or colliding |
21 # with reserved values from the shell. | 21 # with reserved values from the shell. |
22 MAX_FAILURES_EXIT_STATUS = 101 | 22 MAX_FAILURES_EXIT_STATUS = 101 |
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. |
iannucci
2015/02/23 18:02:49
TODO(phajdan.jr): help strings for these options s
| |
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 parser.add_argument('--properties', type=parse_json, default={}) | 33 parser.add_argument('--properties', type=parse_json, default={}) |
34 parser.add_argument('--args', type=parse_json, default=[]) | |
iannucci
2015/02/23 18:02:49
why is the introduction of a new argument necessar
iannucci
2015/02/23 18:04:33
Actually... it looks like this isn't even used by
shatch
2015/02/23 20:14:21
This was Pawel's preference when we spoke over ema
Paweł Hajdan Jr.
2015/02/23 20:46:30
I consider properties to be the same for all scrip
| |
34 | 35 |
35 subparsers = parser.add_subparsers() | 36 subparsers = parser.add_subparsers() |
36 | 37 |
37 run_parser = subparsers.add_parser('run') | 38 run_parser = subparsers.add_parser('run') |
38 run_parser.add_argument( | 39 run_parser.add_argument( |
39 '--output', type=argparse.FileType('w'), required=True) | 40 '--output', type=argparse.FileType('w'), required=True) |
40 run_parser.add_argument('--filter-file', type=argparse.FileType('r')) | 41 run_parser.add_argument('--filter-file', type=argparse.FileType('r')) |
41 run_parser.set_defaults(func=funcs['run']) | 42 run_parser.set_defaults(func=funcs['run']) |
42 | 43 |
43 run_parser = subparsers.add_parser('compile_targets') | 44 run_parser = subparsers.add_parser('compile_targets') |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 key += 'passes' | 126 key += 'passes' |
126 # TODO(dpranke): crbug.com/357867 ... Why are we assigning result | 127 # TODO(dpranke): crbug.com/357867 ... Why are we assigning result |
127 # instead of actual_result here. Do we even need these things to be | 128 # instead of actual_result here. Do we even need these things to be |
128 # hashes, or just lists? | 129 # hashes, or just lists? |
129 data = result | 130 data = result |
130 else: | 131 else: |
131 key += 'failures' | 132 key += 'failures' |
132 results[key][test] = data | 133 results[key][test] = data |
133 | 134 |
134 return results | 135 return results |
OLD | NEW |