• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# Copyright 2015 The Chromium Authors
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6import json
7import os
8import sys
9
10import common
11
12
13def main_run(args):
14  with common.temporary_file() as tempfile_path:
15    rc = common.run_command([
16        sys.executable,
17        os.path.join(common.SRC_DIR, 'third_party', 'blink', 'tools',
18                     'run_blinkpy_tests.py'),
19        '--write-full-results-to',
20        tempfile_path,
21    ],
22                            cwd=args.paths['checkout'])
23
24    with open(tempfile_path) as f:
25      results = json.load(f)
26
27  parsed_results = common.parse_common_test_results(results)
28  failures = parsed_results['unexpected_failures']
29
30  json.dump(
31      {
32          'valid':
33          bool(rc <= common.MAX_FAILURES_EXIT_STATUS and
34               ((rc == 0) or failures)),
35          'failures':
36          failures.keys(),
37      }, args.output)
38
39  return rc
40
41
42def main_compile_targets(args):
43  json.dump([], args.output)
44
45
46if __name__ == '__main__':
47  funcs = {
48      'run': main_run,
49      'compile_targets': main_compile_targets,
50  }
51  sys.exit(common.run_script(sys.argv[1:], funcs))
52