OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 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 import json | 6 import json |
7 import os | 7 import os |
8 import sys | 8 import sys |
9 | 9 |
10 | 10 |
11 import common | 11 import common |
12 | 12 |
13 | 13 |
14 def main_run(args): | 14 def main_run(args): |
| 15 runner = os.path.join(common.SRC_DIR, 'mojo', 'tools', 'apptest_runner.py') |
| 16 tests = os.path.join(common.SRC_DIR, 'mojo', 'tools', 'data', 'apptests') |
| 17 build_dir = os.path.join(common.SRC_DIR, 'out', args.build_config_fs) |
| 18 |
15 with common.temporary_file() as tempfile_path: | 19 with common.temporary_file() as tempfile_path: |
16 rc = common.run_command([ | 20 rc = common.run_command([runner, tests, build_dir, '--verbose', |
17 sys.executable, | 21 '--write-full-results-to', tempfile_path]) |
18 os.path.join(common.SRC_DIR, 'third_party', 'WebKit', | |
19 'Tools', 'Scripts', 'test-webkitpy'), | |
20 '--write-full-results-to', tempfile_path, | |
21 ]) | |
22 | |
23 with open(tempfile_path) as f: | 22 with open(tempfile_path) as f: |
24 results = json.load(f) | 23 results = json.load(f) |
25 | 24 |
26 parsed_results = common.parse_common_test_results(results) | 25 parsed_results = common.parse_common_test_results(results, test_separator='.') |
27 failures = parsed_results['unexpected_failures'] | 26 failures = parsed_results['unexpected_failures'] |
28 | 27 |
29 json.dump({ | 28 json.dump({ |
30 'valid': bool(rc <= common.MAX_FAILURES_EXIT_STATUS and | 29 'valid': bool(rc <= common.MAX_FAILURES_EXIT_STATUS and |
31 ((rc == 0) or failures)), | 30 ((rc == 0) or failures)), |
32 'failures': failures.keys(), | 31 'failures': failures.keys(), |
33 }, args.output) | 32 }, args.output) |
34 | 33 |
35 return rc | 34 return rc |
36 | 35 |
37 | 36 |
38 def main_compile_targets(args): | 37 def main_compile_targets(args): |
39 json.dump([], args.output) | 38 json.dump(['mandoline:tests'], args.output) |
40 | 39 |
41 | 40 |
42 if __name__ == '__main__': | 41 if __name__ == '__main__': |
43 funcs = { | 42 funcs = { |
44 'run': main_run, | 43 'run': main_run, |
45 'compile_targets': main_compile_targets, | 44 'compile_targets': main_compile_targets, |
46 } | 45 } |
47 sys.exit(common.run_script(sys.argv[1:], funcs)) | 46 sys.exit(common.run_script(sys.argv[1:], funcs)) |
OLD | NEW |