| 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 tempfile | 11 import tempfile |
| 11 | 12 |
| 12 | 13 |
| 13 SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) | 14 SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) |
| 14 SRC_DIR = os.path.abspath( | 15 SRC_DIR = os.path.abspath( |
| 15 os.path.join(SCRIPT_DIR, os.path.pardir, os.path.pardir)) | 16 os.path.join(SCRIPT_DIR, os.path.pardir, os.path.pardir)) |
| 16 | 17 |
| 17 | 18 |
| 18 # run-webkit-tests returns the number of failures as the return | 19 # run-webkit-tests returns the number of failures as the return |
| 19 # 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 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 48 return args.func(args) | 49 return args.func(args) |
| 49 | 50 |
| 50 | 51 |
| 51 def run_command(argv): | 52 def run_command(argv): |
| 52 print 'Running %r' % argv | 53 print 'Running %r' % argv |
| 53 rc = subprocess.call(argv) | 54 rc = subprocess.call(argv) |
| 54 print 'Command %r returned exit code %d' % (argv, rc) | 55 print 'Command %r returned exit code %d' % (argv, rc) |
| 55 return rc | 56 return rc |
| 56 | 57 |
| 57 | 58 |
| 59 def run_runtest(cmd_args, runtest_args): |
| 60 return run_command([ |
| 61 sys.executable, |
| 62 os.path.join(cmd_args.paths['build'], 'scripts', 'tools', 'runit.py'), |
| 63 '--show-path', |
| 64 sys.executable, |
| 65 os.path.join(cmd_args.paths['build'], 'scripts', 'slave', 'runtest.py'), |
| 66 '--target', cmd_args.build_config_fs, |
| 67 '--xvfb', |
| 68 '--builder-name', cmd_args.properties['buildername'], |
| 69 '--slave-name', cmd_args.properties['slavename'], |
| 70 '--build-number', str(cmd_args.properties['buildnumber']), |
| 71 ] + runtest_args) |
| 72 |
| 73 |
| 58 @contextlib.contextmanager | 74 @contextlib.contextmanager |
| 59 def temporary_file(): | 75 def temporary_file(): |
| 60 fd, path = tempfile.mkstemp() | 76 fd, path = tempfile.mkstemp() |
| 61 os.close(fd) | 77 os.close(fd) |
| 62 try: | 78 try: |
| 63 yield path | 79 yield path |
| 64 finally: | 80 finally: |
| 65 os.remove(path) | 81 os.remove(path) |
| 66 | 82 |
| 67 | 83 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 key += 'passes' | 124 key += 'passes' |
| 109 # TODO(dpranke): crbug.com/357867 ... Why are we assigning result | 125 # TODO(dpranke): crbug.com/357867 ... Why are we assigning result |
| 110 # instead of actual_result here. Do we even need these things to be | 126 # instead of actual_result here. Do we even need these things to be |
| 111 # hashes, or just lists? | 127 # hashes, or just lists? |
| 112 data = result | 128 data = result |
| 113 else: | 129 else: |
| 114 key += 'failures' | 130 key += 'failures' |
| 115 results[key][test] = data | 131 results[key][test] = data |
| 116 | 132 |
| 117 return results | 133 return results |
| OLD | NEW |