Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / testing / scripts / mojo_apptests.py
blob49b855da2faa813c5d984837b0ffc295970be96f
1 #!/usr/bin/env python
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
4 # found in the LICENSE file.
6 import json
7 import os
8 import sys
11 import common
14 def main_run(args):
15 runner = os.path.join(common.SRC_DIR, 'mojo', 'tools', 'apptest_runner.py')
16 build_dir = os.path.join(common.SRC_DIR, 'out', args.build_config_fs)
18 with common.temporary_file() as tempfile_path:
19 rc = common.run_command([runner, build_dir, '--verbose',
20 '--write-full-results-to', tempfile_path])
21 with open(tempfile_path) as f:
22 results = json.load(f)
24 parsed_results = common.parse_common_test_results(results, test_separator='.')
25 failures = parsed_results['unexpected_failures']
27 json.dump({
28 'valid': bool(rc <= common.MAX_FAILURES_EXIT_STATUS and
29 ((rc == 0) or failures)),
30 'failures': failures.keys(),
31 }, args.output)
33 return rc
36 def main_compile_targets(args):
37 json.dump(['mandoline:tests'], args.output)
40 if __name__ == '__main__':
41 funcs = {
42 'run': main_run,
43 'compile_targets': main_compile_targets,
45 sys.exit(common.run_script(sys.argv[1:], funcs))