| 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 # Exit code to indicate infrastructure issue. |
| 26 INFRA_FAILURE_EXIT_CODE = 87 |
| 27 |
| 28 |
| 25 def run_script(argv, funcs): | 29 def run_script(argv, funcs): |
| 26 def parse_json(path): | 30 def parse_json(path): |
| 27 with open(path) as f: | 31 with open(path) as f: |
| 28 return json.load(f) | 32 return json.load(f) |
| 29 parser = argparse.ArgumentParser() | 33 parser = argparse.ArgumentParser() |
| 30 # TODO(phajdan.jr): Make build-config-fs required after passing it in recipe. | 34 # TODO(phajdan.jr): Make build-config-fs required after passing it in recipe. |
| 31 parser.add_argument('--build-config-fs') | 35 parser.add_argument('--build-config-fs') |
| 32 parser.add_argument('--paths', type=parse_json, default={}) | 36 parser.add_argument('--paths', type=parse_json, default={}) |
| 33 # Properties describe the environment of the build, and are the same per | 37 # Properties describe the environment of the build, and are the same per |
| 34 # script invocation. | 38 # script invocation. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 [sys.executable, script_to_run] + extra_args) | 163 [sys.executable, script_to_run] + extra_args) |
| 160 | 164 |
| 161 with open(log_file) as f: | 165 with open(log_file) as f: |
| 162 failures = json.load(f) | 166 failures = json.load(f) |
| 163 json.dump({ | 167 json.dump({ |
| 164 'valid': integration_test_res == 0, | 168 'valid': integration_test_res == 0, |
| 165 'failures': failures, | 169 'failures': failures, |
| 166 }, output) | 170 }, output) |
| 167 | 171 |
| 168 return integration_test_res | 172 return integration_test_res |
| OLD | NEW |